-
Notifications
You must be signed in to change notification settings - Fork 0
/
makebuild.spec
85 lines (61 loc) · 2.17 KB
/
makebuild.spec
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
# encoding: utf-8
'''
author: Taehong Kim
email: peppy0510@hotmail.com
'''
import glob
import os
debug = False
upx = True
onefile = True
PYZ = PYZ # noqa
EXE = EXE # noqa
COLLECT = COLLECT # noqa
Analysis = Analysis # noqa
__appname__ = 'PyWinSecure'
__default_python_path__ = 'C:\\Program Files\\Python36'
__api_ms_win_crt_path__ = 'C:\\Windows\\WinSxS\\amd64_microsoft-windows-m..namespace-downlevel_31bf3856ad364e35_10.0.22000.1_none_1da8785685e3614b'
class Path():
def __init__(self, **kwargs):
for key in kwargs.keys():
kwargs[key] = os.path.abspath(kwargs[key])
self.__dict__.update(kwargs)
def grapdatas(home, path, depth, mode, specs=None):
datas = []
for p in glob.glob(os.path.join(home, path, '*.*')):
splpath = p.split(os.sep)
if specs is None or splpath[-1] in specs:
virpath = os.sep.join(splpath[-depth - 1:])
datas += [(virpath, p, mode)]
return datas
path = Path(
home='',
assets=os.path.join('assets'),
dlls=os.path.join('assets', 'dlls'),
icon=os.path.join('assets', 'icon', 'icon.ico'),
output=os.path.join('build', '{}.exe'.format(__appname__)),
winsxs=__api_ms_win_crt_path__,
)
a = Analysis([os.path.join('source', 'main.pyw')],
hookspath=[],
pathex=[path.home, path.assets, path.dlls, path.winsxs],
hiddenimports=[])
a.datas += grapdatas(path.assets, 'icon', 2, 'data', ['icon.ico'])
print('-' * 100)
for v in a.datas:
print(v)
print('-' * 100)
pyz = PYZ(a.pure)
if onefile:
exe = EXE(pyz, a.scripts + [('O', '', 'OPTION')],
a.binaries, a.zipfiles, a.datas,
uac_admin=True, uac_uiaccess=True,
icon=path.icon, name=path.output,
upx=upx, strip=None, debug=debug, console=debug)
# runtime_tmpdir='%HOMEPATH%\\AppData\\Local\\Temp\\' + name
else:
exe = EXE(pyz, a.scripts, name=path.output, icon=path.icon,
uac_admin=True, uac_uiaccess=True, upx=upx, strip=None,
debug=debug, console=debug, exclude_binaries=1)
dist = COLLECT(exe, a.binaries, a.zipfiles, a.datas,
upx=upx, strip=None, name=__appname__)