-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_runners.py
43 lines (34 loc) · 1.34 KB
/
build_runners.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
import os
import sys
import shutil
import subprocess
from argparse import ArgumentParser
from os import path
parser = ArgumentParser(description='Build PyInstaller Exes')
parser.add_argument('--py-exe', help='The python exe to use. USE PYTHON 3.6', required=True)
cmd_args = parser.parse_args()
BUILD_DIR = path.join(os.getcwd(), "build")
RUNNERS_DIR = path.join(os.getcwd(), "runners")
RUNNERS_DIST_DIR = path.join(RUNNERS_DIR, "dist")
ICONS_DIR = path.join(os.getcwd(), "icons")
def build_exe(script_name, icon_name, uac_needed):
subprocess.run([
cmd_args.py_exe, "-m",
"PyInstaller", "-F",
"--noconsole",
"--icon=%s" % (icon_name)] + (
["--uac-admin"] if uac_needed else []
) + ["%s" % (script_name)], cwd=RUNNERS_DIR)
MEK_PROGRAMS = (
("Mozzarilla.py", "../icons/mozzarilla.ico", False),
("Pool.py", "../icons/pool.ico", False),
("Refinery.py", "../icons/refinery.ico", False),
("MEK_Updater.py", "../icons/meke.ico", True),
)
for program in MEK_PROGRAMS:
build_exe(*program)
# Copy the runners into the main directory.
runner_names = filter(lambda n : n.lower().endswith(".exe"),
os.listdir(RUNNERS_DIST_DIR))
for name in runner_names:
shutil.copyfile(path.join(RUNNERS_DIST_DIR, name), path.join(BUILD_DIR, name))