-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstaller.spec
More file actions
110 lines (103 loc) · 2.8 KB
/
Copy pathinstaller.spec
File metadata and controls
110 lines (103 loc) · 2.8 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# -*- mode: python ; coding: utf-8 -*-
# created using: venv/bin/pyi-makespec
import os
import re
from PyInstaller.utils.hooks import collect_all
# Read __version__ from src/__version__.py without importing the package
_version_ns = {}
with open(os.path.join('src', '__version__.py'), 'r', encoding='utf-8') as _f:
exec(_f.read(), _version_ns)
__version__ = _version_ns['__version__']
# Validate semver and extract the numeric prefix for Windows file-version fields
_m = re.match(r'^(\d+)\.(\d+)\.(\d+)(?:-[0-9A-Za-z.-]+)?$', __version__)
if not _m:
raise SystemExit(
f"src/__version__.py: __version__ {__version__!r} is not valid semver "
f"(expected MAJOR.MINOR.PATCH[-PRERELEASE])"
)
_ver_tuple = tuple(int(x) for x in _m.groups()) + (0,)
# Windows version-info resource. EXE(version=...) ignores this on non-Windows builds,
# so the same spec is used on both platforms unchanged.
_version_info_path = os.path.join('build', 'version_info.txt')
os.makedirs(os.path.dirname(_version_info_path), exist_ok=True)
with open(_version_info_path, 'w', encoding='utf-8') as _f:
_f.write(f"""\
VSVersionInfo(
ffi=FixedFileInfo(
filevers={_ver_tuple},
prodvers={_ver_tuple},
mask=0x3f,
flags=0x0,
OS=0x40004,
fileType=0x1,
subtype=0x0,
date=(0, 0)
),
kids=[
StringFileInfo([
StringTable(
'040904B0',
[
StringStruct('FileDescription', 'MTConnectExplorer'),
StringStruct('FileVersion', '{__version__}'),
StringStruct('InternalName', 'MTConnectExplorer'),
StringStruct('OriginalFilename', 'MTConnectExplorer.exe'),
StringStruct('ProductName', 'MTConnectExplorer'),
StringStruct('ProductVersion', '{__version__}'),
]
)
]),
VarFileInfo([VarStruct('Translation', [1033, 1200])])
]
)
""")
datas = [
("src", "src") # Include src/ directory
]
binaries = []
hiddenimports = []
for pkg in [ # Imports, not packages
'pydantic',
'psutil',
'streamlit',
'streamlit_tree_select'
]:
d, b, h = collect_all(pkg)
datas += d
binaries += b
hiddenimports += h
a = Analysis(
['src/__main__.py'],
pathex=[],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=['hooks'],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='MTConnectExplorer',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
version=_version_info_path,
)