setup: honor build automation ...

... and reorder imports to PEP it up
This commit is contained in:
black-sliver 2023-01-30 01:47:28 +01:00
parent ea2175cb8a
commit 428344b6bc
1 changed files with 21 additions and 18 deletions

View File

@ -10,27 +10,12 @@ import zipfile
from collections.abc import Iterable
from hashlib import sha3_512
from pathlib import Path
if __name__ == "__main__":
import ModuleUpdate
ModuleUpdate.update()
from Launcher import components, icon_paths
from Utils import version_tuple, is_windows, is_linux
# On Python < 3.10 LogicMixin is not currently supported.
apworlds: set = {
"Subnautica",
"Factorio",
"Rogue Legacy",
}
# This is a bit jank. We need cx-Freeze to be able to run anything from this script, so install it
import subprocess
import pkg_resources
requirement = 'cx-Freeze>=6.14.1'
# This is a bit jank. We need cx-Freeze to be able to run anything from this script, so install it
try:
requirement = 'cx-Freeze>=6.14.1'
pkg_resources.require(requirement)
import cx_Freeze
except pkg_resources.ResolutionError:
@ -42,6 +27,24 @@ except pkg_resources.ResolutionError:
# .build only exists if cx-Freeze is the right version, so we have to update/install that first before this line
import setuptools.command.build
if __name__ == "__main__":
# need to run this early to import from Utils and Launcher
# TODO: move stuff to not require this
import ModuleUpdate
ModuleUpdate.update(yes="--yes" in sys.argv or "-y" in sys.argv)
ModuleUpdate.update_ran = False # restore for later
from Launcher import components, icon_paths
from Utils import version_tuple, is_windows, is_linux
# On Python < 3.10 LogicMixin is not currently supported.
apworlds: set = {
"Subnautica",
"Factorio",
"Rogue Legacy",
}
if os.path.exists("X:/pw.txt"):
print("Using signtool")
with open("X:/pw.txt", encoding="utf-8-sig") as f: