-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
60 lines (51 loc) · 1.59 KB
/
build.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
54
55
56
57
58
59
60
import os
import shutil
import sys
CURRENT_DIR = sys.path[0]
DEPENDENCIES_PATH = os.path.join(CURRENT_DIR, '.venv', 'Lib', 'site-packages')
BUILD_DIR = os.path.join(sys.path[0], 'dist')
print('Building app...')
# Delete dist dir
if os.path.exists(BUILD_DIR):
shutil.rmtree(BUILD_DIR)
# Create EXE
os.system(
f'pyinstaller --noconsole --paths {DEPENDENCIES_PATH} --name ceclient ' +
f'--onefile src/main.py --icon=resources/icons/ce_icon.ico'
)
# Create dirs
os.mkdir(os.path.join(BUILD_DIR, 'resources'))
os.mkdir(os.path.join(BUILD_DIR, 'data'))
# Copy dir and files
shutil.copyfile(
os.path.join(CURRENT_DIR, 'src', 'data', 'game.zip'),
os.path.join(BUILD_DIR, 'data', 'game.zip'),
)
shutil.copyfile(
os.path.join(CURRENT_DIR, 'src', 'auto_connect.bat'),
os.path.join(BUILD_DIR, 'auto_connect.bat'),
)
shutil.copyfile(
os.path.join(CURRENT_DIR, 'src', 'auto_connect.ps1'),
os.path.join(BUILD_DIR, 'auto_connect.ps1'),
)
shutil.copyfile(
os.path.join(CURRENT_DIR, 'src', 'README.url'),
os.path.join(BUILD_DIR, 'README.url'),
)
shutil.copytree(
os.path.join(CURRENT_DIR, 'resources', 'icons'),
os.path.join(BUILD_DIR, 'resources', 'icons'),
)
shutil.copytree(
os.path.join(CURRENT_DIR, 'resources', 'images'),
os.path.join(BUILD_DIR, 'resources', 'images'),
)
shutil.copyfile(
os.path.join(CURRENT_DIR, 'resources', 'resources.qrc'),
os.path.join(BUILD_DIR, 'resources', 'resources.qrc'),
)
# Make zip
shutil.make_archive('ceclient', 'zip', BUILD_DIR)
shutil.move(os.path.join(CURRENT_DIR, 'ceclient.zip'), BUILD_DIR)
print('Build successfully!')