Python 3.8 support for importlib.resources.files

This commit is contained in:
Itamar Turner-Trauring 2023-11-17 11:26:52 -05:00
parent e6630b59f7
commit 57534facc5
2 changed files with 9 additions and 1 deletions

View File

@ -32,6 +32,9 @@ VERSION_PY_FILENAME = 'src/allmydata/_version.py'
version = read_version_py(VERSION_PY_FILENAME)
install_requires = [
# importlib.resources.files and friends are new in Python 3.9.
"importlib_resources; python_version < '3.9'",
"zfec >= 1.1.0",
# zope.interface >= 3.6.0 is required for Twisted >= 12.1.0.

View File

@ -4,7 +4,12 @@ Ported to Python 3.
from __future__ import annotations
from six import ensure_str
try:
from importlib.resources import files as resource_files, as_file
except ImportError:
import sys
assert sys.version_info[:2] < (3, 9)
from importlib_resources import files as resource_files, as_file
from contextlib import ExitStack
import weakref
from typing import Optional, Union, TypeVar, overload