Skip to content

Commit fef812c

Browse files
Internal: Switch python packager to pyinstaller (#917)
1 parent ef1233f commit fef812c

File tree

7 files changed

+37
-25
lines changed

7 files changed

+37
-25
lines changed

electron-builder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ files:
1010
- "package.json"
1111

1212
extraResources:
13-
- from: "python/build/"
13+
- from: "python/dist/main"
1414
to: "python-rpc"
1515
filter:
1616
- "**/*"

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"scripts": {
1515
"ts": "ts-node --project tsconfig.node.json",
1616
"start": "npm run -s electron:prod",
17-
"clean": "rimraf build/* dll/* python/build/*",
17+
"clean": "rimraf build/* dll/* python/dist/* python/build/*",
1818
"test": "npm run -s test-client && npm run -s test-app",
1919
"test-app": "karma start",
2020
"test-app:mem": "cross-env DEBUG_MEM=1 npm run -s test-app",
@@ -26,7 +26,7 @@
2626
"test-client-watch": "npm run -s test-client -- --watch",
2727
"build-client": "tsc -p tsconfig.node.json",
2828
"build-app": "npm run webpack -- --profile --colors --display-error-details --display-cached",
29-
"build-python": "npm run -s ts config/build-python.ts",
29+
"build-python": "pyinstaller python/main.spec -y --distpath=python/dist --workpath=python/build",
3030
"build": "npm run -s clean && npm run -s build-client && npm run -s build-app",
3131
"build:prod": "cross-env NODE_ENV=production npm run -s build",
3232
"watch": "npm run webpack -- --watch --progress --profile --colors --display-error-details --display-cached",

python/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ wheels/
2929
# Usually these files are written by a python script from a template
3030
# before PyInstaller builds the exe, so as to inject date/other infos into it.
3131
*.manifest
32-
*.spec
3332

3433
# Installer logs
3534
pip-log.txt

python/main.spec

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# -*- mode: python -*-
2+
3+
block_cipher = None
4+
5+
6+
a = Analysis(['main.py'],
7+
pathex=['.', '/controllers'],
8+
binaries=[],
9+
datas=[('controllers/*', 'controllers')],
10+
hiddenimports=["controllers", "typing"],
11+
hookspath=[],
12+
runtime_hooks=[],
13+
excludes=[],
14+
win_no_prefer_redirects=False,
15+
win_private_assemblies=False,
16+
cipher=block_cipher)
17+
pyz = PYZ(a.pure, a.zipped_data,
18+
cipher=block_cipher)
19+
exe = EXE(pyz,
20+
a.scripts,
21+
exclude_binaries=True,
22+
name='main',
23+
debug=False,
24+
strip=False,
25+
upx=True,
26+
console=True )
27+
coll = COLLECT(exe,
28+
a.binaries,
29+
a.zipfiles,
30+
a.datas,
31+
strip=False,
32+
upx=True,
33+
name='main')

python/requirements.txt

-83 Bytes
Binary file not shown.

python/server/app.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def foo():
3535
app.add_procedure('foo', foo)
3636
3737
"""
38+
print("Adding new proc", name)
3839
self.procedures[name] = callback
3940

4041
async def call_procedure(self, request):

python/setup.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)