forked from Factorio-Access/FactorioAccess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_main.py
37 lines (30 loc) · 1.17 KB
/
build_main.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
import os
import sys
print("test")
venv = 'venv'
venv_python = os.path.join('.', venv)
if sys.platform == 'win32':
venv_python += '\Scripts\python.exe'
else:
venv_python += '/bin/python3'
print(venv_python)
linux_hidden_modules=['espeak','python_espeak-0.5.egg-info','speechd_config','speechd']
system_packages="/usr/lib/python3/dist-packages/"
hidden_imports=[]
if not os.path.isdir('./'+venv):
print('"'+sys.executable+'" -m venv '+venv)
os.system('"'+sys.executable+'" -m venv '+venv)
print(venv_python)
os.system(venv_python+' -m pip install -r requirements.txt pyinstaller')
if sys.platform == 'linux':
full_paths=' '.join([system_packages+mod for mod in linux_hidden_modules])
copy_cmd="cp -r "+full_paths+' ./'+venv+'/lib/python3.*/site-packages/'
print(copy_cmd)
if os.system(copy_cmd):
raise RuntimeError()
hidden_imports+=linux_hidden_modules
if os.path.isfile('launcher.spec'):
os.system(venv_python+' -m PyInstaller launcher.spec')
else:
hi="".join([' --hidden-import='+imp for imp in hidden_imports])
os.system(venv_python+' -m PyInstaller --onefile'+hi+' main.py -n launcher')