Skip to content

Commit

Permalink
Fix Python 3.9 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
theCapypara committed Jul 30, 2023
1 parent b34a7be commit ec16ecd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion requirements-mac-windows.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ psutil==5.9.5
sentry-sdk==1.22.1
cairocffi<=1.5.1 # https://github.com/Kozea/cairocffi/issues/217
packaging
importlib_metadata>=1.3; python_version < "3.9"
importlib_metadata>=4.6; python_version < "3.10"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ psutil==5.9.5
sentry-sdk==1.22.1
packaging
types-setuptools
importlib_metadata>=1.3; python_version < "3.9"
importlib_metadata>=4.6; python_version < "3.10"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def recursive_pkg_files_in(xpath):
'psutil >= 5.9.0',
'sentry-sdk >= 1.5',
'packaging',
'importlib_metadata>=1.3; python_version < "3.9"'
'importlib_metadata>=4.6; python_version < "3.10"'
],
extras_require={
'discord': ["pypresence >= 4.2.1"],
Expand Down
7 changes: 4 additions & 3 deletions skytemple/core/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

import sys
import logging
from typing import TYPE_CHECKING, Type
from typing import TYPE_CHECKING, Type, Iterable

from typing import Dict

if sys.version_info >= (3, 9):
if sys.version_info >= (3, 10):
import importlib.metadata as importlib_metadata
else:
import importlib_metadata
Expand All @@ -41,12 +41,13 @@ class Modules:
@classmethod
def load(cls):
# Look up package entrypoints for modules
cls._modules = {}
try:
cls._modules = {
entry_point.name:
entry_point.load() for entry_point in importlib_metadata.entry_points().select(group=MODULE_ENTRYPOINT_KEY)
}
except BaseException as ex:
except Exception as ex:
logger.warning("Failed loading modules.", exc_info=ex)

if len(cls._modules) < 1:
Expand Down

0 comments on commit ec16ecd

Please sign in to comment.