From ebc5f3eed8e75ef5980bb4afdfde066f8480e9b9 Mon Sep 17 00:00:00 2001 From: Branch Vincent Date: Mon, 4 Dec 2023 05:55:33 -0800 Subject: [PATCH] deps: require `importlib-resources` for < 3.9 (#491) --- examples/python-rom-package/roms/__init__.py | 6 +++--- pyproject.toml | 2 +- src/python/scripts/import_roms.py | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/python-rom-package/roms/__init__.py b/examples/python-rom-package/roms/__init__.py index f9b918023..95436eefd 100644 --- a/examples/python-rom-package/roms/__init__.py +++ b/examples/python-rom-package/roms/__init__.py @@ -1,10 +1,10 @@ import sys import pathlib -if sys.version_info < (3, 8): - import importlib_resources as resources -else: +if sys.version_info >= (3, 9): import importlib.resources as resources +else: + import importlib_resources as resources from typing import List diff --git a/pyproject.toml b/pyproject.toml index 0e8b815d3..69d172cf3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ classifiers = [ dependencies = [ "numpy", "importlib-metadata>=4.10.0; python_version < '3.10'", - "importlib-resources", + "importlib-resources; python_version < '3.9'", "typing-extensions; python_version < '3.11'" ] dynamic = ["version"] diff --git a/src/python/scripts/import_roms.py b/src/python/scripts/import_roms.py index b8f9dc582..14a71e266 100644 --- a/src/python/scripts/import_roms.py +++ b/src/python/scripts/import_roms.py @@ -6,7 +6,11 @@ from typing import Optional import ale_py -import importlib_resources as resources + +if sys.version_info >= (3, 9): + import importlib.resources as resources +else: + import importlib_resources as resources def import_roms(