Get electron working on windows
4
.gitignore
vendored
|
@ -3,3 +3,7 @@ app/node_modules
|
|||
node_modules
|
||||
LBRY-darwin-x64
|
||||
dist
|
||||
lbrynet/build
|
||||
lbrynet/venv
|
||||
.#*
|
||||
build_venv
|
25
app/main.js
|
@ -1,6 +1,12 @@
|
|||
const {app, BrowserWindow} = require('electron')
|
||||
const {app, BrowserWindow} = require('electron');
|
||||
var path = require('path');
|
||||
|
||||
var jayson = require('jayson');
|
||||
var client = jayson.client.http('http://localhost:5279/lbryapi');
|
||||
// tree-kill has better cross-platform handling of
|
||||
// killing a process. child-process.kill was unreliable
|
||||
var kill = require('tree-kill');
|
||||
|
||||
let client = jayson.client.http('http://localhost:5279/lbryapi');
|
||||
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
|
@ -35,8 +41,14 @@ function lauchDaemon() {
|
|||
if (subpy) {
|
||||
return;
|
||||
}
|
||||
console.log(`${__dirname}/dist/lbry`);
|
||||
subpy = require('child_process').spawn(`${__dirname}/dist/lbry`, ['--verbose'], {stdio: ['ignore', process.stdout, process.stderr]})
|
||||
console.log(`${__dirname}`);
|
||||
executable = path.join(__dirname, 'dist', 'lbrynet-daemon');
|
||||
subpy = require('child_process').spawn(executable, ['--verbose'])//, {stdio: ['ignore', process.stdout, process.stderr]});
|
||||
// Need to handle the data event instead of attaching to
|
||||
// process.stdout because the latter doesn't work. I believe on
|
||||
// windows it buffers stdout and we don't get any meaningful output
|
||||
subpy.stdout.on('data', (buf) => {console.log(String(buf).trim());});
|
||||
subpy.stderr.on('data', (buf) => {console.log(String(buf).trim());});
|
||||
subpy.on('exit', () => {
|
||||
console.log('The daemon has exited. Quitting the app');
|
||||
subpy = null;
|
||||
|
@ -89,7 +101,10 @@ app.on('before-quit', (event) => {
|
|||
win.loadURL(`file://${__dirname}/dist/quit.html`);
|
||||
}
|
||||
quitting = true;
|
||||
subpy.kill('SIGINT');
|
||||
console.log('Killing lbrynet-daemon process');
|
||||
kill(subpy.pid, undefined, (err) => {
|
||||
console.log('Killed lbrynet-daemon process');
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
"name": "Job Evers-Meltzer"
|
||||
},
|
||||
"dependencies": {
|
||||
"jayson": "^2.0.2"
|
||||
"install": "^0.8.7",
|
||||
"jayson": "^2.0.2",
|
||||
"npm": "^4.2.0",
|
||||
"tree-kill": "^1.1.0"
|
||||
}
|
||||
}
|
||||
|
|
42
appveyor.yml
Normal file
|
@ -0,0 +1,42 @@
|
|||
# Test against the latest version of this Node.js version
|
||||
environment:
|
||||
nodejs_version: "6"
|
||||
|
||||
clone_folder: C:\projects\lbry-electron
|
||||
|
||||
# Install scripts. (runs after repo cloning)
|
||||
install:
|
||||
# needed to deal with submodules
|
||||
- git submodule update --init --recursive
|
||||
- python set-version.py
|
||||
# Get the latest stable version of Node.js or io.js
|
||||
- ps: Install-Product node $env:nodejs_version
|
||||
# install modules
|
||||
- npm install
|
||||
- cd app
|
||||
- npm install
|
||||
- cd ..
|
||||
# create lbrynet-daemon executable
|
||||
- cd lbrynet
|
||||
- ps: .\build.ps1
|
||||
- cd ..
|
||||
# build ui
|
||||
- cd lbry-web-ui
|
||||
- npm install
|
||||
- node_modules\.bin\node-sass --output dist\css --sourcemap=none scss\
|
||||
- node_modules\.bin\webpack
|
||||
- ps: Copy-Item dist ..\app\ -recurse
|
||||
- cd ..
|
||||
- ps: Copy-Item lbrynet\dist\lbrynet-daemon.exe app\dist
|
||||
|
||||
build_script:
|
||||
# build electron app
|
||||
- node_modules\.bin\build -p never
|
||||
# for debugging, see what was built
|
||||
- dir dist
|
||||
|
||||
test: off
|
||||
|
||||
artifacts:
|
||||
- path: dist\*.zip
|
||||
name: LBRY
|
14
build.sh
|
@ -10,8 +10,14 @@ else
|
|||
ICON="$ROOT/build/icons/lbry48.png"
|
||||
fi
|
||||
|
||||
|
||||
FULL_BUILD="${FULL_BUILD:-false}"
|
||||
if [ -n "${TEAMCITY_VERSION:-}" ]; then
|
||||
FULL_BUILD="true"
|
||||
elif [ -n "${APPVEYOR:-}" ]; then
|
||||
FULL_BUILD="true"
|
||||
fi
|
||||
|
||||
if [ "$FULL_BUILD" == "true" ]; then
|
||||
# install dependencies
|
||||
$ROOT/prebuild.sh
|
||||
|
||||
|
@ -56,10 +62,10 @@ popd
|
|||
cp -r dist "$ROOT/app/dist"
|
||||
)
|
||||
|
||||
mv "$ROOT/lbrynet/dist/lbry" "$ROOT/app/dist"
|
||||
mv "$ROOT/lbrynet/dist/lbrynet-daemon" "$ROOT/app/dist"
|
||||
|
||||
|
||||
if [ -n "${TEAMCITY_VERSION:-}" ]; then
|
||||
if [ "$FULL_BUILD" == "true" ]; then
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
security unlock-keychain -p ${KEYCHAIN_PASSWORD} osx-build.keychain
|
||||
fi
|
||||
|
@ -71,7 +77,7 @@ else
|
|||
echo 'Build complete. Run `./node_modules/.bin/electron app` to launch the app'
|
||||
fi
|
||||
|
||||
if [ -n "${TEAMCITY_VERSION:-}" ]; then
|
||||
if [ "$FULL_BUILD" == "true" ]; then
|
||||
# electron-build has a publish feature, but I had a hard time getting
|
||||
# it to reliably work and it also seemed difficult to configure. Not proud of
|
||||
# this, but it seemed better to write my own.
|
||||
|
|
BIN
build/icon.ico
Normal file
After Width: | Height: | Size: 361 KiB |
BIN
build/icons/lbry128.ico
Normal file
After Width: | Height: | Size: 97 KiB |
BIN
build/icons/lbry16.ico
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
build/icons/lbry256.ico
Normal file
After Width: | Height: | Size: 361 KiB |
BIN
build/icons/lbry32.ico
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
build/icons/lbry48.ico
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
build/icons/lbry96.ico
Normal file
After Width: | Height: | Size: 31 KiB |
2
lbry
|
@ -1 +1 @@
|
|||
Subproject commit 07233a885225c76f826f2b6f44e852fc3cbfa9db
|
||||
Subproject commit 9f358e05ff58518bbf11437218f688a0d4b0f168
|
|
@ -1 +1 @@
|
|||
Subproject commit 06f226d57b839c2cbca8dacac4a418dd7bcfe192
|
||||
Subproject commit 9c89652d462fae1765791b9bee1cb23ddc35fcb4
|
24
lbrynet/build.ps1
Normal file
|
@ -0,0 +1,24 @@
|
|||
$env:Path += ";C:\MinGW\bin\"
|
||||
|
||||
$env:Path += ";C:\Program Files (x86)\Windows Kits\10\bin\x86\"
|
||||
gcc --version
|
||||
mingw32-make --version
|
||||
|
||||
mkdir temp
|
||||
Invoke-WebRequest "https://pypi.python.org/packages/55/90/e987e28ed29b571f315afea7d317b6bf4a551e37386b344190cffec60e72/miniupnpc-1.9.tar.gz" -OutFile "temp\miniupnpc-1.9.tar.gz"
|
||||
cd temp
|
||||
tar zxf miniupnpc-1.9.tar.gz
|
||||
cd miniupnpc-1.9
|
||||
mingw32-make.exe -f Makefile.mingw
|
||||
python.exe setupmingw32.py build --compiler=mingw32
|
||||
python.exe setupmingw32.py install
|
||||
|
||||
cd ..\..\
|
||||
Remove-Item -Recurse -Force temp
|
||||
|
||||
pip.exe install -r windows-requirements.txt
|
||||
pip.exe install ..\lbryum
|
||||
pip.exe install ..\lbry
|
||||
pip.exe install pyinstaller
|
||||
|
||||
pyinstaller -y lbry.onefile.spec
|
|
@ -4,34 +4,48 @@ import os
|
|||
|
||||
import lbryum
|
||||
|
||||
|
||||
cwd = os.getcwd()
|
||||
if os.path.basename(cwd) != 'lbrynet':
|
||||
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:
|
||||
icns = os.path.join(repo_base, 'package', 'icons', '256x256.png')
|
||||
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'
|
||||
)
|
||||
|
||||
a = Analysis(
|
||||
['lbry.py'],
|
||||
pathex=[cwd],
|
||||
binaries=None,
|
||||
datas=[
|
||||
|
||||
datas = [
|
||||
(
|
||||
os.path.join(os.path.dirname(lbryum.__file__), 'wordlist', language),
|
||||
'lbryum/wordlist'
|
||||
)
|
||||
for language in languages
|
||||
],
|
||||
]
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['lbry.py'],
|
||||
pathex=[cwd],
|
||||
binaries=None,
|
||||
datas=datas,
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
runtime_hooks=[],
|
||||
|
@ -41,28 +55,23 @@ a = Analysis(
|
|||
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='lbry',
|
||||
name='lbrynet-daemon',
|
||||
debug=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
console=False,
|
||||
console=True,
|
||||
icon=icns
|
||||
)
|
||||
|
||||
app = BUNDLE(
|
||||
exe,
|
||||
name='lbry.app',
|
||||
icon=icns,
|
||||
bundle_identifier=None
|
||||
)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from lbrynet.lbrynet_daemon import DaemonControl
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
DaemonControl.start()
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
# -*- mode: python -*-
|
||||
import lbryum
|
||||
|
||||
block_cipher = None
|
||||
languages = (
|
||||
'chinese_simplified.txt', 'japanese.txt', 'spanish.txt',
|
||||
'english.txt', 'portuguese.txt'
|
||||
)
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['lbry.py'],
|
||||
pathex=['/Users/jobevers/projects/lbryio/lbry-electron/lbrynet'],
|
||||
binaries=None,
|
||||
# Not sure why these files are not already include as they are
|
||||
# listed in package_data and the MANIFEST.in, but they don't seem
|
||||
# to make it in unless we explicitly add them here
|
||||
datas=[
|
||||
(
|
||||
os.path.join(os.path.dirname(lbryum.__file__), 'wordlist', language),
|
||||
'lbryum/wordlist'
|
||||
)
|
||||
for language in languages
|
||||
],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
runtime_hooks=[],
|
||||
excludes=['win32com'],
|
||||
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,
|
||||
exclude_binaries=True,
|
||||
name='lbry',
|
||||
debug=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
console=True,
|
||||
)
|
||||
coll = COLLECT(
|
||||
exe,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
strip=False,
|
||||
upx=True,
|
||||
name='lbry'
|
||||
)
|
||||
app = BUNDLE(
|
||||
coll,
|
||||
name='lbry.app',
|
||||
icon=None,
|
||||
bundle_identifier=None
|
||||
)
|
30
lbrynet/windows-requirements.txt
Normal file
|
@ -0,0 +1,30 @@
|
|||
pypiwin32==219
|
||||
six==1.10.0
|
||||
requests[security]==2.13.0
|
||||
zope.interface==4.3.3
|
||||
Twisted==16.6.0
|
||||
appdirs==1.4.0
|
||||
argparse==1.2.1
|
||||
colorama==0.3.7
|
||||
dnspython==1.12.0
|
||||
ecdsa==0.13
|
||||
envparse==0.2.0
|
||||
jsonrpc==1.2
|
||||
jsonrpclib==0.1.7
|
||||
loggly-python-handler==1.0.0
|
||||
pbkdf2==1.3
|
||||
protobuf==3.0.0
|
||||
pycrypto==2.6.1
|
||||
python-bitcoinrpc==0.1
|
||||
pyyaml==3.12
|
||||
qrcode==5.2.2
|
||||
requests_futures==0.9.7
|
||||
seccure==0.3.1.3
|
||||
simplejson==3.8.2
|
||||
slowaes==0.1a1
|
||||
txJSON-RPC==0.5
|
||||
wsgiref==0.1.2
|
||||
base58==0.2.2
|
||||
googlefinance==0.7
|
||||
jsonschema==2.5.1
|
||||
https://github.com/lbryio/lbry/raw/master/packaging/windows/libs/gmpy-1.17-cp27-none-win32.whl
|
2
lbryum
|
@ -1 +1 @@
|
|||
Subproject commit bd370d353069ef02566c9082fe876e4924861e68
|
||||
Subproject commit b3c6815d43222ae739aa1d2c1c670aa09d83bb2d
|
|
@ -34,6 +34,9 @@
|
|||
},
|
||||
"linux": {
|
||||
"target": "deb"
|
||||
},
|
||||
"win": {
|
||||
"target": "zip"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|