remove packaging
|
@ -1,29 +0,0 @@
|
|||
import argparse
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def main(args=None):
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('filename')
|
||||
parser.add_argument('commit')
|
||||
args = parser.parse_args(args)
|
||||
|
||||
with open(args.filename) as f:
|
||||
contents = f.read()
|
||||
|
||||
commit = args.commit[:7]
|
||||
|
||||
new_contents = re.sub(
|
||||
r'^__version__ = [\'"](.*)[\'"]$',
|
||||
r'__version__ = "\1-{}"'.format(commit),
|
||||
contents,
|
||||
flags=re.MULTILINE,
|
||||
)
|
||||
|
||||
with open(args.filename, 'w') as f:
|
||||
f.write(new_contents)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/sh
|
||||
# http://stackoverflow.com/a/246128
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# adapted from https://www.objc.io/issues/6-build-tools/travis-ci/#add-scripts
|
||||
|
||||
KEYCHAIN_PASSWORD=travis
|
||||
|
||||
# Create a custom keychain
|
||||
security create-keychain -p ${KEYCHAIN_PASSWORD} osx-build.keychain
|
||||
|
||||
# Make the custom keychain default, so xcodebuild will use it for signing
|
||||
security default-keychain -s osx-build.keychain
|
||||
|
||||
# Unlock the keychain
|
||||
security unlock-keychain -p ${KEYCHAIN_PASSWORD} osx-build.keychain
|
||||
|
||||
# Set keychain timeout to 1 hour for long builds
|
||||
# see http://www.egeek.me/2013/02/23/jenkins-and-xcode-user-interaction-is-not-allowed/
|
||||
security set-keychain-settings -t 3600 -l ~/Library/Keychains/osx-build.keychain
|
||||
|
||||
# Add certificates to keychain and allow codesign to access them
|
||||
security import ${DIR}/certs/dist.cer -k ~/Library/Keychains/osx-build.keychain -T /usr/bin/codesign
|
||||
security import ${DIR}/certs/dist.p12 -k ~/Library/Keychains/osx-build.keychain -P $KEY_PASSWORD -T /usr/bin/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iJHSwd43DFC6H9Qz7/CJM4uGc
|
||||
dVrx0QA/ru3/HXPUbg5oVyM3Rf0eFN9zjEZT60aXeKqdXcc6aYc9CX64wzWn+DKY
|
||||
n9qoy/5x5SzDmmwphbx8hbAk4yZIJex7dTKaqjr78Sz7KCUg/J2Y39mZD/NtwniN
|
||||
ssL57nYjjBu2HFfuqSIfe1aYG0bnRJAAwGLZr9Dbt7hwLDBGN/3Y9CfFoVjicwcr
|
||||
B+Tq01wVKOPftNskMCmKlz0Z2bO95NDceZKIUmHHp0jSS5ZckRVtwAIDSkYfrFD2
|
||||
zxMU+8O8rxbJRYT/PjdnGLjmp6Mw88SWSUy2tzje2f1Ay5vshtZLCYfxEI4nXRVq
|
||||
EjIMJeXgdGFW7PEdY/kROQ==
|
20
packaging/osx/lbry-osx-app/.gitignore
vendored
|
@ -1,20 +0,0 @@
|
|||
|
||||
*.pyc
|
||||
|
||||
*.pyo
|
||||
|
||||
*.so
|
||||
|
||||
*.xml
|
||||
|
||||
*.iml
|
||||
|
||||
id.conf
|
||||
|
||||
lbrycrd-cli
|
||||
lbrycrd-osx.zip
|
||||
lbrycrd-tx
|
||||
lbrycrdd
|
||||
|
||||
lbrynet.*.dmg
|
||||
LBRY.app
|
Before Width: | Height: | Size: 8.5 KiB |
|
@ -1,11 +0,0 @@
|
|||
badge_icon = 'app.icns'
|
||||
icon_locations = {
|
||||
'LBRY.app': (115, 164),
|
||||
'Applications': (387, 164)
|
||||
}
|
||||
background='dmg_background.png'
|
||||
default_view='icon-view'
|
||||
symlinks = { 'Applications': '/Applications' }
|
||||
window_rect=((200, 200), (500, 320))
|
||||
files = [ 'LBRY.app' ]
|
||||
icon_size=128
|
|
@ -1,60 +0,0 @@
|
|||
import os
|
||||
import json
|
||||
import webbrowser
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from time import sleep
|
||||
from jsonrpc.proxy import JSONRPCProxy
|
||||
|
||||
API_CONNECTION_STRING = "http://localhost:5279/lbryapi"
|
||||
UI_ADDRESS = "http://localhost:5279"
|
||||
|
||||
|
||||
class LBRYURIHandler(object):
|
||||
def __init__(self):
|
||||
self.started_daemon = False
|
||||
self.daemon = JSONRPCProxy.from_url(API_CONNECTION_STRING)
|
||||
|
||||
def handle_osx(self, lbry_name):
|
||||
try:
|
||||
status = self.daemon.is_running()
|
||||
except:
|
||||
os.system("open /Applications/LBRY.app")
|
||||
sleep(3)
|
||||
|
||||
if lbry_name == "lbry" or lbry_name == "":
|
||||
webbrowser.open(UI_ADDRESS)
|
||||
else:
|
||||
webbrowser.open(UI_ADDRESS + "/?show=" + lbry_name)
|
||||
|
||||
def handle_linux(self, lbry_name):
|
||||
try:
|
||||
status = self.daemon.is_running()
|
||||
except:
|
||||
cmd = r'DIR = "$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"' \
|
||||
r'if [-z "$(pgrep lbrynet-daemon)"]; then' \
|
||||
r'echo "running lbrynet-daemon"' \
|
||||
r'$DIR / lbrynet - daemon &' \
|
||||
r'sleep 3 # let the daemon load before connecting' \
|
||||
r'fi'
|
||||
subprocess.Popen(cmd, shell=True)
|
||||
|
||||
if lbry_name == "lbry" or lbry_name == "":
|
||||
webbrowser.open(UI_ADDRESS)
|
||||
else:
|
||||
webbrowser.open(UI_ADDRESS + "/?show=" + lbry_name)
|
||||
|
||||
|
||||
def main(args):
|
||||
if len(args) != 1:
|
||||
args = ['lbry://lbry']
|
||||
|
||||
name = args[0][7:]
|
||||
if sys.platform == "darwin":
|
||||
LBRYURIHandler().handle_osx(lbry_name=name)
|
||||
else:
|
||||
LBRYURIHandler().handle_linux(lbry_name=name)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
|
@ -1,71 +0,0 @@
|
|||
import AppKit
|
||||
import webbrowser
|
||||
import sys
|
||||
import logging
|
||||
import platform
|
||||
from twisted.internet import reactor
|
||||
|
||||
from lbrynet.lbrynet_daemon import DaemonControl
|
||||
from lbrynet import analytics
|
||||
from lbrynet import conf
|
||||
from lbrynet.core import utils
|
||||
|
||||
|
||||
if platform.mac_ver()[0] >= "10.10":
|
||||
from LBRYNotify import LBRYNotify
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def test_internet_connection():
|
||||
return utils.check_connection()
|
||||
|
||||
|
||||
class LBRYDaemonApp(AppKit.NSApplication):
|
||||
def finishLaunching(self):
|
||||
self.connection = False
|
||||
statusbar = AppKit.NSStatusBar.systemStatusBar()
|
||||
self.statusitem = statusbar.statusItemWithLength_(AppKit.NSVariableStatusItemLength)
|
||||
self.icon = AppKit.NSImage.alloc().initByReferencingFile_(conf.settings['ICON_PATH'])
|
||||
self.icon.setScalesWhenResized_(True)
|
||||
self.icon.setSize_((20, 20))
|
||||
self.statusitem.setImage_(self.icon)
|
||||
self.menubarMenu = AppKit.NSMenu.alloc().init()
|
||||
self.open = AppKit.NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
|
||||
"Open", "openui:", "")
|
||||
self.menubarMenu.addItem_(self.open)
|
||||
self.quit = AppKit.NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(
|
||||
"Quit", "applicationShouldTerminate:", "")
|
||||
self.menubarMenu.addItem_(self.quit)
|
||||
self.statusitem.setMenu_(self.menubarMenu)
|
||||
self.statusitem.setToolTip_(conf.settings['APP_NAME'])
|
||||
|
||||
if test_internet_connection():
|
||||
notify("Starting LBRY")
|
||||
else:
|
||||
notify("LBRY needs an internet connection to start, try again when one is available")
|
||||
sys.exit(0)
|
||||
|
||||
DaemonControl.start_server_and_listen(
|
||||
launchui=True, use_auth=False,
|
||||
analytics_manager=analytics.Manager.new_instance()
|
||||
)
|
||||
|
||||
def openui_(self, sender):
|
||||
webbrowser.open(conf.settings.get_ui_address())
|
||||
|
||||
# this code is from the example
|
||||
# https://pythonhosted.org/pyobjc/examples/Cocoa/Twisted/WebServicesTool/index.html
|
||||
def applicationShouldTerminate_(self, sender):
|
||||
if reactor.running:
|
||||
log.info('Stopping twisted event loop')
|
||||
notify("Goodbye!")
|
||||
reactor.stop()
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def notify(msg):
|
||||
if platform.mac_ver()[0] >= "10.10":
|
||||
LBRYNotify(msg)
|
|
@ -1,31 +0,0 @@
|
|||
import Foundation
|
||||
import objc
|
||||
|
||||
NSUserNotification = objc.lookUpClass('NSUserNotification')
|
||||
NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter')
|
||||
|
||||
|
||||
def LBRYNotify(message):
|
||||
notification = NSUserNotification.alloc().init()
|
||||
notification.setTitle_("LBRY")
|
||||
notification.setSubtitle_("")
|
||||
notification.setInformativeText_(message)
|
||||
notification.setUserInfo_({})
|
||||
notification.setSoundName_("NSUserNotificationDefaultSoundName")
|
||||
notification.setDeliveryDate_(
|
||||
Foundation.NSDate.dateWithTimeInterval_sinceDate_(0, Foundation.NSDate.date()))
|
||||
NSUserNotificationCenter.defaultUserNotificationCenter().scheduleNotification_(notification)
|
||||
|
||||
|
||||
def notify(title, subtitle, info_text, delay=0, sound=False, userInfo=None):
|
||||
userInfo = userInfo or {}
|
||||
notification = NSUserNotification.alloc().init()
|
||||
notification.setTitle_(title)
|
||||
notification.setSubtitle_(subtitle)
|
||||
notification.setInformativeText_(info_text)
|
||||
notification.setUserInfo_(userInfo)
|
||||
if sound:
|
||||
notification.setSoundName_("NSUserNotificationDefaultSoundName")
|
||||
notification.setDeliveryDate_(
|
||||
Foundation.NSDate.dateWithTimeInterval_sinceDate_(delay, Foundation.NSDate.date()))
|
||||
NSUserNotificationCenter.defaultUserNotificationCenter().scheduleNotification_(notification)
|
|
@ -1,31 +0,0 @@
|
|||
from PyObjCTools import AppHelper
|
||||
from twisted.internet.cfreactor import install
|
||||
install(runner=AppHelper.runEventLoop)
|
||||
from twisted.internet import reactor
|
||||
|
||||
import logging
|
||||
|
||||
from lbrynet import conf
|
||||
from lbrynet.core import log_support
|
||||
from LBRYApp import LBRYDaemonApp
|
||||
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
|
||||
def main():
|
||||
conf.initialize_settings()
|
||||
log_file = conf.settings.get_log_filename()
|
||||
log_support.configure_logging(log_file, console=True)
|
||||
app = LBRYDaemonApp.sharedApplication()
|
||||
reactor.addSystemEventTrigger("after", "shutdown", shutdown)
|
||||
reactor.run()
|
||||
|
||||
|
||||
def shutdown():
|
||||
log.info('Stopping event loop')
|
||||
AppHelper.stopEventLoop()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -1,29 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import os
|
||||
from setuptools import setup
|
||||
from lbrynet import conf
|
||||
|
||||
APP = [os.path.join('lbrygui', 'main.py')]
|
||||
DATA_FILES = []
|
||||
DATA_FILES.append('app.icns')
|
||||
|
||||
OPTIONS = {
|
||||
'iconfile': conf.ICON_PATH,
|
||||
'plist': {
|
||||
'CFBundleIdentifier': 'io.lbry.LBRY',
|
||||
'LSUIElement': True,
|
||||
},
|
||||
'packages': [
|
||||
'lbrynet', 'lbryum', 'requests', 'certifi',
|
||||
'pkg_resources', 'json', 'jsonrpc', 'seccure',
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
setup(
|
||||
name=conf.APP_NAME,
|
||||
app=APP,
|
||||
options={'py2app': OPTIONS},
|
||||
data_files=DATA_FILES,
|
||||
)
|
|
@ -1,128 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
set -o xtrace
|
||||
|
||||
DEST=`pwd`
|
||||
tmp="${DEST}/build"
|
||||
ON_TRAVIS=false
|
||||
|
||||
rm -rf build dist LBRY.app
|
||||
|
||||
echo "Updating lbrynet"
|
||||
if [ -z ${TRAVIS_BUILD_DIR+x} ]; then
|
||||
# building locally
|
||||
mkdir -p $tmp
|
||||
cd $tmp
|
||||
git clone --depth 1 http://github.com/lbryio/lbry.git
|
||||
cd lbry
|
||||
LBRY="${tmp}/lbry"
|
||||
else
|
||||
# building on travis
|
||||
ON_TRAVIS=true
|
||||
cd ${TRAVIS_BUILD_DIR}
|
||||
LBRY=${TRAVIS_BUILD_DIR}
|
||||
fi
|
||||
|
||||
pip install wheel
|
||||
MODULES="pyobjc-core==3.1.1 pyobjc-framework-Cocoa==3.1.1 pyobjc-framework-CFNetwork==3.1.1 pyobjc-framework-Quartz==3.1.1"
|
||||
if [ ${ON_TRAVIS} = true ]; then
|
||||
WHEEL_DIR="${TRAVIS_BUILD_DIR}/cache/wheel"
|
||||
mkdir -p "${WHEEL_DIR}"
|
||||
# mapping from the package name to the
|
||||
# actual built wheel file is surprisingly
|
||||
# hard so instead of checking for the existance
|
||||
# of each wheel, we mark with a file when they've all been
|
||||
# built and skip when that file exists
|
||||
for MODULE in ${MODULES}; do
|
||||
if [ ! -f "${WHEEL_DIR}"/${MODULE}.finished ]; then
|
||||
pip wheel -w "${WHEEL_DIR}" ${MODULE}
|
||||
touch "${WHEEL_DIR}"/${MODULE}.finished
|
||||
pip install ${MODULE}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
pip install $MODULES
|
||||
|
||||
|
||||
pip install dmgbuild==1.1.0
|
||||
export PATH=${PATH}:/Library/Frameworks/Python.framework/Versions/2.7/bin
|
||||
|
||||
# pyopenssl is needed because OSX ships an old version of openssl by default
|
||||
# and python will use it without pyopenssl
|
||||
pip install PyOpenSSL jsonrpc certifi
|
||||
|
||||
NAME=`python setup.py --name`
|
||||
VERSION=`python setup.py -V`
|
||||
pip install -r requirements.txt
|
||||
|
||||
|
||||
if [ -z ${SKIP_PYLINT+x} ]; then
|
||||
pip install pylint
|
||||
./run_pylint.sh packaging/osx/lbry-osx-app/lbrygui/
|
||||
fi
|
||||
|
||||
python setup.py install
|
||||
|
||||
echo "Building URI Handler"
|
||||
cd "${DEST}"
|
||||
|
||||
|
||||
if [ ! -d "py2app" ]; then
|
||||
hg clone https://bitbucket.org/ronaldoussoren/py2app
|
||||
cd py2app
|
||||
hg checkout py2app-0.10
|
||||
# this commit fixes a bug that should have been fixed as part of 0.10
|
||||
hg graft 149c25c413420120d3f383a9e854a17bc10d96fd
|
||||
pip install .
|
||||
cd ..
|
||||
rm -rf py2app
|
||||
fi
|
||||
|
||||
|
||||
rm -rf build dist
|
||||
python setup_uri_handler.py py2app
|
||||
|
||||
echo "Signing URI Handler"
|
||||
codesign -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRYURIHandler.app/Contents/Frameworks/Python.framework/Versions/2.7"
|
||||
codesign -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRYURIHandler.app/Contents/MacOS/python"
|
||||
# not sure if --deep is appropriate here, but need to get LBRYURIHandler.app/Contents/Frameworks/libcrypto.1.0.0.dylib signed
|
||||
codesign --deep -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRYURIHandler.app/Contents/MacOS/LBRYURIHandler"
|
||||
codesign -vvvv "${DEST}/dist/LBRYURIHandler.app"
|
||||
|
||||
# py2app will skip _cffi_backend without explicitly including it
|
||||
# and without this, we will get SSL handshake errors when connecting
|
||||
# to bittrex
|
||||
python setup_app.py py2app -i _cffi_backend
|
||||
|
||||
echo "Removing i386 libraries"
|
||||
|
||||
remove_arch () {
|
||||
if [[ `lipo "$2" -verify_arch "$1"` ]]; then
|
||||
lipo -output build/lipo.tmp -remove "$1" "$2" && mv build/lipo.tmp "$2"
|
||||
fi
|
||||
}
|
||||
|
||||
for i in `find dist/LBRY.app/Contents/Resources/lib/python2.7/lib-dynload/ -name "*.so"`; do
|
||||
remove_arch i386 $i
|
||||
done
|
||||
|
||||
|
||||
echo "Moving LBRYURIHandler.app into LBRY.app"
|
||||
mv "${DEST}/dist/LBRYURIHandler.app" "${DEST}/dist/LBRY.app/Contents/Resources"
|
||||
|
||||
echo "Signing LBRY.app"
|
||||
codesign -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRY.app/Contents/Frameworks/Python.framework/Versions/2.7"
|
||||
codesign -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRY.app/Contents/Frameworks/libgmp.10.dylib"
|
||||
codesign -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRY.app/Contents/MacOS/python"
|
||||
# adding deep here as well because of subcomponent issues
|
||||
codesign --deep -s "${LBRY_DEVELOPER_ID}" -f "${DEST}/dist/LBRY.app/Contents/MacOS/LBRY"
|
||||
codesign -vvvv "${DEST}/dist/LBRY.app"
|
||||
|
||||
rm -rf $tmp
|
||||
mv dist/LBRY.app LBRY.app
|
||||
|
||||
if [ -z ${SKIP_DMG+x} ]; then
|
||||
rm -rf dist "${NAME}.${VERSION}.dmg"
|
||||
dmgbuild -s dmg_settings.py "LBRY" "${NAME}.${VERSION}.dmg"
|
||||
fi
|
|
@ -1,26 +0,0 @@
|
|||
from setuptools import setup
|
||||
import os
|
||||
from lbrynet import conf
|
||||
|
||||
APP = [os.path.join('lbry_uri_handler', 'LBRYURIHandler.py')]
|
||||
DATA_FILES = []
|
||||
OPTIONS = {'argv_emulation': True,
|
||||
'packages': ['jsonrpc'],
|
||||
'plist': {
|
||||
'LSUIElement': True,
|
||||
'CFBundleIdentifier': 'io.lbry.LBRYURIHandler',
|
||||
'CFBundleURLTypes': [
|
||||
{
|
||||
'CFBundleURLTypes': 'LBRYURIHandler',
|
||||
'CFBundleURLSchemes': [conf.PROTOCOL_PREFIX]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
setup(
|
||||
app=APP,
|
||||
data_files=DATA_FILES,
|
||||
options={'py2app': OPTIONS},
|
||||
setup_requires=['py2app'],
|
||||
)
|
|
@ -1,48 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# This script is used by travis to install lbry from source
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
set -o xtrace
|
||||
|
||||
SUDO=''
|
||||
if (( $EUID != 0 )); then
|
||||
SUDO='sudo'
|
||||
fi
|
||||
|
||||
if [ -z ${TRAVIS+x} ]; then
|
||||
# if not on travis, its nice to see progress
|
||||
QUIET=""
|
||||
else
|
||||
QUIET="-qq"
|
||||
fi
|
||||
|
||||
# get the required OS packages
|
||||
$SUDO apt-get ${QUIET} update
|
||||
$SUDO apt-get ${QUIET} install -y --no-install-recommends \
|
||||
build-essential python-dev libffi-dev libssl-dev git \
|
||||
libgmp3-dev wget ca-certificates python-virtualenv
|
||||
|
||||
# create a virtualenv so we don't muck with anything on the system
|
||||
virtualenv venv
|
||||
# need to unset these or else we can't activate
|
||||
set +eu
|
||||
source venv/bin/activate
|
||||
set -eu
|
||||
|
||||
# need a modern version of pip (more modern than ubuntu default)
|
||||
wget https://bootstrap.pypa.io/get-pip.py
|
||||
python get-pip.py
|
||||
rm get-pip.py
|
||||
|
||||
pip install -r requirements.txt
|
||||
pip install cython
|
||||
pip install unqlite
|
||||
|
||||
pip install mock pylint coveralls
|
||||
# have to do `which trial` instead of simply trial because coverage needs the full path
|
||||
coverage run --source=lbrynet `which trial` tests
|
||||
coveralls
|
||||
|
||||
./run_pylint.sh
|
|
@ -1,35 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Configure build-specific things
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
set -o xtrace
|
||||
|
||||
# changes to this script also need to be added to build.ps1 for windows
|
||||
add_ui() {
|
||||
wget https://s3.amazonaws.com/lbry-ui/development/dist.zip -O dist.zip
|
||||
unzip -oq dist.zip -d lbrynet/resources/ui
|
||||
wget https://s3.amazonaws.com/lbry-ui/development/data.json -O lbrynet/resources/ui/data.json
|
||||
}
|
||||
|
||||
set_build() {
|
||||
local file="lbrynet/build_type.py"
|
||||
# cannot use 'sed -i' because BSD sed and GNU sed are incompatible
|
||||
sed 's/^\(BUILD = "\)[^"]\+\(".*\)$/\1'"${1}"'\2/' "$file" > tmpbuildfile
|
||||
mv -- tmpbuildfile "$file"
|
||||
}
|
||||
|
||||
IS_RC_REGEX="v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+rc[[:digit:]]+"
|
||||
|
||||
if [[ -z "$TRAVIS_TAG" ]]; then
|
||||
python packaging/append_sha_to_version.py lbrynet/__init__.py "${TRAVIS_COMMIT}"
|
||||
add_ui
|
||||
set_build "qa"
|
||||
elif [[ "$TRAVIS_TAG" =~ $IS_RC_REGEX ]]; then
|
||||
# If the tag looks like v0.7.6rc0 then this is a tagged release candidate.
|
||||
add_ui
|
||||
set_build "rc"
|
||||
else
|
||||
set_build "release"
|
||||
fi
|
|
@ -1,25 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -euo pipefail
|
||||
set -o xtrace
|
||||
|
||||
wget https://www.python.org/ftp/python/2.7.11/python-2.7.11-macosx10.6.pkg
|
||||
sudo installer -pkg python-2.7.11-macosx10.6.pkg -target /
|
||||
pip install -U pip
|
||||
brew update
|
||||
|
||||
# follow this pattern to avoid failing if its already
|
||||
# installed by brew:
|
||||
# http://stackoverflow.com/a/20802425
|
||||
if brew ls --versions gmp > /dev/null; then
|
||||
echo 'gmp is already installed by brew'
|
||||
else
|
||||
brew install gmp
|
||||
fi
|
||||
|
||||
if brew ls --versions openssl > /dev/null; then
|
||||
echo 'openssl is already installed by brew'
|
||||
else
|
||||
brew install openssl
|
||||
brew link --force openssl
|
||||
fi
|
|
@ -1,5 +0,0 @@
|
|||
# package scripts
|
||||
|
||||
How to build LBRY packages.
|
||||
|
||||
For best results, run on a fresh image.
|
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 6.1 KiB |
|
@ -1,48 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
urlencode() {
|
||||
local LANG=C
|
||||
local length="${#1}"
|
||||
for (( i = 0; i < length; i++ )); do
|
||||
local c="${1:i:1}"
|
||||
case $c in
|
||||
[a-zA-Z0-9.~_-]) printf "$c" ;;
|
||||
*) printf '%%%02X' "'$c" ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# find true dir of executable
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
|
||||
if [ -z "$(pgrep lbrynet-daemon)" ]; then
|
||||
echo "running lbrynet-daemon"
|
||||
$DIR/lbrynet-daemon &
|
||||
sleep 3 # let the daemon load before connecting
|
||||
fi
|
||||
|
||||
ARG=${1:-}
|
||||
|
||||
if [ -z "$ARG" ]; then
|
||||
URL=""
|
||||
else
|
||||
NAME=$(echo "$ARG" | cut -c 8-)
|
||||
if [ -z "$NAME" -o "$NAME" == "lbry" ]; then
|
||||
URL=""
|
||||
else
|
||||
URL="/?show=$(urlencode "$NAME")"
|
||||
fi
|
||||
fi
|
||||
|
||||
/usr/bin/xdg-open "http://localhost:5279$URL"
|
|
@ -1,11 +0,0 @@
|
|||
description "LBRY Daemon"
|
||||
|
||||
#start on (local-filesystems and net-device-up IFACE=eth0)
|
||||
stop on runlevel [016]
|
||||
|
||||
#expect fork
|
||||
|
||||
respawn
|
||||
respawn limit 5 20
|
||||
|
||||
exec /opt/venvs/lbrynet/bin/lbrynet-daemon
|
|
@ -1,19 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Version=0.8.3
|
||||
Name=LBRY
|
||||
Comment=The world's first user-owned content marketplace
|
||||
Icon=lbry
|
||||
GenericName=Content Marketplace
|
||||
Categories=Network;Internet;Filesharing
|
||||
Terminal=false
|
||||
Type=Application
|
||||
|
||||
MimeType=x-scheme-handler/lbry;
|
||||
|
||||
Exec=/usr/bin/lbry %U
|
||||
|
||||
Actions=StopDaemon;
|
||||
|
||||
[Desktop Action StopDaemon]
|
||||
Name=Stop Daemon
|
||||
Exec=/opt/venvs/lbrynet/bin/stop-lbrynet-daemon
|
|
@ -1,15 +0,0 @@
|
|||
|
||||
(
|
||||
|
||||
if hash zenity 2>/dev/null; then
|
||||
sleep 3
|
||||
|
||||
zenity --info --icon-name="system-software-install" \
|
||||
--text="\
|
||||
<span size=\"xx-large\">LBRY Installed</span>\n\nLBRY has been installed.\n\n\
|
||||
Please start LBRY by running <b><tt>lbry</tt></b> from the command line or selecting <b>LBRY</b> from the application menu.\n\n\
|
||||
If you need help or have any questions, join us on Slack (<tt>https://slack.lbry.io</tt>) or email <tt>hello@lbry.io</tt>.\
|
||||
"
|
||||
|
||||
fi
|
||||
) &
|
|
@ -1,204 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
function HELP {
|
||||
echo "Build a debian package for lbry"
|
||||
echo "-----"
|
||||
echo "When run without any arguments, this script expects the current directory"
|
||||
echo "to be the main lbry repo and it builds what is in that directory"
|
||||
echo
|
||||
echo "Optional arguments:"
|
||||
echo
|
||||
echo "-c: clone a fresh copy of the repo"
|
||||
echo "-b <branch>: use the specified branch of the lbry repo"
|
||||
echo "-w <web-ui-branch>: set the webui branch"
|
||||
echo "-d <build-dir>: specifiy the build directory"
|
||||
echo "-h: show help"
|
||||
echo "-t: turn trace on"
|
||||
exit 1
|
||||
}
|
||||
|
||||
CLONE=false
|
||||
BUILD_DIR=""
|
||||
BRANCH=""
|
||||
WEB_UI_BRANCH="master"
|
||||
|
||||
while getopts :hctb:w:d: FLAG; do
|
||||
case $FLAG in
|
||||
c)
|
||||
CLONE=true
|
||||
;;
|
||||
b)
|
||||
BRANCH=${OPTARG}
|
||||
;;
|
||||
w)
|
||||
WEB_UI_BRANCH=${OPTARG}
|
||||
;;
|
||||
d)
|
||||
BUILD_DIR=${OPTARG}
|
||||
;;
|
||||
t)
|
||||
set -o xtrace
|
||||
;;
|
||||
h)
|
||||
HELP
|
||||
;;
|
||||
\?) #unrecognized option - show help
|
||||
echo "Option -$OPTARG not allowed."
|
||||
HELP
|
||||
;;
|
||||
:)
|
||||
echo "Option -$OPTARG requires an argument."
|
||||
HELP
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND-1))
|
||||
|
||||
|
||||
SUDO=''
|
||||
if (( $EUID != 0 )); then
|
||||
SUDO='sudo'
|
||||
fi
|
||||
|
||||
if [ "$CLONE" = false ]; then
|
||||
if [ `basename $PWD` != "lbry" ]; then
|
||||
echo "Not currently in the lbry directory. Cowardly refusing to go forward"
|
||||
exit 1
|
||||
fi
|
||||
SOURCE_DIR=$PWD
|
||||
fi
|
||||
|
||||
if [ -z "${BUILD_DIR}" ]; then
|
||||
if [ "$CLONE" = true ]; then
|
||||
# build in the current directory
|
||||
BUILD_DIR="lbry-build-$(date +%Y%m%d-%H%M%S)"
|
||||
else
|
||||
BUILD_DIR="../lbry-build-$(date +%Y%m%d-%H%M%S)"
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p "$BUILD_DIR"
|
||||
cd "$BUILD_DIR"
|
||||
|
||||
if [ -z ${TRAVIS+x} ]; then
|
||||
# if not on travis, its nice to see progress
|
||||
QUIET=""
|
||||
else
|
||||
QUIET="-qq"
|
||||
fi
|
||||
|
||||
# get the required OS packages
|
||||
$SUDO apt-get ${QUIET} update
|
||||
$SUDO apt-get ${QUIET} install -y --no-install-recommends software-properties-common
|
||||
$SUDO add-apt-repository -y ppa:spotify-jyrki/dh-virtualenv
|
||||
$SUDO apt-get ${QUIET} update
|
||||
$SUDO apt-get ${QUIET} install -y --no-install-recommends \
|
||||
build-essential git python-dev libffi-dev libssl-dev \
|
||||
libgmp3-dev dh-virtualenv debhelper wget python-pip fakeroot
|
||||
|
||||
# need a modern version of pip (more modern than ubuntu default)
|
||||
$SUDO pip install --upgrade pip
|
||||
$SUDO pip install git+https://github.com/jobevers/make-deb
|
||||
|
||||
# build packages
|
||||
#
|
||||
# dpkg-buildpackage outputs its results into '..' so
|
||||
# we need to move/clone lbry into the build directory
|
||||
if [ "$CLONE" == true ]; then
|
||||
git clone https://github.com/lbryio/lbry.git
|
||||
else
|
||||
cp -a $SOURCE_DIR lbry
|
||||
fi
|
||||
(
|
||||
cd lbry
|
||||
if [ -n "${BRANCH}" ]; then
|
||||
git checkout "${BRANCH}"
|
||||
fi
|
||||
make-deb
|
||||
dpkg-buildpackage -us -uc
|
||||
)
|
||||
|
||||
|
||||
### insert our extra files
|
||||
|
||||
# extract .deb
|
||||
PACKAGE="$(ls | grep '.deb')"
|
||||
ar vx "$PACKAGE"
|
||||
mkdir control data
|
||||
tar -xzf control.tar.gz --directory control
|
||||
|
||||
# The output of the travis build is a
|
||||
# tar.gz and the output locally is tar.xz.
|
||||
# Instead of having tar detect the compression used, we
|
||||
# could update the config to output the same in either spot.
|
||||
# Unfortunately, doing so requires editting some auto-generated
|
||||
# files: http://linux.spiney.org/forcing_gzip_compression_when_building_debian_packages
|
||||
tar -xf data.tar.?z --directory data
|
||||
|
||||
PACKAGING_DIR='lbry/packaging/ubuntu'
|
||||
|
||||
# set web ui branch
|
||||
sed -i "s/^WEB_UI_BRANCH='[^']\+'/WEB_UI_BRANCH='$WEB_UI_BRANCH'/" "$PACKAGING_DIR/lbry"
|
||||
|
||||
# add files
|
||||
function addfile() {
|
||||
FILE="$1"
|
||||
TARGET="$2"
|
||||
mkdir -p "$(dirname "data/$TARGET")"
|
||||
cp -d "$FILE" "data/$TARGET"
|
||||
echo "$(md5sum "data/$TARGET" | cut -d' ' -f1) $TARGET" >> control/md5sums
|
||||
}
|
||||
|
||||
function addlink() {
|
||||
SRC="$1"
|
||||
TARGET="$2"
|
||||
TMP="$PACKAGING_DIR/lbry-temp-symlink"
|
||||
ln -s "$SRC" "$TMP"
|
||||
addfile "$TMP" "$TARGET"
|
||||
rm "$TMP"
|
||||
}
|
||||
|
||||
# add icons
|
||||
addfile "$PACKAGING_DIR/icons/lbry32.png" usr/share/icons/hicolor/32x32/apps/lbry.png
|
||||
addfile "$PACKAGING_DIR/icons/lbry48.png" usr/share/icons/hicolor/48x48/apps/lbry.png
|
||||
addfile "$PACKAGING_DIR/icons/lbry96.png" usr/share/icons/hicolor/96x96/apps/lbry.png
|
||||
addfile "$PACKAGING_DIR/icons/lbry128.png" usr/share/icons/hicolor/128x128/apps/lbry.png
|
||||
addfile "$PACKAGING_DIR/icons/lbry256.png" usr/share/icons/hicolor/256x256/apps/lbry.png
|
||||
addfile "$PACKAGING_DIR/lbry.desktop" usr/share/applications/lbry.desktop
|
||||
|
||||
# add lbry executable script
|
||||
BINPATH=opt/venvs/lbrynet/bin
|
||||
addfile "$PACKAGING_DIR/lbry" "$BINPATH/lbry"
|
||||
|
||||
# symlink scripts into /usr/bin
|
||||
for script in "lbry" "lbrynet-daemon" "lbrynet-cli" "stop-lbrynet-daemon"; do
|
||||
addlink "/$BINPATH/$script" "usr/bin/$script"
|
||||
done
|
||||
|
||||
# add postinstall script
|
||||
cat "$PACKAGING_DIR/postinst_append" >> control/postinst
|
||||
|
||||
# change package name from lbrynet to lbry
|
||||
sed -i 's/^Package: lbrynet/Package: lbry/' control/control
|
||||
echo "Conflicts: lbrynet (<< 0.3.5)" >> control/control
|
||||
echo "Replaces: lbrynet (<< 0.3.5)" >> control/control
|
||||
|
||||
# repackage .deb
|
||||
$SUDO chown -R root:root control data
|
||||
tar -czf control.tar.gz -C control .
|
||||
tar -cJf data.tar.xz -C data .
|
||||
$SUDO chown root:root debian-binary control.tar.gz data.tar.xz
|
||||
ar r "$PACKAGE" debian-binary control.tar.gz data.tar.xz
|
||||
|
||||
# TODO: we can append to data.tar instead of extracting it all and recompressing
|
||||
|
||||
if [[ ! -z "${TRAVIS_BUILD_DIR+x}" ]]; then
|
||||
# move it to a consistent place so that later it can be uploaded
|
||||
# to the github releases page
|
||||
mv "${PACKAGE}" "${TRAVIS_BUILD_DIR}/${PACKAGE}"
|
||||
# want to be able to check the size of the result in the log
|
||||
ls -l "${TRAVIS_BUILD_DIR}/${PACKAGE}"
|
||||
fi
|
|
@ -1,38 +0,0 @@
|
|||
# this is a port of setup_build.sh used for the unix platforms
|
||||
|
||||
function AddUi {
|
||||
wget https://s3.amazonaws.com/lbry-ui/development/dist.zip -OutFile dist.zip
|
||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||
|
||||
Expand-Archive dist.zip -dest lbrynet\resources\ui
|
||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||
|
||||
wget https://s3.amazonaws.com/lbry-ui/development/data.json -OutFile lbrynet\resources\ui\data.json
|
||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||
}
|
||||
|
||||
function SetBuild([string]$build) {
|
||||
(Get-Content lbrynet\build_type.py).replace('dev', $build) | Set-Content lbrynet\build_type.py
|
||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||
}
|
||||
|
||||
If (${Env:APPVEYOR_REPO_TAG} -NotMatch "true") {
|
||||
C:\Python27\python.exe packaging\append_sha_to_version.py lbrynet\__init__.py ${Env:APPVEYOR_REPO_COMMIT}
|
||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||
|
||||
AddUi
|
||||
SetBuild "qa"
|
||||
}
|
||||
ElseIf (${Env:APPVEYOR_REPO_TAG_NAME} -Match "v\d+\.\d+\.\d+rc\d+") {
|
||||
# If the tag looks like v0.7.6rc0 then this is a tagged release candidate.
|
||||
AddUi
|
||||
SetBuild "rc"
|
||||
}
|
||||
Else {
|
||||
SetBuild "release"
|
||||
}
|
||||
|
||||
C:\Python27\python.exe setup.py build bdist_msi
|
||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||
|
||||
signtool.exe sign /f packaging\windows\certs\lbry2.pfx /p %key_pass% /tr http://tsa.starfieldtech.com /td SHA256 /fd SHA256 dist\*.msi
|
|
@ -1,100 +0,0 @@
|
|||
$env:Path += ";C:\MinGW\bin\"
|
||||
|
||||
$env:Path += ";C:\Program Files (x86)\Windows Kits\10\bin\x86\"
|
||||
|
||||
gcc --version
|
||||
|
||||
mingw32-make --version
|
||||
|
||||
mkdir C:\temp
|
||||
|
||||
Invoke-WebRequest "https://pypi.python.org/packages/55/90/e987e28ed29b571f315afea7d317b6bf4a551e37386b344190cffec60e72/miniupnpc-1.9.tar.gz" -OutFile "C:\temp\miniupnpc-1.9.tar.gz"
|
||||
|
||||
cd C:\temp
|
||||
|
||||
7z e miniupnpc-1.9.tar.gz
|
||||
|
||||
7z x miniupnpc-1.9.tar
|
||||
|
||||
cd C:\temp\miniupnpc-1.9
|
||||
|
||||
mingw32-make.exe -f Makefile.mingw
|
||||
|
||||
C:\Python27\python.exe C:\temp\miniupnpc-1.9\setupmingw32.py build --compiler=mingw32
|
||||
|
||||
C:\Python27\python.exe C:\temp\miniupnpc-1.9\setupmingw32.py install
|
||||
|
||||
Invoke-WebRequest "https://github.com/lbryio/lbry/raw/master/packaging/windows/libs/gmpy-1.17-cp27-none-win32.whl" -OutFile "C:\temp\gmpy-1.17-cp27-none-win32.whl"
|
||||
|
||||
C:\Python27\Scripts\pip.exe install "C:\temp\gmpy-1.17-cp27-none-win32.whl"
|
||||
|
||||
C:\Python27\Scripts\pip.exe install pypiwin32==219
|
||||
|
||||
C:\Python27\Scripts\pip.exe install six==1.9.0
|
||||
|
||||
C:\Python27\Scripts\pip.exe install requests==2.9.1
|
||||
|
||||
C:\Python27\Scripts\pip.exe install zope.interface==4.1.3
|
||||
|
||||
# this is a patched to allow version numbers with non-integer values
|
||||
# and it is branched off of 4.3.3
|
||||
C:\Python27\Scripts\pip.exe install https://bitbucket.org/jobevers/cx_freeze/get/handle-version.tar.gz
|
||||
|
||||
C:\Python27\Scripts\pip.exe install cython==0.24.1
|
||||
|
||||
C:\Python27\Scripts\pip.exe install Twisted==16.0.0
|
||||
|
||||
C:\Python27\Scripts\pip.exe install Yapsy==1.11.223
|
||||
|
||||
C:\Python27\Scripts\pip.exe install appdirs==1.4.0
|
||||
|
||||
C:\Python27\Scripts\pip.exe install argparse==1.2.1
|
||||
|
||||
C:\Python27\Scripts\pip.exe install colorama==0.3.7
|
||||
|
||||
C:\Python27\Scripts\pip.exe install dnspython==1.12.0
|
||||
|
||||
C:\Python27\Scripts\pip.exe install ecdsa==0.13
|
||||
C:\Python27\Scripts\pip.exe install envparse==0.2.0
|
||||
|
||||
C:\Python27\Scripts\pip.exe install jsonrpc==1.2
|
||||
|
||||
C:\Python27\Scripts\pip.exe install jsonrpclib==0.1.7
|
||||
|
||||
C:\Python27\Scripts\pip.exe install loggly-python-handler==1.0.0
|
||||
|
||||
C:\Python27\Scripts\pip.exe install pbkdf2==1.3
|
||||
|
||||
C:\Python27\Scripts\pip.exe install protobuf==3.0.0
|
||||
|
||||
C:\Python27\Scripts\pip.exe install pycrypto==2.6.1
|
||||
|
||||
C:\Python27\Scripts\pip.exe install python-bitcoinrpc==0.1
|
||||
|
||||
C:\Python27\Scripts\pip.exe install pyyaml==3.12
|
||||
|
||||
C:\Python27\Scripts\pip.exe install qrcode==5.2.2
|
||||
|
||||
C:\Python27\Scripts\pip.exe install requests_futures==0.9.7
|
||||
|
||||
C:\Python27\Scripts\pip.exe install seccure==0.3.1.3
|
||||
|
||||
C:\Python27\Scripts\pip.exe install simplejson==3.8.2
|
||||
|
||||
C:\Python27\Scripts\pip.exe install slowaes==0.1a1
|
||||
|
||||
C:\Python27\Scripts\pip.exe install txJSON-RPC==0.5
|
||||
|
||||
C:\Python27\Scripts\pip.exe install unqlite==0.5.3
|
||||
|
||||
C:\Python27\Scripts\pip.exe install wsgiref==0.1.2
|
||||
|
||||
C:\Python27\Scripts\pip.exe install base58==0.2.2
|
||||
|
||||
C:\Python27\Scripts\pip.exe install googlefinance==0.7
|
||||
|
||||
C:\Python27\Scripts\pip.exe install jsonschema==2.5.1
|
||||
|
||||
C:\Python27\Scripts\pip.exe install git+https://github.com/lbryio/lbryum.git
|
||||
|
||||
cd C:\projects\lbry
|
|
@ -1,15 +0,0 @@
|
|||
C:\Python27\python.exe setup.py install
|
||||
|
||||
# If this is a build because of a tag, make sure that
|
||||
# its either a testing tag or a tag that matches the version
|
||||
# specified in the source code.
|
||||
If (${Env:APPVEYOR_REPO_TAG} -Match "true") {
|
||||
If (${Env:APPVEYOR_REPO_TAG_NAME} -Like "test*") {
|
||||
exit 0
|
||||
}
|
||||
# non-testing tags should be in the form v1.2.3
|
||||
If ("v$(C:\Python27\python.exe setup.py -V)" -Match ${Env:APPVEYOR_REPO_TAG_NAME}) {
|
||||
exit 0
|
||||
}
|
||||
exit 1
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
Windows Registry Editor Version 5.00
|
||||
|
||||
[HKEY_CLASSES_ROOT\lbry]
|
||||
@="URL:LBRY Protocol"
|
||||
"URL Protocol"=""
|
||||
|
||||
[HKEY_CLASSES_ROOT\lbry\DefaultIcon]
|
||||
@="\"LBRY.exe,1\""
|
||||
|
||||
[HKEY_CLASSES_ROOT\lbry\shell]
|
||||
|
||||
[HKEY_CLASSES_ROOT\lbry\shell\open]
|
||||
|
||||
[HKEY_CLASSES_ROOT\lbry\shell\open\command]
|
||||
@="\"C:\\Program Files (x86)\\LBRY\\LBRY.exe\" \"%1\""
|
|
@ -1,302 +0,0 @@
|
|||
import logging
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
import webbrowser
|
||||
|
||||
import win32api
|
||||
import win32con
|
||||
import win32gui_struct
|
||||
from jsonrpc.proxy import JSONRPCProxy
|
||||
from twisted.internet import reactor, error
|
||||
|
||||
try:
|
||||
import winxpgui as win32gui
|
||||
except ImportError:
|
||||
import win32gui
|
||||
|
||||
from lbrynet import conf, analytics
|
||||
from lbrynet.core import log_support
|
||||
from lbrynet.core import utils
|
||||
from lbrynet.lbrynet_daemon import DaemonControl
|
||||
from lbrynet import conf
|
||||
from uri_handler.LBRYURIHandler import LBRYURIHandler
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def test_internet_connection():
|
||||
return utils.check_connection()
|
||||
|
||||
|
||||
def non_string_iterable(obj):
|
||||
try:
|
||||
iter(obj)
|
||||
except TypeError:
|
||||
return False
|
||||
else:
|
||||
return not isinstance(obj, basestring)
|
||||
|
||||
|
||||
class SysTrayIcon(object):
|
||||
"""TODO"""
|
||||
QUIT = 'QUIT'
|
||||
SPECIAL_ACTIONS = [QUIT]
|
||||
|
||||
FIRST_ID = 1023
|
||||
|
||||
def __init__(self,
|
||||
icon,
|
||||
hover_text,
|
||||
menu_options,
|
||||
on_quit=None,
|
||||
default_menu_index=None,
|
||||
window_class_name=None, ):
|
||||
|
||||
self.icon = icon
|
||||
self.hover_text = hover_text
|
||||
self.on_quit = on_quit
|
||||
|
||||
menu_options = menu_options + (('Quit', None, self.QUIT),)
|
||||
self._next_action_id = self.FIRST_ID
|
||||
self.menu_actions_by_id = set()
|
||||
self.menu_options = self._add_ids_to_menu_options(list(menu_options))
|
||||
self.menu_actions_by_id = dict(self.menu_actions_by_id)
|
||||
del self._next_action_id
|
||||
|
||||
self.default_menu_index = (default_menu_index or 0)
|
||||
self.window_class_name = window_class_name or "SysTrayIconPy"
|
||||
|
||||
message_map = {win32gui.RegisterWindowMessage("TaskbarCreated"): self.restart,
|
||||
win32con.WM_DESTROY: self.destroy,
|
||||
win32con.WM_COMMAND: self.command,
|
||||
win32con.WM_USER + 20: self.notify,}
|
||||
# Register the Window class.
|
||||
window_class = win32gui.WNDCLASS()
|
||||
hinst = window_class.hInstance = win32gui.GetModuleHandle(None)
|
||||
window_class.lpszClassName = self.window_class_name
|
||||
window_class.style = win32con.CS_VREDRAW | win32con.CS_HREDRAW;
|
||||
window_class.hCursor = win32gui.LoadCursor(0, win32con.IDC_ARROW)
|
||||
window_class.hbrBackground = win32con.COLOR_WINDOW
|
||||
window_class.lpfnWndProc = message_map # could also specify a wndproc.
|
||||
classAtom = win32gui.RegisterClass(window_class)
|
||||
# Create the Window.
|
||||
style = win32con.WS_OVERLAPPED | win32con.WS_SYSMENU
|
||||
self.hwnd = win32gui.CreateWindow(classAtom,
|
||||
self.window_class_name,
|
||||
style,
|
||||
0,
|
||||
0,
|
||||
win32con.CW_USEDEFAULT,
|
||||
win32con.CW_USEDEFAULT,
|
||||
0,
|
||||
0,
|
||||
hinst,
|
||||
None)
|
||||
win32gui.UpdateWindow(self.hwnd)
|
||||
self.notify_id = None
|
||||
self.refresh_icon()
|
||||
|
||||
win32gui.PumpMessages()
|
||||
|
||||
def _add_ids_to_menu_options(self, menu_options):
|
||||
result = []
|
||||
for menu_option in menu_options:
|
||||
option_text, option_icon, option_action = menu_option
|
||||
if callable(option_action) or option_action in self.SPECIAL_ACTIONS:
|
||||
self.menu_actions_by_id.add((self._next_action_id, option_action))
|
||||
result.append(menu_option + (self._next_action_id,))
|
||||
elif non_string_iterable(option_action):
|
||||
result.append((option_text,
|
||||
option_icon,
|
||||
self._add_ids_to_menu_options(option_action),
|
||||
self._next_action_id))
|
||||
else:
|
||||
print 'Unknown item', option_text, option_icon, option_action
|
||||
self._next_action_id += 1
|
||||
return result
|
||||
|
||||
def refresh_icon(self):
|
||||
# Try and find a custom icon
|
||||
hinst = win32gui.GetModuleHandle(None)
|
||||
if os.path.isfile(self.icon):
|
||||
icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
|
||||
hicon = win32gui.LoadImage(hinst,
|
||||
self.icon,
|
||||
win32con.IMAGE_ICON,
|
||||
0,
|
||||
0,
|
||||
icon_flags)
|
||||
else:
|
||||
print "Can't find icon file - using default."
|
||||
hicon = win32gui.LoadIcon(0, win32con.IDI_APPLICATION)
|
||||
|
||||
if self.notify_id:
|
||||
message = win32gui.NIM_MODIFY
|
||||
else:
|
||||
message = win32gui.NIM_ADD
|
||||
self.notify_id = (self.hwnd,
|
||||
0,
|
||||
win32gui.NIF_ICON | win32gui.NIF_MESSAGE | win32gui.NIF_TIP,
|
||||
win32con.WM_USER + 20,
|
||||
hicon,
|
||||
self.hover_text)
|
||||
win32gui.Shell_NotifyIcon(message, self.notify_id)
|
||||
|
||||
def restart(self, hwnd, msg, wparam, lparam):
|
||||
self.refresh_icon()
|
||||
|
||||
def destroy(self, hwnd, msg, wparam, lparam):
|
||||
if self.on_quit: self.on_quit(self)
|
||||
nid = (self.hwnd, 0)
|
||||
win32gui.Shell_NotifyIcon(win32gui.NIM_DELETE, nid)
|
||||
win32gui.PostQuitMessage(0) # Terminate the app.
|
||||
|
||||
def notify(self, hwnd, msg, wparam, lparam):
|
||||
if lparam == win32con.WM_LBUTTONDBLCLK:
|
||||
self.execute_menu_option(self.default_menu_index + self.FIRST_ID)
|
||||
elif lparam == win32con.WM_RBUTTONUP:
|
||||
self.show_menu()
|
||||
elif lparam == win32con.WM_LBUTTONUP:
|
||||
pass
|
||||
return True
|
||||
|
||||
def show_menu(self):
|
||||
menu = win32gui.CreatePopupMenu()
|
||||
self.create_menu(menu, self.menu_options)
|
||||
|
||||
pos = win32gui.GetCursorPos()
|
||||
# See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/menus_0hdi.asp
|
||||
win32gui.SetForegroundWindow(self.hwnd)
|
||||
win32gui.TrackPopupMenu(menu,
|
||||
win32con.TPM_LEFTALIGN,
|
||||
pos[0],
|
||||
pos[1],
|
||||
0,
|
||||
self.hwnd,
|
||||
None)
|
||||
win32gui.PostMessage(self.hwnd, win32con.WM_NULL, 0, 0)
|
||||
|
||||
def create_menu(self, menu, menu_options):
|
||||
for option_text, option_icon, option_action, option_id in menu_options[::-1]:
|
||||
if option_icon:
|
||||
option_icon = self.prep_menu_icon(option_icon)
|
||||
|
||||
if option_id in self.menu_actions_by_id:
|
||||
item, extras = win32gui_struct.PackMENUITEMINFO(text=option_text,
|
||||
hbmpItem=option_icon,
|
||||
wID=option_id)
|
||||
win32gui.InsertMenuItem(menu, 0, 1, item)
|
||||
else:
|
||||
submenu = win32gui.CreatePopupMenu()
|
||||
self.create_menu(submenu, option_action)
|
||||
item, extras = win32gui_struct.PackMENUITEMINFO(text=option_text,
|
||||
hbmpItem=option_icon,
|
||||
hSubMenu=submenu)
|
||||
win32gui.InsertMenuItem(menu, 0, 1, item)
|
||||
|
||||
def prep_menu_icon(self, icon):
|
||||
# First load the icon.
|
||||
ico_x = win32api.GetSystemMetrics(win32con.SM_CXSMICON)
|
||||
ico_y = win32api.GetSystemMetrics(win32con.SM_CYSMICON)
|
||||
hicon = win32gui.LoadImage(
|
||||
0, icon, win32con.IMAGE_ICON, ico_x, ico_y, win32con.LR_LOADFROMFILE)
|
||||
|
||||
hdcBitmap = win32gui.CreateCompatibleDC(0)
|
||||
hdcScreen = win32gui.GetDC(0)
|
||||
hbm = win32gui.CreateCompatibleBitmap(hdcScreen, ico_x, ico_y)
|
||||
hbmOld = win32gui.SelectObject(hdcBitmap, hbm)
|
||||
# Fill the background.
|
||||
brush = win32gui.GetSysColorBrush(win32con.COLOR_MENU)
|
||||
win32gui.FillRect(hdcBitmap, (0, 0, 16, 16), brush)
|
||||
# unclear if brush needs to be feed. Best clue I can find is:
|
||||
# "GetSysColorBrush returns a cached brush instead of allocating a new
|
||||
# one." - implies no DeleteObject
|
||||
# draw the icon
|
||||
win32gui.DrawIconEx(hdcBitmap, 0, 0, hicon, ico_x, ico_y, 0, 0, win32con.DI_NORMAL)
|
||||
win32gui.SelectObject(hdcBitmap, hbmOld)
|
||||
win32gui.DeleteDC(hdcBitmap)
|
||||
|
||||
return hbm
|
||||
|
||||
def command(self, hwnd, msg, wparam, lparam):
|
||||
id = win32gui.LOWORD(wparam)
|
||||
self.execute_menu_option(id)
|
||||
|
||||
def execute_menu_option(self, id):
|
||||
menu_action = self.menu_actions_by_id[id]
|
||||
if menu_action == self.QUIT:
|
||||
self.exit_app()
|
||||
else:
|
||||
menu_action(self)
|
||||
|
||||
def exit_app(self):
|
||||
win32gui.DestroyWindow(self.hwnd)
|
||||
|
||||
|
||||
def main(lbry_name=None):
|
||||
def LBRYApp():
|
||||
return SysTrayIcon(icon, hover_text, menu_options, on_quit=stop)
|
||||
|
||||
def openui_(sender):
|
||||
webbrowser.open(conf.settings.get_ui_address())
|
||||
|
||||
def replyToApplicationShouldTerminate_():
|
||||
try:
|
||||
reactor.stop()
|
||||
except error.ReactorNotRunning:
|
||||
log.debug('Reactor already stopped')
|
||||
|
||||
def stop(sysTrayIcon):
|
||||
replyToApplicationShouldTerminate_()
|
||||
|
||||
if getattr(sys, 'frozen', False) and os.name == "nt":
|
||||
icon = os.path.join(
|
||||
os.path.dirname(sys.executable), conf.settings['ICON_PATH'], 'lbry16.ico'
|
||||
)
|
||||
else:
|
||||
icon = os.path.join(conf.settings['ICON_PATH'], 'lbry16.ico')
|
||||
|
||||
hover_text = conf.settings['APP_NAME']
|
||||
menu_options = (('Open', icon, openui_),)
|
||||
|
||||
if not test_internet_connection():
|
||||
log.warn('No Internet Connection')
|
||||
sys.exit(1)
|
||||
|
||||
systray_thread = threading.Thread(target=LBRYApp)
|
||||
systray_thread.daemon = True
|
||||
systray_thread.start()
|
||||
|
||||
DaemonControl.start_server_and_listen(
|
||||
launchui=True, use_auth=False,
|
||||
analytics_manager=analytics.Manager.new_instance()
|
||||
)
|
||||
reactor.run()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
utils.setup_certs_for_windows()
|
||||
conf.initialize_settings()
|
||||
|
||||
log_file = conf.settings.get_log_filename()
|
||||
log_support.configure_logging(log_file, console=True)
|
||||
|
||||
lbry_daemon = JSONRPCProxy.from_url(conf.settings.get_api_connection_string())
|
||||
|
||||
try:
|
||||
daemon_running = lbry_daemon.is_running()
|
||||
start_daemon = False
|
||||
except:
|
||||
start_daemon = True
|
||||
|
||||
try:
|
||||
lbry_name = LBRYURIHandler.parse_name(sys.argv[1])
|
||||
except IndexError:
|
||||
lbry_name = None
|
||||
start_daemon = True
|
||||
if start_daemon:
|
||||
main(lbry_name)
|
||||
else:
|
||||
LBRYURIHandler.open_address(lbry_name)
|
Before Width: | Height: | Size: 97 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 361 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 31 KiB |
|
@ -1,6 +0,0 @@
|
|||
C:\Python27\Scripts\pip.exe install mock
|
||||
C:\Python27\Scripts\pip.exe install pylint
|
||||
C:\Python27\python.exe C:\Python27\Scripts\trial.py C:\projects\lbry\tests\unit
|
||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||
C:\Python27\Scripts\pylint.exe -E --disable=inherit-non-class --disable=no-member --ignored-modules=distutils --enable=unused-import --enable=bad-whitespace --enable=line-too-long lbrynet packaging/windows/lbry-win32-app/LBRYWin32App.py
|
||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
|
@ -1,90 +0,0 @@
|
|||
import os
|
||||
import webbrowser
|
||||
import subprocess
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
from lbrynet.lbrynet_daemon.auth.client import LBRYAPIClient
|
||||
from lbrynet import conf
|
||||
|
||||
|
||||
class LBRYURIHandler(object):
|
||||
def __init__(self):
|
||||
self.started_daemon = False
|
||||
self.daemon = LBRYAPIClient.get_client()
|
||||
|
||||
def handle_osx(self, lbry_name):
|
||||
self.check_daemon()
|
||||
if not self.started_daemon:
|
||||
os.system("open /Applications/LBRY.app")
|
||||
sleep(3)
|
||||
|
||||
lbry_name = self.parse_name(lbry_name)
|
||||
self.open_address(lbry_name)
|
||||
|
||||
def handle_linux(self, lbry_name):
|
||||
self.check_daemon()
|
||||
if not self.started_daemon:
|
||||
cmd = r'DIR = "$( cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"' \
|
||||
r'if [-z "$(pgrep lbrynet-daemon)"]; then' \
|
||||
r'echo "running lbrynet-daemon"' \
|
||||
r'$DIR / lbrynet - daemon &' \
|
||||
r'sleep 3 # let the daemon load before connecting' \
|
||||
r'fi'
|
||||
subprocess.Popen(cmd, shell=True)
|
||||
|
||||
lbry_name = self.parse_name(lbry_name)
|
||||
self.open_address(lbry_name)
|
||||
|
||||
def handle_win32(self, lbry_name):
|
||||
# Opening LBRY.exe with lbry_name as arg prevents the need to
|
||||
# make a separate call to open_address()
|
||||
self.check_daemon()
|
||||
lbry_name = self.parse_name(lbry_name)
|
||||
if self.started_daemon:
|
||||
self.open_address(lbry_name)
|
||||
else:
|
||||
lbry_path = os.path.join(os.environ["PROGRAMFILES"], "LBRY", "LBRY.exe ")
|
||||
subprocess.call(lbry_path + lbry_name)
|
||||
|
||||
def check_daemon(self):
|
||||
try:
|
||||
status = self.daemon.call('status')
|
||||
self.started_daemon = status['is_running']
|
||||
except:
|
||||
self.started_daemon = False
|
||||
|
||||
@staticmethod
|
||||
def parse_name(lbry_name):
|
||||
if lbry_name[:7].lower() == "lbry://":
|
||||
if lbry_name[-1] == "/":
|
||||
return lbry_name[7:-1]
|
||||
else:
|
||||
return lbry_name[7:]
|
||||
else:
|
||||
if lbry_name[-1] == "/":
|
||||
return lbry_name[:-1]
|
||||
else:
|
||||
return lbry_name[:]
|
||||
|
||||
@staticmethod
|
||||
def open_address(lbry_name):
|
||||
if lbry_name == "lbry" or lbry_name == "" or lbry_name is None:
|
||||
webbrowser.open(conf.settings.get_ui_address())
|
||||
else:
|
||||
webbrowser.open(conf.settings.get_ui_address() + "/?show=" + lbry_name)
|
||||
|
||||
|
||||
def main(args):
|
||||
if len(args) != 1:
|
||||
args = ["lbry://lbry"]
|
||||
name = args[0][7:]
|
||||
if sys.platform == "darwin":
|
||||
LBRYURIHandler().handle_osx(lbry_name=name)
|
||||
elif os.name == "nt":
|
||||
LBRYURIHandler().handle_win32(lbry_name=name)
|
||||
else:
|
||||
LBRYURIHandler().handle_linux(lbry_name=name)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(sys.argv[1:])
|
|
@ -1,54 +0,0 @@
|
|||
import _winreg as winreg
|
||||
import os
|
||||
import sys
|
||||
|
||||
import win32con
|
||||
import win32gui
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
install = 'remove' not in sys.argv[1]
|
||||
except:
|
||||
install = True
|
||||
lbry_path = os.path.join(os.environ["ProgramFiles"], "LBRY", "LBRY.exe")
|
||||
|
||||
key_url = 'lbry'
|
||||
try:
|
||||
key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, key_url, 0, winreg.KEY_ALL_ACCESS)
|
||||
except:
|
||||
key = winreg.CreateKey(winreg.HKEY_CLASSES_ROOT, key_url)
|
||||
if install:
|
||||
winreg.SetValueEx(key, None, 0, winreg.REG_SZ, "URL:LBRY Protocol")
|
||||
winreg.SetValueEx(key, "URL Protocol", 0, winreg.REG_SZ, "")
|
||||
else:
|
||||
winreg.DeleteKey(winreg.HKEY_CLASSES_ROOT, key_url)
|
||||
|
||||
winreg.CloseKey(key)
|
||||
|
||||
key_icon = os.path.join('lbry', 'DefaultIcon')
|
||||
try:
|
||||
key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, key_icon, 0, winreg.KEY_ALL_ACCESS)
|
||||
except:
|
||||
key = winreg.CreateKey(winreg.HKEY_CLASSES_ROOT, key_icon)
|
||||
if install:
|
||||
winreg.SetValueEx(key, None, 0, winreg.REG_SZ, "\"LBRY.exe,1\"")
|
||||
else:
|
||||
winreg.DeleteKey(winreg.HKEY_CLASSES_ROOT, key_icon)
|
||||
winreg.CloseKey(key)
|
||||
|
||||
key_command = os.path.join('lbry', 'shell', 'open', 'command')
|
||||
try:
|
||||
key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, key_command, 0, winreg.KEY_ALL_ACCESS)
|
||||
except:
|
||||
key = winreg.CreateKey(winreg.HKEY_CLASSES_ROOT, key_command)
|
||||
if install:
|
||||
winreg.SetValueEx(key, None, 0, winreg.REG_SZ, "\"{0}\" \"%1\"".format(lbry_path))
|
||||
else:
|
||||
winreg.DeleteKey(winreg.HKEY_CLASSES_ROOT, key_command)
|
||||
winreg.CloseKey(key)
|
||||
|
||||
win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SETTINGCHANGE, 0, 'Environment')
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|