Fix issue with importlib.resources.files() and Python 3.9

This commit is contained in:
grossmj 2023-09-23 20:44:00 +10:00
parent f675f24ba7
commit 999a47f747
2 changed files with 2 additions and 2 deletions

View File

@ -295,7 +295,7 @@ class Controller:
if not os.path.exists(os.path.join(dst_path, filename)):
shutil.copy(os.path.join(resource_path, filename), os.path.join(dst_path, filename))
else:
for entry in importlib_resources.files(f'gns3server.{resource_name}').iterdir():
for entry in importlib_resources.files('gns3server').joinpath(resource_name).iterdir():
full_path = os.path.join(dst_path, entry.name)
if entry.is_file() and not os.path.exists(full_path):
log.debug(f'Installing {resource_name} resource file "{entry.name}" to "{full_path}"')

View File

@ -12,7 +12,7 @@ async-timeout>=4.0.2,<4.1
distro>=1.8.0
py-cpuinfo>=9.0.0,<10.0
platformdirs>=2.4.0
importlib-resources>=1.3; python_version <= '3.9'
importlib-resources>=1.3; python_version < '3.9'
truststore>=0.8.0; python_version >= '3.10'
setuptools>=60.8.1; python_version >= '3.7'
setuptools==59.6.0; python_version < '3.7' # v59.6.0 is the last version to support Python 3.6