From b1f729a9704c8de297cf253bb50930bb99b54c1f Mon Sep 17 00:00:00 2001 From: Duck <31627079+duckboycool@users.noreply.github.com> Date: Thu, 31 Jul 2025 14:33:56 -0600 Subject: [PATCH] Core: Remove Checks for Unsupported Versions (#5067) * Remove redundant version checks/compatibility * Change windows7 check * Edit comments Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> --------- Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com> --- Options.py | 2 +- Utils.py | 3 +-- setup.py | 10 +++------- test/benchmark/locations.py | 11 +++-------- worlds/__init__.py | 4 +--- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/Options.py b/Options.py index 3e67d685..47d6c2d3 100644 --- a/Options.py +++ b/Options.py @@ -1118,7 +1118,7 @@ class PlandoConnection(typing.NamedTuple): entrance: str exit: str - direction: typing.Literal["entrance", "exit", "both"] # TODO: convert Direction to StrEnum once 3.8 is dropped + direction: typing.Literal["entrance", "exit", "both"] # TODO: convert Direction to StrEnum once 3.10 is dropped percentage: int = 100 diff --git a/Utils.py b/Utils.py index abf359f4..b7616b57 100644 --- a/Utils.py +++ b/Utils.py @@ -953,8 +953,7 @@ def _extend_freeze_support() -> None: # Handle the first process that MP will create if ( len(sys.argv) >= 2 and sys.argv[-2] == '-c' and sys.argv[-1].startswith(( - 'from multiprocessing.semaphore_tracker import main', # Py<3.8 - 'from multiprocessing.resource_tracker import main', # Py>=3.8 + 'from multiprocessing.resource_tracker import main', 'from multiprocessing.forkserver import main' )) and set(sys.argv[1:-2]) == set(_args_from_interpreter_flags()) ): diff --git a/setup.py b/setup.py index 704325d7..c24a4435 100644 --- a/setup.py +++ b/setup.py @@ -61,7 +61,6 @@ from Utils import version_tuple, is_windows, is_linux from Cython.Build import cythonize -# On Python < 3.10 LogicMixin is not currently supported. non_apworlds: set[str] = { "A Link to the Past", "Adventure", @@ -78,9 +77,6 @@ non_apworlds: set[str] = { "Wargroove", } -# LogicMixin is broken before 3.10 import revamp -if sys.version_info < (3,10): - non_apworlds.add("Hollow Knight") def download_SNI() -> None: print("Updating SNI") @@ -108,8 +104,8 @@ def download_SNI() -> None: # prefer "many" builds if "many" in download_url: break - # prefer the correct windows or windows7 build - if platform_name == "windows" and ("windows7" in download_url) == (sys.version_info < (3, 9)): + # prefer non-windows7 builds to get up-to-date dependencies + if platform_name == "windows" and "windows7" not in download_url: break if source_url and source_url.endswith(".zip"): @@ -418,7 +414,7 @@ class BuildExeCommand(cx_Freeze.command.build_exe.build_exe): if is_windows: # Inno setup stuff with open("setup.ini", "w") as f: - min_supported_windows = "6.2.9200" if sys.version_info > (3, 9) else "6.0.6000" + min_supported_windows = "6.2.9200" f.write(f"[Data]\nsource_path={self.buildfolder}\nmin_windows={min_supported_windows}\n") with open("installdelete.iss", "w") as f: f.writelines("Type: filesandordirs; Name: \"{app}\\lib\\worlds\\"+world_directory+"\"\n" diff --git a/test/benchmark/locations.py b/test/benchmark/locations.py index 16667a17..0e496cd3 100644 --- a/test/benchmark/locations.py +++ b/test/benchmark/locations.py @@ -29,14 +29,9 @@ def run_locations_benchmark(): rule_iterations: int = 100_000 - if sys.version_info >= (3, 9): - @staticmethod - def format_times_from_counter(counter: collections.Counter[str], top: int = 5) -> str: - return "\n".join(f" {time:.4f} in {name}" for name, time in counter.most_common(top)) - else: - @staticmethod - def format_times_from_counter(counter: collections.Counter, top: int = 5) -> str: - return "\n".join(f" {time:.4f} in {name}" for name, time in counter.most_common(top)) + @staticmethod + def format_times_from_counter(counter: collections.Counter[str], top: int = 5) -> str: + return "\n".join(f" {time:.4f} in {name}" for name, time in counter.most_common(top)) def location_test(self, test_location: Location, state: CollectionState, state_name: str) -> float: with TimeIt(f"{test_location.game} {self.rule_iterations} " diff --git a/worlds/__init__.py b/worlds/__init__.py index 80240275..89f7bcd0 100644 --- a/worlds/__init__.py +++ b/worlds/__init__.py @@ -63,9 +63,7 @@ class WorldSource: sys.modules[mod.__name__] = mod with warnings.catch_warnings(): warnings.filterwarnings("ignore", message="__package__ != __spec__.parent") - # Found no equivalent for < 3.10 - if hasattr(importer, "exec_module"): - importer.exec_module(mod) + importer.exec_module(mod) else: importlib.import_module(f".{self.path}", "worlds") self.time_taken = time.perf_counter()-start