attempt to build cli alongside daemon

This commit is contained in:
Alex Grintsvayg 2017-03-15 19:58:36 -04:00
parent ad05a8096a
commit c4e363fbe3
12 changed files with 96 additions and 10 deletions

4
.gitignore vendored
View file

@ -6,8 +6,8 @@ dist
/app/node_modules /app/node_modules
/build/venv /build/venv
/lbry-app-venv /lbry-app-venv
/lbrynet-daemon/build /daemon/build
/lbrynet-daemon/venv /daemon/venv
/.idea /.idea
*.pyc *.pyc

View file

@ -21,8 +21,8 @@ install:
- cd app - cd app
- npm install - npm install
- cd .. - cd ..
# create lbrynet-daemon executable # create daemon and cli executable
- cd lbrynet-daemon - cd daemon
- ps: .\build.ps1 - ps: .\build.ps1
- cd .. - cd ..
# build ui # build ui
@ -32,7 +32,9 @@ install:
- node_modules\.bin\webpack - node_modules\.bin\webpack
- ps: Copy-Item dist ..\app\ -recurse - ps: Copy-Item dist ..\app\ -recurse
- cd .. - cd ..
- ps: Copy-Item lbrynet-daemon\dist\lbrynet-daemon.exe app\dist # copy executables into ui
- ps: Copy-Item daemon\dist\lbrynet-daemon.exe app\dist
- ps: Copy-Item daemon\dist\lbrynet-cli.exe app\dist
build_script: build_script:
# build electron app # build electron app

View file

@ -63,9 +63,10 @@ npm install
#################### ####################
( (
cd "$ROOT/lbrynet-daemon" cd "$ROOT/daemon"
pip install -r linux_macos.txt pip install -r linux_macos.txt
pyinstaller -y lbry.onefile.spec pyinstaller -y daemon.onefile.spec
pyinstaller -y cli.onefile.spec
mv dist/lbrynet-daemon "$ROOT/app/dist/" mv dist/lbrynet-daemon "$ROOT/app/dist/"
) )
python "$BUILD_DIR/zip_daemon.py" python "$BUILD_DIR/zip_daemon.py"

View file

@ -19,4 +19,5 @@ Remove-Item -Recurse -Force temp
pip.exe install pyinstaller pip.exe install pyinstaller
pip.exe install -r windows.txt pip.exe install -r windows.txt
pyinstaller -y lbry.onefile.spec pyinstaller -y daemon.onefile.spec
pyinstaller -y cli.onefile.spec

77
daemon/cli.onefile.spec Normal file
View file

@ -0,0 +1,77 @@
# -*- mode: python -*-
import platform
import os
import lbryum
cwd = os.getcwd()
if os.path.basename(cwd) != 'daemon':
raise Exception('The build needs to be run from the same directory as the spec file')
repo_base = os.path.abspath(os.path.join(cwd, '..'))
system = platform.system()
if system == 'Darwin':
icns = os.path.join(repo_base, 'build', 'icon.icns')
elif system == 'Linux':
icns = os.path.join(repo_base, 'build', 'icons', '256x256.png')
elif system == 'Windows':
icns = os.path.join(repo_base, 'build', 'icons', 'lbry256.ico')
else:
print 'Warning: System {} has no icons'.format(system)
icns = None
block_cipher = None
languages = (
'chinese_simplified.txt', 'japanese.txt', 'spanish.txt',
'english.txt', 'portuguese.txt'
)
datas = [
(
os.path.join(os.path.dirname(lbryum.__file__), 'wordlist', language),
'lbryum/wordlist'
)
for language in languages
]
a = Analysis(
['cli.py'],
pathex=[cwd],
binaries=None,
datas=datas,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher
)
pyz = PYZ(
a.pure, a.zipped_data,
cipher=block_cipher
)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='lbrynet-cli',
debug=False,
strip=False,
upx=True,
console=True,
icon=icns
)

5
daemon/cli.py Normal file
View file

@ -0,0 +1,5 @@
from lbrynet.lbrynet_daemon import DaemonCLI
if __name__ == '__main__':
DaemonCLI.main()

View file

@ -6,7 +6,7 @@ import lbryum
cwd = os.getcwd() cwd = os.getcwd()
if os.path.basename(cwd) != 'lbrynet-daemon': if os.path.basename(cwd) != 'daemon':
raise Exception('The build needs to be run from the same directory as the spec file') raise Exception('The build needs to be run from the same directory as the spec file')
repo_base = os.path.abspath(os.path.join(cwd, '..')) repo_base = os.path.abspath(os.path.join(cwd, '..'))
@ -42,7 +42,7 @@ datas = [
a = Analysis( a = Analysis(
['lbry.py'], ['daemon.py'],
pathex=[cwd], pathex=[cwd],
binaries=None, binaries=None,
datas=datas, datas=datas,