-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathWISDAMapp_pyinstaller.spec
More file actions
113 lines (97 loc) · 2.76 KB
/
WISDAMapp_pyinstaller.spec
File metadata and controls
113 lines (97 loc) · 2.76 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
111
112
113
# -*- mode: python ; coding: utf-8 -*-
from pathlib import Path
import os
import sys
import importlib.metadata
import toml
specpath = os.path.dirname(os.path.abspath(SPEC))
path_to_repo_main = Path(specpath)
print("Path to repo main folder:", path_to_repo_main.as_posix())
path_to_wisdam = path_to_repo_main / "src" / "WISDAM"
sys.path.append(path_to_wisdam.as_posix())
try:
import WISDAMcore
from WISDAMcore import ArrayNx2
print("import")
except (ModuleNotFoundError, ImportError):
path_to_WISDAMcore = path_to_repo_main.parent / "WISDAMcore_oldCore"
if path_to_WISDAMcore.exists():
path_to_WISDAMcore_src = path_to_WISDAMcore / "src" / "WISDAMcore_oldCore"
sys.path.append(path_to_WISDAMcore_src.as_posix())
print(path_to_WISDAMcore_src)
import WISDAMcore
from WISDAMcore import ArrayNx2
print("import")
else:
print("\nThe package WISDAMcore can not be found.\nEXIT")
raise SystemExit
icon = path_to_wisdam / "app" / "gui_design" / "icons" / "WISDAMapp_black.ico"
pyproject_toml_file = path_to_repo_main / "pyproject.toml"
if pyproject_toml_file.exists() and pyproject_toml_file.is_file():
toml_file = toml.load(pyproject_toml_file)
__package_version = toml_file["project"]["version"]
name_app = 'WISDAM_' + __package_version.replace('.','_')
block_cipher = None
rasterio_imports = ['rasterio._shim',
'rasterio',
'rasterio.control',
'rasterio.crs',
'rasterio.sample',
'rasterio.vrt',
'rasterio._features',
'rasterio._base',
'rasterio.rpc']
added_files = [
( (path_to_repo_main / 'bin').as_posix(), 'bin'),
( (path_to_wisdam / 'data').as_posix(), 'data'),
( (path_to_wisdam / 'license').as_posix(), 'license'),
( (path_to_repo_main / 'docs' / 'wisdam_manual.pdf').as_posix(), '.'),
( pyproject_toml_file.as_posix(), '.'),
]
a = Analysis(
[(path_to_wisdam / 'main.py').as_posix()],
pathex=[path_to_repo_main.as_posix()],
binaries=[],
datas=added_files,
hiddenimports=rasterio_imports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
[],
# a.binaries,
# a.zipfiles,
# a.datas,
exclude_binaries=True,
name=name_app,
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=icon.as_posix(),
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name=name_app,
)