-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnetsim.spec
More file actions
47 lines (43 loc) · 1.47 KB
/
Copy pathnetsim.spec
File metadata and controls
47 lines (43 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# PyInstaller spec — single-file `netsim` binary (Linux) / netsim.exe (Windows).
#
# pip install pyinstaller
# pyinstaller netsim.spec # -> dist/netsim (or dist/netsim.exe)
#
# The examples/ dir is bundled as data so `netsim run mN` works inside the
# frozen binary. matplotlib is NOT collected by default (keeps a local build
# small + the stdlib demos work everywhere); build with NETSIM_WITH_PLOTS=1
# to fold matplotlib/pillow in for the viz/plots/gif demos. The CI release
# binaries ARE built with NETSIM_WITH_PLOTS=1, so the published downloads have
# the plotting demos working out of the box (at the cost of a larger file).
import os
from PyInstaller.utils.hooks import collect_all
block_cipher = None
datas = [("examples", "examples")]
binaries = []
hiddenimports = []
if os.environ.get("NETSIM_WITH_PLOTS"):
for mod in ("matplotlib", "PIL"):
d, b, h = collect_all(mod)
datas += d; binaries += b; hiddenimports += h
a = Analysis(
["netsim/__main__.py"],
pathex=["."],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
runtime_hooks=[],
excludes=[] if os.environ.get("NETSIM_WITH_PLOTS") else
["matplotlib", "PIL", "numpy", "tkinter"],
cipher=block_cipher,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz, a.scripts, a.binaries, a.datas, [],
name="netsim",
debug=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True,
)