2015-08-20 17:27:15 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2016-02-27 23:49:49 +01:00
|
|
|
import sys
|
2016-03-14 17:30:22 +01:00
|
|
|
import os
|
2016-09-01 02:20:07 +02:00
|
|
|
from lbrynet import __version__
|
|
|
|
|
|
|
|
LINUX = 1
|
|
|
|
DARWIN = 2
|
|
|
|
WINDOWS = 3
|
|
|
|
|
|
|
|
if sys.platform.startswith("linux"):
|
|
|
|
platform = LINUX
|
|
|
|
elif sys.platform.startswith("darwin"):
|
|
|
|
platform = DARWIN
|
|
|
|
elif sys.platform.startswith("win"):
|
|
|
|
platform = WINDOWS
|
|
|
|
else:
|
|
|
|
raise Exception("Unknown os: %s" % sys.platform)
|
2016-03-14 17:30:22 +01:00
|
|
|
|
2016-03-22 02:33:55 +01:00
|
|
|
base_dir = os.path.abspath(os.path.dirname(__file__))
|
2016-09-01 02:20:07 +02:00
|
|
|
package_name = "lbrynet"
|
|
|
|
dist_name = "LBRY"
|
|
|
|
description = "A decentralized media library and marketplace"
|
|
|
|
author = "LBRY, Inc"
|
|
|
|
url = "lbry.io"
|
|
|
|
maintainer = "Jack Robison"
|
|
|
|
maintainer_email = "jack@lbry.io"
|
|
|
|
keywords = "LBRY"
|
2016-03-22 02:33:55 +01:00
|
|
|
|
2016-09-01 02:20:07 +02:00
|
|
|
requires = [
|
|
|
|
'pycrypto',
|
|
|
|
'twisted',
|
|
|
|
'miniupnpc',
|
|
|
|
'yapsy',
|
|
|
|
'seccure',
|
|
|
|
'python-bitcoinrpc==0.1',
|
|
|
|
'txJSON-RPC',
|
|
|
|
'requests>=2.4.2',
|
|
|
|
'unqlite==0.2.0',
|
|
|
|
'lbryum',
|
|
|
|
'jsonrpc',
|
|
|
|
'simplejson',
|
2016-10-14 13:58:25 +02:00
|
|
|
'jsonschema',
|
2016-09-01 02:20:07 +02:00
|
|
|
'appdirs',
|
|
|
|
'six==1.9.0',
|
|
|
|
'base58',
|
|
|
|
'googlefinance',
|
2016-09-16 06:14:25 +02:00
|
|
|
'requests_futures',
|
|
|
|
'PyYAML'
|
2016-09-01 02:20:07 +02:00
|
|
|
]
|
2016-02-27 23:49:49 +01:00
|
|
|
|
2016-09-01 02:20:07 +02:00
|
|
|
console_scripts = [
|
|
|
|
# 'lbrynet-stdin-uploader = lbrynet.lbrynet_console.LBRYStdinUploader:launch_stdin_uploader',
|
|
|
|
# 'lbrynet-stdout-downloader = lbrynet.lbrynet_console.LBRYStdoutDownloader:launch_stdout_downloader',
|
|
|
|
# 'lbrynet-create-network = lbrynet.create_network:main',
|
|
|
|
# 'lbrynet-launch-node = lbrynet.dht.node:main',
|
|
|
|
# 'lbrynet-launch-rpc-node = lbrynet.rpc_node:main',
|
|
|
|
# 'lbrynet-rpc-node-cli = lbrynet.node_rpc_cli:main',
|
|
|
|
# 'lbrynet-lookup-hosts-for-hash = lbrynet.dht_scripts:get_hosts_for_hash_in_dht',
|
|
|
|
# 'lbrynet-announce_hash_to_dht = lbrynet.dht_scripts:announce_hash_to_dht',
|
2016-09-26 03:32:56 +02:00
|
|
|
'lbrynet-daemon = lbrynet.lbrynet_daemon.DaemonControl:start',
|
|
|
|
'stop-lbrynet-daemon = lbrynet.lbrynet_daemon.DaemonControl:stop',
|
|
|
|
'lbrynet-cli = lbrynet.lbrynet_daemon.DaemonCLI:main'
|
2016-09-01 02:20:07 +02:00
|
|
|
]
|
2016-02-27 23:49:49 +01:00
|
|
|
|
2016-09-01 02:20:07 +02:00
|
|
|
if platform == LINUX:
|
|
|
|
import ez_setup
|
|
|
|
ez_setup.use_setuptools()
|
|
|
|
from setuptools import setup, find_packages
|
2016-08-27 01:59:17 +02:00
|
|
|
|
|
|
|
requires.append('service-identity')
|
2016-02-27 23:49:49 +01:00
|
|
|
|
2016-09-01 02:20:07 +02:00
|
|
|
setup(name=package_name,
|
|
|
|
description=description,
|
|
|
|
version=__version__,
|
|
|
|
maintainer=maintainer,
|
|
|
|
maintainer_email=maintainer_email,
|
|
|
|
url=url,
|
|
|
|
author=author,
|
|
|
|
keywords=keywords,
|
|
|
|
packages=find_packages(base_dir),
|
|
|
|
install_requires=requires,
|
|
|
|
entry_points={'console_scripts': console_scripts},
|
|
|
|
data_files=[
|
|
|
|
('lbrynet/lbrynet_console/plugins',
|
|
|
|
[
|
|
|
|
os.path.join(base_dir, 'lbrynet', 'lbrynet_console', 'plugins',
|
|
|
|
'blindrepeater.yapsy-plugin')
|
|
|
|
]
|
|
|
|
),
|
|
|
|
],
|
|
|
|
dependency_links=['https://github.com/lbryio/lbryum/tarball/master/#egg=lbryum'],
|
|
|
|
)
|
|
|
|
|
|
|
|
elif platform == DARWIN:
|
|
|
|
import ez_setup
|
|
|
|
|
|
|
|
ez_setup.use_setuptools()
|
|
|
|
from setuptools import setup, find_packages
|
|
|
|
|
|
|
|
setup(name=package_name,
|
|
|
|
description=description,
|
|
|
|
version=__version__,
|
|
|
|
maintainer=maintainer,
|
|
|
|
maintainer_email=maintainer_email,
|
|
|
|
url=url,
|
|
|
|
author=author,
|
|
|
|
keywords=keywords,
|
|
|
|
packages=find_packages(base_dir),
|
|
|
|
install_requires=requires,
|
|
|
|
entry_points={'console_scripts': console_scripts},
|
|
|
|
data_files=[
|
|
|
|
('lbrynet/lbrynet_console/plugins',
|
|
|
|
[
|
|
|
|
os.path.join(base_dir, 'lbrynet', 'lbrynet_console', 'plugins',
|
|
|
|
'blindrepeater.yapsy-plugin')
|
|
|
|
]
|
|
|
|
),
|
|
|
|
],
|
|
|
|
dependency_links=['https://github.com/lbryio/lbryum/tarball/master/#egg=lbryum'],
|
|
|
|
)
|
|
|
|
|
|
|
|
elif platform == WINDOWS:
|
|
|
|
import opcode
|
|
|
|
import pkg_resources
|
|
|
|
from cx_Freeze import setup, Executable
|
|
|
|
import requests.certs
|
|
|
|
|
2016-09-03 20:39:39 +02:00
|
|
|
app_dir = os.path.join('packaging', 'windows', 'lbry-win32-app')
|
|
|
|
daemon_dir = os.path.join('lbrynet', 'lbrynet_daemon')
|
|
|
|
win_icon = os.path.join(app_dir, 'icons', 'lbry256.ico')
|
2016-09-01 02:20:07 +02:00
|
|
|
wordlist_path = pkg_resources.resource_filename('lbryum', 'wordlist')
|
|
|
|
|
|
|
|
# Allow virtualenv to find distutils of base python installation
|
|
|
|
distutils_path = os.path.join(os.path.dirname(opcode.__file__), 'distutils')
|
|
|
|
|
|
|
|
def find_data_file(filename):
|
|
|
|
if getattr(sys, 'frozen', False):
|
|
|
|
# The application is frozen
|
|
|
|
data_dir = os.path.dirname(sys.executable)
|
|
|
|
else:
|
|
|
|
# The application is not frozen
|
|
|
|
# Change this bit to match where you store your data files:
|
|
|
|
data_dir = os.path.dirname(__file__)
|
|
|
|
return os.path.join(data_dir, filename)
|
|
|
|
|
|
|
|
shortcut_table = [
|
2016-09-03 20:39:39 +02:00
|
|
|
('LBRYShortcut', # Shortcut
|
|
|
|
'DesktopFolder', # Directory
|
|
|
|
'LBRY', # Name
|
|
|
|
'TARGETDIR', # Component
|
|
|
|
'[TARGETDIR]\{0}.exe'.format(dist_name), # Target
|
|
|
|
None, # Arguments
|
|
|
|
description, # Description
|
|
|
|
None, # Hotkey
|
|
|
|
None, # Icon
|
|
|
|
None, # IconIndex
|
|
|
|
None, # ShowCmd
|
|
|
|
'TARGETDIR', # WkDir
|
|
|
|
),
|
2016-09-16 09:42:25 +02:00
|
|
|
# ('DaemonShortcut', # Shortcut
|
|
|
|
# 'DesktopFolder', # Directory
|
|
|
|
# 'lbrynet-daemon', # Name
|
|
|
|
# 'TARGETDIR', # Component
|
|
|
|
# '[TARGETDIR]\lbrynet-daemon.exe', # Target
|
|
|
|
# '--log-to-console', # Arguments
|
|
|
|
# description, # Description
|
|
|
|
# None, # Hotkey
|
|
|
|
# None, # Icon
|
|
|
|
# None, # IconIndex
|
|
|
|
# None, # ShowCmd
|
|
|
|
# 'TARGETDIR', # WkDir
|
|
|
|
# ),
|
|
|
|
# ('DaemonCLIShortcut', # Shortcut
|
|
|
|
# 'DesktopFolder', # Directory
|
|
|
|
# 'lbrynet-cli', # Name
|
|
|
|
# 'TARGETDIR', # Component
|
|
|
|
# '[TARGETDIR]\lbrynet-cli.exe', # Target
|
|
|
|
# None, # Arguments
|
|
|
|
# description, # Description
|
|
|
|
# None, # Hotkey
|
|
|
|
# None, # Icon
|
|
|
|
# None, # IconIndex
|
|
|
|
# None, # ShowCmd
|
|
|
|
# 'TARGETDIR', # WkDir
|
|
|
|
# ),
|
2016-09-03 20:39:39 +02:00
|
|
|
('ProgramMenuLBRYShortcut', # Shortcut
|
|
|
|
'ProgramMenuFolder', # Directory
|
|
|
|
# r'[ProgramMenuFolder]\lbrynet', # Directory
|
2016-09-01 02:20:07 +02:00
|
|
|
'LBRY', # Name
|
|
|
|
'TARGETDIR', # Component
|
|
|
|
'[TARGETDIR]\{0}.exe'.format(dist_name), # Target
|
|
|
|
None, # Arguments
|
|
|
|
description, # Description
|
|
|
|
None, # Hotkey
|
2016-09-03 20:39:39 +02:00
|
|
|
None, # Icon
|
2016-09-01 02:20:07 +02:00
|
|
|
None, # IconIndex
|
|
|
|
None, # ShowCmd
|
|
|
|
'TARGETDIR', # WkDir
|
|
|
|
),
|
2016-09-03 20:39:39 +02:00
|
|
|
('ProgramMenuDaemonShortcut', # Shortcut
|
|
|
|
'ProgramMenuFolder', # Directory
|
|
|
|
# r'[ProgramMenuFolder]\lbrynet', # Directory
|
|
|
|
'lbrynet-daemon', # Name
|
|
|
|
'TARGETDIR', # Component
|
|
|
|
'[TARGETDIR]\lbrynet-daemon.exe', # Target
|
|
|
|
'--log-to-console', # Arguments
|
|
|
|
description, # Description
|
|
|
|
None, # Hotkey
|
|
|
|
None, # Icon
|
|
|
|
None, # IconIndex
|
|
|
|
None, # ShowCmd
|
|
|
|
'TARGETDIR', # WkDir
|
|
|
|
),
|
|
|
|
('ProgramMenuDaemonCLIShortcut', # Shortcut
|
|
|
|
'ProgramMenuFolder', # Directory
|
|
|
|
# r'[ProgramMenuFolder]\lbrynet', # Directory
|
2016-09-01 02:20:07 +02:00
|
|
|
'lbrynet-cli', # Name
|
|
|
|
'TARGETDIR', # Component
|
|
|
|
'[TARGETDIR]\lbrynet-cli.exe', # Target
|
|
|
|
None, # Arguments
|
|
|
|
description, # Description
|
|
|
|
None, # Hotkey
|
2016-09-03 20:39:39 +02:00
|
|
|
None, # Icon
|
2016-09-01 02:20:07 +02:00
|
|
|
None, # IconIndex
|
|
|
|
None, # ShowCmd
|
|
|
|
'TARGETDIR', # WkDir
|
|
|
|
),
|
|
|
|
]
|
|
|
|
|
|
|
|
msi_data = {"Shortcut": shortcut_table}
|
|
|
|
|
|
|
|
bdist_msi_options = {
|
|
|
|
'upgrade_code': '{18c0e933-ad08-44e8-a413-1d0ed624c100}',
|
|
|
|
'add_to_path': True,
|
|
|
|
# Default install path is 'C:\Program Files\' for 32-bit or 'C:\Program Files (x86)\' for 64-bit
|
|
|
|
# 'initial_target_dir': r'[LocalAppDataFolder]\{0}'.format(name),
|
|
|
|
'data': msi_data
|
|
|
|
}
|
|
|
|
|
|
|
|
build_exe_options = {
|
|
|
|
'include_msvcr': True,
|
|
|
|
'includes': [],
|
|
|
|
'packages': ['cython',
|
|
|
|
'twisted',
|
|
|
|
'yapsy',
|
|
|
|
'appdirs',
|
|
|
|
'argparse',
|
|
|
|
'base58',
|
|
|
|
'colorama',
|
|
|
|
'cx_Freeze',
|
|
|
|
'dns',
|
|
|
|
'ecdsa',
|
|
|
|
'gmpy',
|
|
|
|
'googlefinance',
|
|
|
|
'jsonrpc',
|
|
|
|
'jsonrpclib',
|
|
|
|
'lbryum',
|
|
|
|
'loggly',
|
|
|
|
'miniupnpc',
|
|
|
|
'pbkdf2',
|
|
|
|
'google.protobuf',
|
|
|
|
'Crypto',
|
|
|
|
'bitcoinrpc',
|
|
|
|
'win32api',
|
|
|
|
'qrcode',
|
|
|
|
'requests',
|
|
|
|
'requests_futures',
|
|
|
|
'seccure',
|
|
|
|
'simplejson',
|
|
|
|
'six',
|
|
|
|
'aes',
|
|
|
|
'txjsonrpc',
|
|
|
|
'unqlite',
|
|
|
|
'wsgiref',
|
|
|
|
'zope.interface',
|
|
|
|
'os',
|
2016-09-16 06:14:25 +02:00
|
|
|
'pkg_resources',
|
2016-09-16 07:14:56 +02:00
|
|
|
'yaml'
|
2016-09-01 02:20:07 +02:00
|
|
|
],
|
|
|
|
'excludes': ['distutils', 'collections.sys', 'collections._weakref', 'collections.abc',
|
|
|
|
'Tkinter', 'tk', 'tcl', 'PyQt4', 'nose', 'mock'
|
|
|
|
'zope.interface._zope_interface_coptimizations', 'leveldb'],
|
|
|
|
'include_files': [(distutils_path, 'distutils'), (requests.certs.where(), 'cacert.pem'),
|
2016-09-03 20:39:39 +02:00
|
|
|
(os.path.join(app_dir, 'icons', 'lbry16.ico'), os.path.join('icons', 'lbry16.ico')),
|
|
|
|
(os.path.join(app_dir, 'icons', 'lbry256.ico'), os.path.join('icons', 'lbry256.ico')),
|
2016-09-01 02:20:07 +02:00
|
|
|
(os.path.join(wordlist_path, 'chinese_simplified.txt'),
|
|
|
|
os.path.join('wordlist', 'chinese_simplified.txt')),
|
|
|
|
(os.path.join(wordlist_path, 'english.txt'), os.path.join('wordlist', 'english.txt')),
|
|
|
|
(os.path.join(wordlist_path, 'japanese.txt'), os.path.join('wordlist', 'japanese.txt')),
|
|
|
|
(os.path.join(wordlist_path, 'portuguese.txt'), os.path.join('wordlist', 'portuguese.txt')),
|
|
|
|
(os.path.join(wordlist_path, 'spanish.txt'), os.path.join('wordlist', 'spanish.txt'))
|
|
|
|
],
|
|
|
|
'namespace_packages': ['zope', 'google']}
|
|
|
|
|
|
|
|
tray_app = Executable(
|
2016-09-03 20:39:39 +02:00
|
|
|
script=os.path.join(app_dir, 'LBRYWin32App.py'),
|
2016-09-01 02:20:07 +02:00
|
|
|
base='Win32GUI',
|
|
|
|
icon=win_icon,
|
|
|
|
compress=True,
|
2016-09-03 20:39:39 +02:00
|
|
|
# shortcutName=dist_name,
|
|
|
|
# shortcutDir='DesktopFolder',
|
2016-09-01 02:20:07 +02:00
|
|
|
targetName='{0}.exe'.format(dist_name)
|
|
|
|
)
|
|
|
|
|
|
|
|
daemon_exe = Executable(
|
2016-09-26 03:32:56 +02:00
|
|
|
script=os.path.join(daemon_dir, 'DaemonControl.py'),
|
2016-09-01 02:20:07 +02:00
|
|
|
icon=win_icon,
|
2016-09-03 20:39:39 +02:00
|
|
|
# shortcutName="lbrynet-daemon",
|
|
|
|
# shortcutDir='DesktopFolder',
|
2016-09-01 02:20:07 +02:00
|
|
|
targetName='lbrynet-daemon.exe'
|
|
|
|
)
|
|
|
|
|
|
|
|
cli_exe = Executable(
|
2016-09-26 03:32:56 +02:00
|
|
|
script=os.path.join(daemon_dir, 'DaemonCLI.py'),
|
2016-09-01 02:20:07 +02:00
|
|
|
icon=win_icon,
|
2016-09-03 20:39:39 +02:00
|
|
|
# shortcutName="lbrynet-cli",
|
|
|
|
# shortcutDir='DesktopFolder',
|
2016-09-01 02:20:07 +02:00
|
|
|
targetName='lbrynet-cli.exe'
|
|
|
|
)
|
|
|
|
|
|
|
|
setup(
|
|
|
|
name=package_name,
|
|
|
|
description=description,
|
|
|
|
version=__version__,
|
|
|
|
maintainer=maintainer,
|
|
|
|
maintainer_email=maintainer_email,
|
|
|
|
url=url,
|
|
|
|
author=author,
|
|
|
|
keywords=keywords,
|
|
|
|
data_files=[],
|
|
|
|
options={'build_exe': build_exe_options,
|
|
|
|
'bdist_msi': bdist_msi_options},
|
|
|
|
executables=[
|
|
|
|
tray_app,
|
|
|
|
daemon_exe,
|
|
|
|
cli_exe
|
|
|
|
],
|
|
|
|
)
|