ED_LRR/build.py

66 lines
1.8 KiB
Python

import subprocess as SP
from glob import glob
import os
import shutil
import pkg_resources as pkg
from contextlib import contextmanager
@contextmanager
def in_dir(name,remove=False):
pwd=os.getcwd()
if os.path.isdir(name):
shutil.rmtree(name)
os.makedirs(name)
os.chdir(name)
yield
os.chdir(pwd)
if remove:
shutil.rmtree(name)
SP.check_call(["pip", "install", "PyQt5"])
ui_path = os.path.dirname(os.path.abspath(__file__))
for root, folders, files in os.walk(ui_path):
for file in files:
file = os.path.join(root, file)
outfile, ext = os.path.splitext(file)
if ext == ".ui":
outfile = outfile + ".py"
print(os.path.basename(file), "->", os.path.basename(outfile))
SP.check_call(["pyuic5", "--from-imports", "-o", outfile, file])
SP.check_call(["pip", "install", ".[dev]"])
main_py=os.path.abspath("ed_lrr_gui\__main__.py")
with in_dir("exe"):
with in_dir("pyinstaller"):
SP.check_call(
[
"pyinstaller",
"--clean",
"--noupx",
"-c",
'--key="ED_LRR_GUI"',
"--name",
"ED_LRR",
main_py,
]
)
with in_dir("nuitka"):
SP.check_call(
[
"python",
"-m",
"nuitka",
"--plugin-enable=multiprocessing",
"--plugin-enable=qt-plugins",
"--standalone",
"--follow-imports",
main_py,
]
)
# with in_dir("installer"):
# shutil.rmtree("Output")
# SP.check_call(["iscc", "/QP", "ED_LRR.iss"])