-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwrfplot.spec
More file actions
107 lines (94 loc) · 2.66 KB
/
wrfplot.spec
File metadata and controls
107 lines (94 loc) · 2.66 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
# -*- mode: python ; coding: utf-8 -*-
import sys
sys.setrecursionlimit(sys.getrecursionlimit() * 5)
import os
import importlib
block_cipher = None
def include_files(src_dir, dest_dir, startswith=None, endswith=None):
"""Copy files from source to Pyinstaller packed destination"""
path_list = []
if os.path.isdir(src_dir):
for file in os.listdir(src_dir):
if startswith is not None:
if file.startswith(startswith):
path_list.append((os.path.join(src_dir, file), dest_dir))
elif endswith is not None:
if file.endswith(endswith):
path_list.append((os.path.join(src_dir, file), dest_dir))
if startswith is None and endswith is None:
path_list.append((src_dir, dest_dir))
return path_list
conda_prefix = os.getenv("CONDA_PREFIX")
libos_files = include_files(
os.path.join(conda_prefix, "lib"),
os.path.join("shapely", ".libs"),
startswith="libgeos",
)
py_files = include_files("wrfplot", ".", endswith=".py")
# Convert name list path to list to string
mpl_toolkits_dir = list(importlib.import_module("mpl_toolkits").__path__)[0]
mpl_toolkits_module = include_files(mpl_toolkits_dir, "mpl_toolkits")
try:
colormaps_module = os.path.dirname(
importlib.machinery.PathFinder().find_module("colormaps").get_filename()
)
except Exception as err:
colormaps_module = (
importlib.machinery.PathFinder()
.find_spec("colormaps")
.submodule_search_locations[0]
)
wrf_py_data_dir = os.path.join(
importlib.machinery.PathFinder().find_spec("wrf").submodule_search_locations[0],
"data",
)
a = Analysis(
["wrfplot/wrfplot.py"],
pathex=[],
binaries=[],
datas=[
("./wrfplot/data", "data"),
(colormaps_module, "colormaps"),
(wrf_py_data_dir, "wrf/data"),
]
+ libos_files
+ py_files
+ mpl_toolkits_module,
hiddenimports=["colormaps", "tqdm"],
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,
[],
exclude_binaries=True,
name="wrfplot",
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name="wrfplot",
)