-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathqiewinstaller.py
53 lines (41 loc) · 1.26 KB
/
qiewinstaller.py
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
import sys, os
import PyInstaller.__main__
qiew = 'qiew'
buildcmd = [
'--name=%s' % qiew,
'--onefile',
'--console',
]
def add_datas(buildcmd, path, allowed=['.py', '.ui', '.yapsy-plugin', '.disabled']):
L = os.listdir(path)
for l in L:
name, extension = os.path.splitext(l)
if extension in allowed:
datas = '--add-data={};{}'.format(os.path.join(path, l), path)
buildcmd += [datas]
print(datas)
# plugins
add_datas(buildcmd, os.path.join('plugins', 'format'))
add_datas(buildcmd, os.path.join('plugins', 'unpack'))
add_datas(buildcmd, os.path.join('.'), allowed=['.ui'])
# capstone
bin = '--add-data={};{}'.format(r'C:\Python36\Lib\site-packages\capstone\capstone.dll', '.')
buildcmd += [bin]
# modules
#bin = '--hidden-import={}'.format('elftools')
#buildcmd += [bin]
# scripts
L = os.listdir('.')
for l in L:
name, extension = os.path.splitext(l)
if extension in ['.py']:
buildcmd += [os.path.join(l)]
# scripts
L = os.listdir(os.path.join('.', 'plugins', 'format'))
for l in L:
name, extension = os.path.splitext(l)
if extension in ['.py']:
buildcmd += [os.path.join('plugins', 'format', l)]
buildcmd += [os.path.join('qiew.py')]
PyInstaller.__main__.run(
buildcmd)