Skip to content

Commit

Permalink
add bootstrapper to exes; add debugpy and pyqode server to included src
Browse files Browse the repository at this point in the history
  • Loading branch information
ronpandolfi committed May 9, 2023
1 parent b9d5515 commit 04f9cc3
Showing 1 changed file with 81 additions and 20 deletions.
101 changes: 81 additions & 20 deletions tsuchinoko.spec
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import dask
import distributed
import event_model
import torch
import debugpy
import pyqode.python.backend

from tsuchinoko import assets, examples
import tsuchinoko
Expand All @@ -31,12 +33,23 @@ datas_src.extend(jsons)
datas_dst.extend('event_model/schemas' for path in jsons)

# examples data image
datas_src.append(os.path.join(examples.__path__[0], 'sombrero_pug.jpg'))
datas_dst.append('tsuchinoko/examples')
datas_src.append(os.path.join(examples.__path__[0], 'peak1.png'))
datas_dst.append('tsuchinoko/examples')
datas_src.append(os.path.join(examples.__path__[0], 'peak2.png'))
datas_dst.append('tsuchinoko/examples')
images = glob.glob(os.path.join(examples.__path__[0], '*.jpg'))
images += glob.glob(os.path.join(examples.__path__[0], '*.png'))
datas_src.extend(images)
datas_dst.extend('tsuchinoko/examples' for path in images)

# include example scripts
examples = glob.glob(os.path.join(examples.__path__[0], '*.py'))
datas_src.extend(examples)
datas_dst.extend('tsuchinoko/examples' for path in examples)

# include debugpy
datas_src.append(debugpy.__path__[0])
datas_dst.append("debugpy")

# pyqode server pyqode\\python\\backend\\server.py
datas_src.append(os.path.join(pyqode.python.backend.__path__[0], '*.py'))
datas_dst.append("pyqode/python/backend/")

# functorch (mac only)
if sys.platform == 'darwin':
Expand Down Expand Up @@ -76,15 +89,39 @@ a2 = Analysis(
pathex=[],
binaries=[],
datas=zip(datas_src, datas_dst),
hiddenimports=['tsuchinoko.graphs.common',
'tsuchinoko.examples.adaptive_demo',
'tsuchinoko.examples.grid_demo',
'tsuchinoko.examples.high_dimensionality_server_demo',
'tsuchinoko.examples.multi_task_server_demo',
'tsuchinoko.examples.quadtree_demo',
'tsuchinoko.examples.server_demo',
'tsuchinoko.examples.server_demo_bluesky',
'tsuchinoko.examples.vector_metric_demo',],
# hiddenimports=['tsuchinoko.graphs.common',
# 'tsuchinoko.examples.adaptive_demo',
# 'tsuchinoko.examples.grid_demo',
# 'tsuchinoko.examples.high_dimensionality_server_demo',
# 'tsuchinoko.examples.multi_task_server_demo',
# 'tsuchinoko.examples.quadtree_demo',
# 'tsuchinoko.examples.server_demo',
# 'tsuchinoko.examples.server_demo_bluesky',
# 'tsuchinoko.examples.vector_metric_demo',],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)

a3 = Analysis(
[os.path.join('tsuchinoko','_bootstrap.py')],
pathex=[],
binaries=[],
datas=zip(datas_src, datas_dst),
# hiddenimports=['tsuchinoko.graphs.common',
# 'tsuchinoko.examples.adaptive_demo',
# 'tsuchinoko.examples.grid_demo',
# 'tsuchinoko.examples.high_dimensionality_server_demo',
# 'tsuchinoko.examples.multi_task_server_demo',
# 'tsuchinoko.examples.quadtree_demo',
# 'tsuchinoko.examples.server_demo',
# 'tsuchinoko.examples.server_demo_bluesky',
# 'tsuchinoko.examples.vector_metric_demo',],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
Expand All @@ -99,6 +136,8 @@ pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

pyz2 = PYZ(a2.pure, a2.zipped_data, cipher=block_cipher)

pyz3 = PYZ(a3.pure, a3.zipped_data, cipher=block_cipher)

exe = EXE(
pyz,
a.scripts,
Expand Down Expand Up @@ -137,21 +176,43 @@ exe2 = EXE(
icon=assets.path('tsuchinoko.png')
)

exe3 = EXE(
pyz3,
a3.scripts,
[],
exclude_binaries=True,
name='tsuchinoko_bootstrap',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=assets.path('tsuchinoko.png')
)

print(f'platform: {sys.platform}')
if sys.platform == 'win32':
coll = COLLECT(
exe, exe2,
a.binaries, a2.binaries,
a.zipfiles, a2.zipfiles,
a.datas, a2.datas,
exe, exe2, exe3,
a.binaries, a2.binaries, a3.binaries,
a.zipfiles, a2.zipfiles, a3.zipfiles,
a.datas, a2.datas, a3.datas,
strip=False,
upx=True,
upx_exclude=[],
name='Tsuchinoko',
)
elif sys.platform == 'darwin':
app = BUNDLE(
exe, exe2, a.binaries, a2.binaries, a.zipfiles, a2.zipfiles, a.datas, a2.datas,
exe, exe2, exe3,
a.binaries, a2.binaries, a3.binaries,
a.zipfiles, a2.zipfiles, a3.zipfiles,
a.datas, a2.datas, a3.datas,
name='Tsuchinoko',
icon=assets.path('tsuchinoko.png'),
bundle_identifier=None,
Expand Down

0 comments on commit 04f9cc3

Please sign in to comment.