2022-10-08 08:30:56 -04:00
|
|
|
#!/usr/bin/env python3
|
2022-06-26 22:18:37 -04:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import shutil
|
2022-10-08 08:30:56 -04:00
|
|
|
import argparse
|
2022-06-26 22:18:37 -04:00
|
|
|
|
|
|
|
import PyInstaller.__main__
|
|
|
|
|
|
|
|
is_64bit = sys.maxsize > 2**32
|
2022-10-07 16:51:40 -04:00
|
|
|
# is_linux = sys.platform.startswith("linux")
|
2022-06-26 22:18:37 -04:00
|
|
|
exclude_modules = []
|
2022-10-07 16:51:40 -04:00
|
|
|
add_data = [
|
|
|
|
"quirks;quirks",
|
|
|
|
"smilies;smilies",
|
|
|
|
"themes;themes",
|
|
|
|
"docs;docs",
|
2023-02-22 20:12:16 -05:00
|
|
|
"fonts;fonts",
|
2022-10-07 16:51:40 -04:00
|
|
|
"README.md;.",
|
|
|
|
"LICENSE;.",
|
|
|
|
"CHANGELOG.md;.",
|
|
|
|
"PCskins.png;.",
|
|
|
|
"Pesterchum.png;.",
|
|
|
|
]
|
|
|
|
data_folders = {
|
|
|
|
"quirks": "quirks",
|
|
|
|
"smilies": "smilies",
|
|
|
|
"themes": "themes",
|
|
|
|
"docs": "docs",
|
2023-02-22 20:12:16 -05:00
|
|
|
"fonts": "fonts",
|
2022-10-07 16:51:40 -04:00
|
|
|
}
|
|
|
|
data_files = {
|
|
|
|
"README.md": "README.md.txt",
|
|
|
|
"LICENSE": "LICENSE.txt",
|
|
|
|
"CHANGELOG.md": "CHANGELOG.md.txt",
|
|
|
|
"PCskins.png": ".",
|
|
|
|
"Pesterchum.png": ".",
|
|
|
|
}
|
|
|
|
data_files_linux = {
|
|
|
|
"README.md": "README.md",
|
|
|
|
"LICENSE": "LICENSE.txt",
|
|
|
|
"CHANGELOG.md": "CHANGELOG.md",
|
|
|
|
"PCskins.png": ".",
|
|
|
|
"Pesterchum.png": ".",
|
|
|
|
}
|
2022-06-26 22:18:37 -04:00
|
|
|
# Some of these might not be required anymore,
|
|
|
|
# newer versions of PyInstaller claim to exclude certain problematic DDLs automatically.
|
2022-10-07 16:51:40 -04:00
|
|
|
upx_exclude = [
|
|
|
|
"qwindows.dll",
|
2022-07-08 16:36:23 -04:00
|
|
|
"Qt6Core.dll",
|
|
|
|
"Qt6Gui.dll",
|
2022-10-29 15:49:35 -04:00
|
|
|
"Qt5Core.dll",
|
|
|
|
"Qt5Gui.dll",
|
2022-06-26 22:18:37 -04:00
|
|
|
"vcruntime140.dll",
|
|
|
|
"MSVCP140.dll",
|
2022-10-08 08:30:56 -04:00
|
|
|
"MSVCP140_1.dll",
|
2022-10-07 16:51:40 -04:00
|
|
|
"api-ms-win-core-console-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-console-l1-2-0.dll",
|
|
|
|
"api-ms-win-core-datetime-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-debug-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-errorhandling-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-file-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-file-l1-2-0.dll",
|
|
|
|
"api-ms-win-core-file-l2-1-0.dll",
|
|
|
|
"api-ms-win-core-handle-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-heap-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-interlocked-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-libraryloader-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-localization-l1-2-0.dll",
|
|
|
|
"api-ms-win-core-memory-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-namedpipe-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-processenvironment-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-processthreads-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-processthreads-l1-1-1.dll",
|
|
|
|
"api-ms-win-core-profile-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-rtlsupport-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-string-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-synch-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-synch-l1-2-0.dll",
|
|
|
|
"api-ms-win-core-sysinfo-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-timezone-l1-1-0.dll",
|
|
|
|
"api-ms-win-core-util-l1-1-0.dll",
|
|
|
|
"API-MS-Win-core-xstate-l2-1-0.dll",
|
|
|
|
"api-ms-win-crt-conio-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-convert-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-environment-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-filesystem-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-heap-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-locale-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-math-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-multibyte-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-private-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-process-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-runtime-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-stdio-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-string-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-time-l1-1-0.dll",
|
|
|
|
"api-ms-win-crt-utility-l1-1-0.dll",
|
|
|
|
"ucrtbase.dll",
|
|
|
|
]
|
2022-06-26 22:18:37 -04:00
|
|
|
|
2022-10-07 16:51:40 -04:00
|
|
|
delete_builddist = ""
|
|
|
|
upx_enabled = ""
|
|
|
|
package_universal_crt = ""
|
|
|
|
onefile = ""
|
|
|
|
windowed = ""
|
2022-10-08 08:30:56 -04:00
|
|
|
upx_dir = ""
|
2022-10-29 15:49:35 -04:00
|
|
|
crt_path = ""
|
2022-06-26 22:18:37 -04:00
|
|
|
|
2022-10-08 08:30:56 -04:00
|
|
|
# Command line options
|
|
|
|
parser = argparse.ArgumentParser()
|
2022-06-26 22:18:37 -04:00
|
|
|
|
2022-10-29 15:49:35 -04:00
|
|
|
# Python 3.8 doesn't support optional boolean actions
|
|
|
|
# py3.8 usage is --upx True, py3.9+ usage is --upx/--no-upx
|
|
|
|
# The values for py3.8 are str, for 3.9+ they're booleans
|
|
|
|
# This is very cringe </3
|
|
|
|
if (sys.version_info[0] > 2) and (sys.version_info[1] > 8):
|
|
|
|
# Python 3.9 and up
|
|
|
|
parser.add_argument(
|
|
|
|
"--prompts",
|
|
|
|
help="Prompt for the options below on run",
|
|
|
|
action=argparse.BooleanOptionalAction,
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--onefile",
|
|
|
|
help="Create a one-file bundled executable.",
|
|
|
|
action=argparse.BooleanOptionalAction,
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--upx",
|
|
|
|
help="Try to compress binaries with UPX.",
|
|
|
|
action=argparse.BooleanOptionalAction,
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--crt",
|
|
|
|
help="Try to bundle Universal CRT with the build",
|
|
|
|
action=argparse.BooleanOptionalAction,
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--clean",
|
|
|
|
help="Remove build+dist directories with shutil before building.",
|
|
|
|
action=argparse.BooleanOptionalAction,
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--windowed",
|
|
|
|
help="Build without console.",
|
|
|
|
action=argparse.BooleanOptionalAction,
|
|
|
|
)
|
|
|
|
_ARGUMENTS = parser.parse_args()
|
2023-02-13 14:26:05 -05:00
|
|
|
if _ARGUMENTS.clean:
|
2022-10-29 15:49:35 -04:00
|
|
|
delete_builddist = "y"
|
2023-02-13 14:26:05 -05:00
|
|
|
elif _ARGUMENTS.clean is False:
|
2022-10-29 15:49:35 -04:00
|
|
|
delete_builddist = "n"
|
2022-10-07 16:51:40 -04:00
|
|
|
|
2023-02-13 14:26:05 -05:00
|
|
|
if _ARGUMENTS.upx:
|
2022-10-29 15:49:35 -04:00
|
|
|
upx_enabled = "y"
|
2023-02-13 14:26:05 -05:00
|
|
|
elif _ARGUMENTS.upx is False:
|
2022-10-29 15:49:35 -04:00
|
|
|
upx_enabled = "n"
|
2022-10-07 16:51:40 -04:00
|
|
|
|
2023-02-13 14:26:05 -05:00
|
|
|
if _ARGUMENTS.crt:
|
2022-10-29 15:49:35 -04:00
|
|
|
package_universal_crt = "y"
|
2023-02-13 14:26:05 -05:00
|
|
|
elif _ARGUMENTS.crt is False:
|
2022-10-29 15:49:35 -04:00
|
|
|
package_universal_crt = "n"
|
2022-10-07 16:51:40 -04:00
|
|
|
|
2023-02-13 14:26:05 -05:00
|
|
|
if _ARGUMENTS.onefile:
|
2022-10-29 15:49:35 -04:00
|
|
|
onefile = "y"
|
2023-02-13 14:26:05 -05:00
|
|
|
elif _ARGUMENTS.onefile is False:
|
2022-10-29 15:49:35 -04:00
|
|
|
onefile = "n"
|
2022-10-08 08:30:56 -04:00
|
|
|
|
2023-02-13 14:26:05 -05:00
|
|
|
if _ARGUMENTS.windowed:
|
2022-10-29 15:49:35 -04:00
|
|
|
windowed = "y"
|
2023-02-13 14:26:05 -05:00
|
|
|
elif _ARGUMENTS.windowed is False:
|
2022-10-29 15:49:35 -04:00
|
|
|
windowed = "n"
|
|
|
|
else:
|
|
|
|
# Python 3.8 and below
|
|
|
|
parser.add_argument(
|
|
|
|
"--prompts",
|
|
|
|
help="Prompt for the options below on run",
|
|
|
|
action="store",
|
|
|
|
choices=["True", "False"],
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--onefile",
|
|
|
|
help="Create a one-file bundled executable.",
|
|
|
|
action="store",
|
|
|
|
choices=["True", "False"],
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--upx",
|
|
|
|
help="Try to compress binaries with UPX.",
|
|
|
|
action="store",
|
|
|
|
choices=["True", "False"],
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--crt",
|
|
|
|
help="Try to bundle Universal CRT with the build",
|
|
|
|
action="store",
|
|
|
|
choices=["True", "False"],
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--clean",
|
|
|
|
help="Remove build+dist directories with shutil before building.",
|
|
|
|
action="store",
|
|
|
|
choices=["True", "False"],
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--windowed",
|
|
|
|
help="Build without console.",
|
|
|
|
action="store",
|
|
|
|
choices=["True", "False"],
|
|
|
|
)
|
|
|
|
_ARGUMENTS = parser.parse_args()
|
|
|
|
if _ARGUMENTS.clean == "True":
|
|
|
|
delete_builddist = "y"
|
|
|
|
elif _ARGUMENTS.clean == "False":
|
|
|
|
delete_builddist = "n"
|
|
|
|
if _ARGUMENTS.upx == "True":
|
|
|
|
upx_enabled = "y"
|
|
|
|
elif _ARGUMENTS.upx == "False":
|
|
|
|
upx_enabled = "n"
|
|
|
|
if _ARGUMENTS.crt == "True":
|
|
|
|
package_universal_crt = "y"
|
|
|
|
elif _ARGUMENTS.crt == "False":
|
|
|
|
package_universal_crt = "n"
|
|
|
|
if _ARGUMENTS.onefile == "True":
|
|
|
|
onefile = "y"
|
|
|
|
elif _ARGUMENTS.onefile == "False":
|
|
|
|
onefile = "n"
|
|
|
|
if _ARGUMENTS.windowed == "True":
|
|
|
|
windowed = "y"
|
|
|
|
elif _ARGUMENTS.windowed == "False":
|
|
|
|
windowed = "n"
|
2022-10-08 08:30:56 -04:00
|
|
|
|
|
|
|
parser.print_usage()
|
2023-02-13 14:26:05 -05:00
|
|
|
if (_ARGUMENTS.prompts is not False) and (_ARGUMENTS.prompts != "False"):
|
2022-10-08 08:30:56 -04:00
|
|
|
try:
|
2022-10-07 16:51:40 -04:00
|
|
|
print(
|
2022-10-08 08:30:56 -04:00
|
|
|
"This is a script to make building with Pyinstaller a bit more conventient."
|
2022-10-07 16:51:40 -04:00
|
|
|
)
|
2022-10-08 08:30:56 -04:00
|
|
|
|
2023-02-14 13:55:23 -05:00
|
|
|
while delete_builddist not in ("y", "n"):
|
2022-10-08 08:30:56 -04:00
|
|
|
delete_builddist = input("Delete build & dist folders? (Y/N): ").lower()
|
|
|
|
|
2023-02-14 13:55:23 -05:00
|
|
|
while upx_enabled not in ("y", "n"):
|
2022-10-08 08:30:56 -04:00
|
|
|
upx_enabled = input("Enable UPX? (Y/N): ").lower()
|
|
|
|
if upx_enabled == "y":
|
|
|
|
print("If upx is on your path you don't need to include anything here.")
|
2023-02-13 14:26:05 -05:00
|
|
|
if is_64bit:
|
2022-10-08 08:30:56 -04:00
|
|
|
upx_dir = input("UPX directory [D:\\upx-3.96-win64]: ")
|
|
|
|
if upx_dir == "":
|
|
|
|
upx_dir = "D:\\upx-3.96-win64" # Default dir for me :)
|
2022-06-26 22:18:37 -04:00
|
|
|
else:
|
2022-10-08 08:30:56 -04:00
|
|
|
upx_dir = input("UPX directory [D:\\upx-3.96-win32]: ")
|
|
|
|
if upx_dir == "":
|
|
|
|
upx_dir = "D:\\upx-3.96-win32" # Default dir for me :)
|
|
|
|
print("upx_dir = " + upx_dir)
|
|
|
|
elif upx_enabled == "n":
|
|
|
|
upx_dir = ""
|
|
|
|
|
2023-02-14 13:55:23 -05:00
|
|
|
while windowed not in ("y", "n"):
|
2022-10-08 08:30:56 -04:00
|
|
|
windowed = input("Build with '--windowed'? (Y/N): ").lower()
|
|
|
|
|
|
|
|
if sys.platform == "win32":
|
|
|
|
print(
|
|
|
|
"(https://pyinstaller.readthedocs.io/en/stable/usage.html?highlight=sdk#windows)"
|
|
|
|
)
|
2023-02-14 13:55:23 -05:00
|
|
|
while package_universal_crt not in ("y", "n"):
|
2022-10-08 08:30:56 -04:00
|
|
|
package_universal_crt = input(
|
|
|
|
"Try to include universal CRT? (Y/N): "
|
|
|
|
).lower()
|
|
|
|
if package_universal_crt == "y":
|
2023-02-13 14:26:05 -05:00
|
|
|
if is_64bit:
|
2022-10-08 08:30:56 -04:00
|
|
|
crt_path = input(
|
2022-10-29 15:49:35 -04:00
|
|
|
"Path to universal CRT: [C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x64]: "
|
2022-10-07 16:51:40 -04:00
|
|
|
)
|
2022-10-08 08:30:56 -04:00
|
|
|
if crt_path == "":
|
|
|
|
# crt_path = "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x64" # Default directory.
|
|
|
|
crt_path = os.path.join(
|
|
|
|
"C:%s" % os.sep,
|
|
|
|
"Program Files (x86)",
|
|
|
|
"Windows Kits",
|
|
|
|
"10",
|
|
|
|
"10.0.19041.0",
|
|
|
|
"ucrt",
|
|
|
|
"DLLs",
|
|
|
|
"x64",
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
crt_path = input(
|
2022-10-29 15:49:35 -04:00
|
|
|
"Path to universal CRT: [C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86]: "
|
2022-10-08 08:30:56 -04:00
|
|
|
)
|
|
|
|
if crt_path == "":
|
|
|
|
# crt_path = "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\10.0.19041.0\\ucrt\\DLLs\\x86" # Default directory.
|
|
|
|
crt_path = os.path.join(
|
|
|
|
"C:%s" % os.sep,
|
|
|
|
"Program Files (x86)",
|
|
|
|
"Windows Kits",
|
|
|
|
"10",
|
|
|
|
"10.0.19041.0",
|
|
|
|
"ucrt",
|
|
|
|
"DLLs",
|
|
|
|
"x86",
|
|
|
|
)
|
|
|
|
print("crt_path = " + crt_path)
|
|
|
|
|
2023-02-14 13:55:23 -05:00
|
|
|
if sys.platform in ("win32", "linux"):
|
|
|
|
while onefile not in ("y", "n"):
|
2022-10-08 08:30:56 -04:00
|
|
|
onefile = input("Build with '--onefile'? (Y/N): ").lower()
|
2022-10-07 16:51:40 -04:00
|
|
|
|
2022-10-08 08:30:56 -04:00
|
|
|
except KeyboardInterrupt:
|
|
|
|
sys.exit("KeyboardInterrupt")
|
|
|
|
else:
|
|
|
|
# no-prompt was given
|
2023-02-13 14:26:05 -05:00
|
|
|
if _ARGUMENTS.clean is None:
|
2022-10-08 08:30:56 -04:00
|
|
|
delete_builddist = "n"
|
2023-02-13 14:26:05 -05:00
|
|
|
if _ARGUMENTS.upx is None:
|
2022-10-08 08:30:56 -04:00
|
|
|
upx_enabled = "n"
|
2023-02-13 14:26:05 -05:00
|
|
|
if _ARGUMENTS.crt is None:
|
|
|
|
if is_64bit:
|
2022-10-29 15:49:35 -04:00
|
|
|
crt_path = os.path.join(
|
|
|
|
"C:%s" % os.sep,
|
|
|
|
"Program Files (x86)",
|
|
|
|
"Windows Kits",
|
|
|
|
"10",
|
|
|
|
"10.0.19041.0",
|
|
|
|
"ucrt",
|
|
|
|
"DLLs",
|
|
|
|
"x64",
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
crt_path = os.path.join(
|
|
|
|
"C:%s" % os.sep,
|
|
|
|
"Program Files (x86)",
|
|
|
|
"Windows Kits",
|
|
|
|
"10",
|
|
|
|
"10.0.19041.0",
|
|
|
|
"ucrt",
|
|
|
|
"DLLs",
|
|
|
|
"x86",
|
|
|
|
)
|
|
|
|
print("crt_path = " + crt_path)
|
2022-10-08 08:30:56 -04:00
|
|
|
package_universal_crt = "y"
|
2023-02-13 14:26:05 -05:00
|
|
|
if _ARGUMENTS.onefile is None:
|
2022-10-08 08:30:56 -04:00
|
|
|
onefile = "y"
|
2023-02-13 14:26:05 -05:00
|
|
|
if _ARGUMENTS.windowed is None:
|
2022-10-08 08:30:56 -04:00
|
|
|
windowed = "y"
|
2022-10-07 16:51:40 -04:00
|
|
|
|
2022-10-08 08:30:56 -04:00
|
|
|
if delete_builddist == "y":
|
|
|
|
try:
|
|
|
|
shutil.rmtree("dist")
|
|
|
|
except FileNotFoundError as e:
|
|
|
|
print(e)
|
|
|
|
try:
|
|
|
|
shutil.rmtree("build")
|
|
|
|
except FileNotFoundError as e:
|
|
|
|
print(e)
|
2022-06-26 22:18:37 -04:00
|
|
|
|
2022-10-07 16:51:40 -04:00
|
|
|
# Windows
|
|
|
|
if sys.platform == "win32":
|
2022-06-26 22:18:37 -04:00
|
|
|
run_win32 = [
|
2022-10-07 16:51:40 -04:00
|
|
|
"pesterchum.py",
|
|
|
|
"--name=Pesterchum",
|
2022-06-26 22:18:37 -04:00
|
|
|
#'--noconfirm', # Overwrite output directory.
|
|
|
|
#'--windowed', # Hide console
|
2023-03-08 09:38:50 -05:00
|
|
|
"--icon={}".format(os.path.join("img", "icon", "pesterchum.ico")),
|
2022-10-07 16:51:40 -04:00
|
|
|
"--clean", # Clear cache
|
2022-06-26 22:18:37 -04:00
|
|
|
]
|
|
|
|
|
|
|
|
if (sys.version_info.major == 3) & (sys.version_info.minor == 8):
|
2022-10-07 16:51:40 -04:00
|
|
|
exclude_modules.append("tkinter")
|
|
|
|
if upx_enabled == "y":
|
2022-06-26 22:18:37 -04:00
|
|
|
if os.path.isdir(upx_dir):
|
2022-10-07 16:51:40 -04:00
|
|
|
run_win32.append("--upx-dir=%s" % upx_dir)
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in upx_exclude:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_win32.append("--upx-exclude=%s" % x)
|
2022-06-26 22:18:37 -04:00
|
|
|
# Lower case variants are required.
|
2022-10-07 16:51:40 -04:00
|
|
|
run_win32.append("--upx-exclude=%s" % x.lower())
|
|
|
|
elif upx_enabled == "n":
|
|
|
|
run_win32.append("--noupx")
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in exclude_modules:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_win32.append("--exclude-module=%s" % x)
|
|
|
|
if windowed == "y":
|
|
|
|
run_win32.append("--windowed")
|
|
|
|
if onefile == "y":
|
|
|
|
run_win32.append("--onefile")
|
|
|
|
elif onefile == "n":
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in add_data:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_win32.append("--add-data=%s" % x)
|
2022-06-26 22:18:37 -04:00
|
|
|
|
2022-10-07 16:51:40 -04:00
|
|
|
if package_universal_crt == "y":
|
2022-10-29 15:49:35 -04:00
|
|
|
run_win32.append("--paths=%s" % crt_path)
|
2022-06-26 22:18:37 -04:00
|
|
|
if os.path.exists(crt_path):
|
2023-02-13 14:26:05 -05:00
|
|
|
if not is_64bit:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-console-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-console-l1-2-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-datetime-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-debug-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-errorhandling-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-file-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-file-l1-2-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-file-l2-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-handle-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-heap-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-interlocked-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-libraryloader-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-localization-l1-2-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-memory-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-namedpipe-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-processenvironment-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-processthreads-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-processthreads-l1-1-1.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-profile-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-rtlsupport-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-string-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-synch-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-synch-l1-2-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-sysinfo-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-timezone-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-util-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\API-MS-Win-core-xstate-l2-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-conio-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-convert-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-environment-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-filesystem-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-heap-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-locale-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-math-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-multibyte-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-private-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-process-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-runtime-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-stdio-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-string-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-time-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-utility-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append("--add-binary=%s\\ucrtbase.dll;." % crt_path)
|
2023-02-13 14:26:05 -05:00
|
|
|
elif is_64bit:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-console-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-console-l1-2-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-datetime-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-debug-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-errorhandling-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-file-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-file-l1-2-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-file-l2-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-handle-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-heap-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-interlocked-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-libraryloader-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-localization-l1-2-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-memory-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-namedpipe-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-processenvironment-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-processthreads-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-processthreads-l1-1-1.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-profile-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-rtlsupport-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-string-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-synch-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-synch-l1-2-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-sysinfo-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-timezone-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-core-util-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-conio-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-convert-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-environment-l1-1-0.dll;."
|
|
|
|
% crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-filesystem-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-heap-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-locale-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-math-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-multibyte-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-private-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-process-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-runtime-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-stdio-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-string-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-time-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append(
|
|
|
|
"--add-binary=%s\\api-ms-win-crt-utility-l1-1-0.dll;." % crt_path
|
|
|
|
)
|
|
|
|
run_win32.append("--add-binary=%s\\ucrtbase.dll;." % crt_path)
|
2022-06-26 22:18:37 -04:00
|
|
|
print(run_win32)
|
|
|
|
PyInstaller.__main__.run(run_win32)
|
2022-10-07 16:51:40 -04:00
|
|
|
|
|
|
|
if onefile == "y":
|
2022-06-26 22:18:37 -04:00
|
|
|
# There's more proper ways to do this, but this doesn't require changing our paths
|
|
|
|
for x in data_folders:
|
|
|
|
print(x)
|
2022-10-07 16:51:40 -04:00
|
|
|
shutil.copytree(
|
|
|
|
x,
|
|
|
|
os.path.join("dist", data_folders[x]),
|
|
|
|
ignore=shutil.ignore_patterns(
|
|
|
|
"*.psd", "*.xcf*", "ebg2.png", "ebg1.png"
|
|
|
|
),
|
|
|
|
)
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in data_files:
|
|
|
|
print(x)
|
2022-10-07 16:51:40 -04:00
|
|
|
shutil.copy(x, os.path.join("dist", data_files[x]))
|
|
|
|
|
|
|
|
files = os.listdir("dist")
|
2022-06-26 22:18:37 -04:00
|
|
|
try:
|
2022-10-07 16:51:40 -04:00
|
|
|
os.mkdir(os.path.join("dist", "Pesterchum"))
|
2022-06-26 22:18:37 -04:00
|
|
|
except FileExistsError:
|
|
|
|
pass
|
|
|
|
for x in files:
|
2022-10-07 16:51:40 -04:00
|
|
|
shutil.move(os.path.join("dist", x), os.path.join("dist", "Pesterchum"))
|
|
|
|
|
|
|
|
# shutil.copy(os.path.join('build', 'Pesterchum', 'xref-Pesterchum.html'),
|
2022-06-26 22:18:37 -04:00
|
|
|
# os.path.join('dist', 'Pesterchum', 'xref-Pesterchum.html'))
|
2022-10-07 16:51:40 -04:00
|
|
|
# shutil.copy(os.path.join('build', 'Pesterchum', 'Analysis-00.toc'),
|
2022-06-26 22:18:37 -04:00
|
|
|
# os.path.join('dist', 'Pesterchum', 'Analysis-00.toc'))
|
|
|
|
|
2022-10-07 16:51:40 -04:00
|
|
|
|
|
|
|
# MacOS
|
|
|
|
elif sys.platform == "darwin":
|
|
|
|
run_darwin = [
|
|
|
|
"pesterchum.py",
|
|
|
|
"--name=Pesterchum",
|
2022-06-26 22:18:37 -04:00
|
|
|
#'--windowed', # Hide console
|
|
|
|
#'--noconfirm', # Overwrite output directory.
|
2023-03-08 09:38:50 -05:00
|
|
|
"--icon={}".format(os.path.join("img", "icon", "pesterchum.icns")),
|
2022-10-07 16:51:40 -04:00
|
|
|
"--onedir",
|
|
|
|
"--clean", # Clear cache
|
2022-06-26 22:18:37 -04:00
|
|
|
#'--noupx'
|
|
|
|
]
|
|
|
|
|
2022-10-07 16:51:40 -04:00
|
|
|
if upx_enabled == "y":
|
2022-06-26 22:18:37 -04:00
|
|
|
if os.path.isdir(upx_dir):
|
2022-10-07 16:51:40 -04:00
|
|
|
run_darwin.append("--upx-dir=%s" % upx_dir)
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in upx_exclude:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_darwin.append("--upx-exclude=%s" % x)
|
2022-06-26 22:18:37 -04:00
|
|
|
# Lower case variants are required.
|
2022-10-07 16:51:40 -04:00
|
|
|
run_darwin.append("--upx-exclude=%s" % x.lower())
|
|
|
|
elif upx_enabled == "n":
|
|
|
|
run_darwin.append("--noupx")
|
2022-06-26 22:18:37 -04:00
|
|
|
if os.path.isdir(upx_dir):
|
2022-10-07 16:51:40 -04:00
|
|
|
run_darwin.append("--upx-dir=%s" % upx_dir)
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in exclude_modules:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_darwin.append("--exclude-module=%s" % x)
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in add_data:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_darwin.append("--add-data=%s" % x.replace(";", ":"))
|
|
|
|
if windowed == "y":
|
|
|
|
run_darwin.append("--windowed")
|
2022-06-26 22:18:37 -04:00
|
|
|
PyInstaller.__main__.run(run_darwin)
|
2022-10-07 16:51:40 -04:00
|
|
|
|
|
|
|
# Linux
|
|
|
|
elif sys.platform == "linux":
|
|
|
|
run_linux = [
|
|
|
|
"pesterchum.py",
|
|
|
|
"--name=Pesterchum",
|
2022-06-26 22:18:37 -04:00
|
|
|
#'--windowed', # Hide console
|
|
|
|
#'--noconfirm', # Overwrite output directory.
|
2023-03-08 09:38:50 -05:00
|
|
|
"--icon={}".format(os.path.join("img", "icon", "pesterchum.ico")),
|
2022-10-07 16:51:40 -04:00
|
|
|
"--clean", # Clear cache
|
2022-06-26 22:18:37 -04:00
|
|
|
]
|
|
|
|
|
2022-10-07 16:51:40 -04:00
|
|
|
if upx_enabled == "y":
|
2022-06-26 22:18:37 -04:00
|
|
|
if os.path.isdir(upx_dir):
|
2022-10-07 16:51:40 -04:00
|
|
|
run_linux.append("--upx-dir=%s" % upx_dir)
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in upx_exclude:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_linux.append("--upx-exclude=%s" % x)
|
2022-06-26 22:18:37 -04:00
|
|
|
# Lower case variants are required.
|
2022-10-07 16:51:40 -04:00
|
|
|
run_linux.append("--upx-exclude=%s" % x.lower())
|
|
|
|
elif upx_enabled == "n":
|
|
|
|
run_linux.append("--noupx")
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in exclude_modules:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_linux.append("--exclude-module=%s" % x)
|
|
|
|
if onefile == "y":
|
|
|
|
run_linux.append("--onefile")
|
|
|
|
elif onefile == "n":
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in add_data:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_linux.append("--add-data=%s" % x.replace(";", ":"))
|
|
|
|
if windowed == "y":
|
|
|
|
run_linux.append("--windowed")
|
|
|
|
|
2022-06-26 22:18:37 -04:00
|
|
|
print(run_linux)
|
|
|
|
PyInstaller.__main__.run(run_linux)
|
2022-10-07 16:51:40 -04:00
|
|
|
|
|
|
|
if onefile == "y":
|
2022-06-26 22:18:37 -04:00
|
|
|
# There's more proper ways to do this, but this doesn't require changing our paths
|
|
|
|
for x in data_folders:
|
|
|
|
print(x)
|
2022-10-07 16:51:40 -04:00
|
|
|
shutil.copytree(
|
|
|
|
x,
|
|
|
|
os.path.join("dist", data_folders[x]),
|
|
|
|
ignore=shutil.ignore_patterns(
|
|
|
|
"*.psd", "*.xcf*", "ebg2.png", "ebg1.png"
|
|
|
|
),
|
|
|
|
)
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in data_files_linux:
|
|
|
|
print(x)
|
2022-10-07 16:51:40 -04:00
|
|
|
shutil.copy(x, os.path.join("dist", data_files_linux[x]))
|
|
|
|
|
|
|
|
files = os.listdir("dist")
|
2022-06-26 22:18:37 -04:00
|
|
|
try:
|
2022-10-07 16:51:40 -04:00
|
|
|
os.mkdir(os.path.join("dist", ".cache"))
|
2022-06-26 22:18:37 -04:00
|
|
|
except FileExistsError as e:
|
|
|
|
print(e)
|
|
|
|
for x in files:
|
|
|
|
try:
|
2022-10-07 16:51:40 -04:00
|
|
|
shutil.move(os.path.join("dist", x), os.path.join("dist", ".cache", x))
|
2022-06-26 22:18:37 -04:00
|
|
|
except FileExistsError as e:
|
|
|
|
print(e)
|
2022-10-07 16:51:40 -04:00
|
|
|
shutil.move(os.path.join("dist", ".cache"), os.path.join("dist", "Pesterchum"))
|
|
|
|
# shutil.copy(os.path.join('build', 'Pesterchum', 'xref-Pesterchum.html'),
|
2022-06-26 22:18:37 -04:00
|
|
|
# os.path.join('dist', 'Pesterchum', 'xref-Pesterchum.html'))
|
2022-10-07 16:51:40 -04:00
|
|
|
# shutil.copy(os.path.join('build', 'Pesterchum', 'Analysis-00.toc'),
|
2022-06-26 22:18:37 -04:00
|
|
|
# os.path.join('dist', 'Pesterchum', 'Analysis-00.toc'))
|
2022-10-07 16:51:40 -04:00
|
|
|
|
2022-06-26 22:18:37 -04:00
|
|
|
else:
|
|
|
|
print("Unknown platform.")
|
2022-10-07 16:51:40 -04:00
|
|
|
|
|
|
|
run_generic = [
|
|
|
|
"pesterchum.py",
|
2022-10-08 08:30:56 -04:00
|
|
|
"--name=Pesterchum",
|
|
|
|
"--clean", # Clear cache
|
2022-06-26 22:18:37 -04:00
|
|
|
]
|
|
|
|
|
2022-10-07 16:51:40 -04:00
|
|
|
if upx_enabled == "y":
|
2022-06-26 22:18:37 -04:00
|
|
|
if os.path.isdir(upx_dir):
|
2022-10-07 16:51:40 -04:00
|
|
|
run_generic.append("--upx-dir=%s" % upx_dir)
|
2022-06-26 22:18:37 -04:00
|
|
|
else:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_generic.append("--noupx")
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in upx_exclude:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_generic.append("--upx-exclude=%s" % x)
|
2022-06-26 22:18:37 -04:00
|
|
|
# Lower case variants are required.
|
2022-10-07 16:51:40 -04:00
|
|
|
run_generic.append("--upx-exclude=%s" % x.lower())
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in exclude_modules:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_generic.append("--exclude-module=%s" % x)
|
2022-06-26 22:18:37 -04:00
|
|
|
for x in add_data:
|
2022-10-07 16:51:40 -04:00
|
|
|
run_generic.append("--add-data=%s" % x.replace(";", ":"))
|
|
|
|
if windowed == "y":
|
|
|
|
run_win32.append("--windowed")
|
|
|
|
|
2022-06-26 22:18:37 -04:00
|
|
|
print(run_generic)
|
2022-10-07 16:51:40 -04:00
|
|
|
|
2022-06-26 22:18:37 -04:00
|
|
|
PyInstaller.__main__.run(run_generic)
|