forked from KhanhhNe/SSHManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
40 lines (32 loc) · 1.05 KB
/
build.py
File metadata and controls
40 lines (32 loc) · 1.05 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
import os
import shutil
import zipfile
import PyInstaller.__main__
# Can be replaced with any lib
import flask
packages_path = flask.__file__
while not packages_path.endswith('site-packages'):
packages_path = os.path.dirname(packages_path)
PyInstaller.__main__.run([
'main.py', '--name=SSHManager', '--icon=logo.ico', '--onedir', '--noconfirm', '--clean',
'--add-data=templates;templates',
'--add-binary=stnlc.exe;.', '--add-binary=logo.ico;.',
f'--paths={packages_path}',
'--hidden-import=engineio.async_drivers.threading'
])
print("Removing build folder...")
shutil.rmtree('build')
print("Zipping files...")
built_file = zipfile.ZipFile('SSHManager.zip', 'w')
os.chdir('dist')
for folder, subfolders, filenames in os.walk(r'SSHManager'):
for filename in filenames:
filepath = os.path.join(folder, filename)
print(f"Zipping {filepath}")
built_file.write(filepath)
os.chdir('..')
built_file.close()
print("Removing dist folder...")
shutil.rmtree('dist')
os.remove('SSHManager.spec')
print("Done! Happy distributing!")