Prelim build scripts
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -16,10 +16,13 @@ README.html
|
|||||||
EnemizerCLI/
|
EnemizerCLI/
|
||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
RaceRom.py
|
RaceRom.py
|
||||||
|
upx/
|
||||||
weights/
|
weights/
|
||||||
|
|
||||||
settings.json
|
settings.json
|
||||||
working_dirs.json
|
working_dirs.json
|
||||||
|
|
||||||
|
*.exe
|
||||||
|
|
||||||
venv
|
venv
|
||||||
test
|
test
|
||||||
|
|||||||
12
CLI.py
12
CLI.py
@@ -238,7 +238,7 @@ def parse_arguments(argv, no_defaults=False):
|
|||||||
parser.add_argument('--startinventory', default=defval(settings["startinventory"]), help='Specifies a list of items that will be in your starting inventory (separated by commas)')
|
parser.add_argument('--startinventory', default=defval(settings["startinventory"]), help='Specifies a list of items that will be in your starting inventory (separated by commas)')
|
||||||
parser.add_argument('--usestartinventory', default=defval(settings["usestartinventory"] != 0), help='Not supported.')
|
parser.add_argument('--usestartinventory', default=defval(settings["usestartinventory"] != 0), help='Not supported.')
|
||||||
parser.add_argument('--custom', default=defval(settings["custom"] != 0), help='Not supported.')
|
parser.add_argument('--custom', default=defval(settings["custom"] != 0), help='Not supported.')
|
||||||
parser.add_argument('--customitemarray', default=defval(settings["custom"] != 0), help='Not supported.')
|
parser.add_argument('--customitemarray', default={}, help='Not supported.')
|
||||||
parser.add_argument('--accessibility', default=defval(settings["accessibility"]), const='items', nargs='?', choices=['items', 'locations', 'none'], help='''\
|
parser.add_argument('--accessibility', default=defval(settings["accessibility"]), const='items', nargs='?', choices=['items', 'locations', 'none'], help='''\
|
||||||
Select Item/Location Accessibility. (default: %(default)s)
|
Select Item/Location Accessibility. (default: %(default)s)
|
||||||
Items: You can reach all unique inventory items. No guarantees about
|
Items: You can reach all unique inventory items. No guarantees about
|
||||||
@@ -492,11 +492,15 @@ def get_args_priority(settings_args, gui_args, cli_args):
|
|||||||
args["cli"] = {}
|
args["cli"] = {}
|
||||||
cli = vars(parse_arguments(None))
|
cli = vars(parse_arguments(None))
|
||||||
for k,v in cli.items():
|
for k,v in cli.items():
|
||||||
if isinstance(v,dict):
|
if isinstance(v,dict) and 1 in v:
|
||||||
args["cli"][k] = v[1]
|
args["cli"][k] = v[1]
|
||||||
else:
|
else:
|
||||||
args["cli"][k] = v
|
args["cli"][k] = v
|
||||||
if k not in args["load"] or args["load"][k] != args["cli"]:
|
load_doesnt_have_key = k not in args["load"]
|
||||||
args["load"][k] = args["cli"][k]
|
different_val = (k in args["load"] and k in args["cli"]) and (args["load"][k] != args["cli"][k])
|
||||||
|
cli_has_empty_dict = k in args["cli"] and isinstance(args["cli"][k],dict) and len(args["cli"][k]) == 0
|
||||||
|
if load_doesnt_have_key or different_val:
|
||||||
|
if not cli_has_empty_dict:
|
||||||
|
args["load"][k] = args["cli"][k]
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|||||||
59
DungeonRandomizer.spec
Normal file
59
DungeonRandomizer.spec
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# -*- mode: python -*-
|
||||||
|
|
||||||
|
block_cipher = None
|
||||||
|
console = True
|
||||||
|
|
||||||
|
def recurse_for_py_files(names_so_far):
|
||||||
|
returnvalue = []
|
||||||
|
for name in os.listdir(os.path.join(*names_so_far)):
|
||||||
|
if name != "__pycache__":
|
||||||
|
subdir_name = os.path.join(*names_so_far, name)
|
||||||
|
if os.path.isdir(subdir_name):
|
||||||
|
new_name_list = names_so_far + [name]
|
||||||
|
for filename in os.listdir(os.path.join(*new_name_list)):
|
||||||
|
base_file,file_extension = os.path.splitext(filename)
|
||||||
|
if file_extension == ".py":
|
||||||
|
new_name = ".".join(new_name_list+[base_file])
|
||||||
|
if not new_name in returnvalue:
|
||||||
|
returnvalue.append(new_name)
|
||||||
|
returnvalue.extend(recurse_for_py_files(new_name_list))
|
||||||
|
returnvalue.append("PIL._tkinter_finder") #Linux needs this
|
||||||
|
return returnvalue
|
||||||
|
|
||||||
|
hiddenimports = []
|
||||||
|
|
||||||
|
a = Analysis(['DungeonRandomizer.py'],
|
||||||
|
pathex=[],
|
||||||
|
binaries=[],
|
||||||
|
datas=[],
|
||||||
|
hiddenimports=hiddenimports,
|
||||||
|
hookspath=[],
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
win_no_prefer_redirects=False,
|
||||||
|
win_private_assemblies=False,
|
||||||
|
cipher=block_cipher,
|
||||||
|
noarchive=False)
|
||||||
|
|
||||||
|
# https://stackoverflow.com/questions/17034434/how-to-remove-exclude-modules-and-files-from-pyinstaller
|
||||||
|
excluded_binaries = [
|
||||||
|
'VCRUNTIME140.dll',
|
||||||
|
'msvcp140.dll',
|
||||||
|
'mfc140u.dll']
|
||||||
|
a.binaries = TOC([x for x in a.binaries if x[0] not in excluded_binaries])
|
||||||
|
|
||||||
|
pyz = PYZ(a.pure, a.zipped_data,
|
||||||
|
cipher=block_cipher)
|
||||||
|
exe = EXE(pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.zipfiles,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='DungeonRandomizer',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=console ) # <--- change this to True to enable command prompt when the app runs
|
||||||
59
Gui.spec
Normal file
59
Gui.spec
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# -*- mode: python -*-
|
||||||
|
|
||||||
|
block_cipher = None
|
||||||
|
console = True
|
||||||
|
|
||||||
|
def recurse_for_py_files(names_so_far):
|
||||||
|
returnvalue = []
|
||||||
|
for name in os.listdir(os.path.join(*names_so_far)):
|
||||||
|
if name != "__pycache__":
|
||||||
|
subdir_name = os.path.join(*names_so_far, name)
|
||||||
|
if os.path.isdir(subdir_name):
|
||||||
|
new_name_list = names_so_far + [name]
|
||||||
|
for filename in os.listdir(os.path.join(*new_name_list)):
|
||||||
|
base_file,file_extension = os.path.splitext(filename)
|
||||||
|
if file_extension == ".py":
|
||||||
|
new_name = ".".join(new_name_list+[base_file])
|
||||||
|
if not new_name in returnvalue:
|
||||||
|
returnvalue.append(new_name)
|
||||||
|
returnvalue.extend(recurse_for_py_files(new_name_list))
|
||||||
|
returnvalue.append("PIL._tkinter_finder") #Linux needs this
|
||||||
|
return returnvalue
|
||||||
|
|
||||||
|
hiddenimports = []
|
||||||
|
|
||||||
|
a = Analysis(['Gui.py'],
|
||||||
|
pathex=[],
|
||||||
|
binaries=[],
|
||||||
|
datas=[],
|
||||||
|
hiddenimports=hiddenimports,
|
||||||
|
hookspath=[],
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
win_no_prefer_redirects=False,
|
||||||
|
win_private_assemblies=False,
|
||||||
|
cipher=block_cipher,
|
||||||
|
noarchive=False)
|
||||||
|
|
||||||
|
# https://stackoverflow.com/questions/17034434/how-to-remove-exclude-modules-and-files-from-pyinstaller
|
||||||
|
excluded_binaries = [
|
||||||
|
'VCRUNTIME140.dll',
|
||||||
|
'msvcp140.dll',
|
||||||
|
'mfc140u.dll']
|
||||||
|
a.binaries = TOC([x for x in a.binaries if x[0] not in excluded_binaries])
|
||||||
|
|
||||||
|
pyz = PYZ(a.pure, a.zipped_data,
|
||||||
|
cipher=block_cipher)
|
||||||
|
exe = EXE(pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.zipfiles,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='Gui',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=console ) # <--- change this to True to enable command prompt when the app runs
|
||||||
2
Utils.py
2
Utils.py
@@ -34,6 +34,8 @@ def is_bundled():
|
|||||||
return getattr(sys, 'frozen', False)
|
return getattr(sys, 'frozen', False)
|
||||||
|
|
||||||
def local_path(path):
|
def local_path(path):
|
||||||
|
return path
|
||||||
|
|
||||||
if local_path.cached_path is not None:
|
if local_path.cached_path is not None:
|
||||||
return os.path.join(local_path.cached_path, path)
|
return os.path.join(local_path.cached_path, path)
|
||||||
|
|
||||||
|
|||||||
21
build-dr.py
Normal file
21
build-dr.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
DEST_DIRECTORY = '.'
|
||||||
|
|
||||||
|
if os.path.isdir("upx"):
|
||||||
|
upx_string = "--upx-dir=upx"
|
||||||
|
else:
|
||||||
|
upx_string = ""
|
||||||
|
|
||||||
|
if os.path.isdir("build"):
|
||||||
|
shutil.rmtree("build")
|
||||||
|
|
||||||
|
subprocess.run(" ".join(["pyinstaller DungeonRandomizer.spec ",
|
||||||
|
upx_string,
|
||||||
|
"-y ",
|
||||||
|
"--onefile ",
|
||||||
|
f"--distpath {DEST_DIRECTORY} ",
|
||||||
|
]),
|
||||||
|
shell=True)
|
||||||
21
build-gui.py
Normal file
21
build-gui.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
DEST_DIRECTORY = '.'
|
||||||
|
|
||||||
|
if os.path.isdir("upx"):
|
||||||
|
upx_string = "--upx-dir=upx"
|
||||||
|
else:
|
||||||
|
upx_string = ""
|
||||||
|
|
||||||
|
if os.path.isdir("build"):
|
||||||
|
shutil.rmtree("build")
|
||||||
|
|
||||||
|
subprocess.run(" ".join(["pyinstaller Gui.spec ",
|
||||||
|
upx_string,
|
||||||
|
"-y ",
|
||||||
|
"--onefile ",
|
||||||
|
f"--distpath {DEST_DIRECTORY} ",
|
||||||
|
]),
|
||||||
|
shell=True)
|
||||||
Reference in New Issue
Block a user