diff --git a/Lib/gfsubsets/__init__.py b/Lib/gfsubsets/__init__.py index 0279332..190a8ab 100644 --- a/Lib/gfsubsets/__init__.py +++ b/Lib/gfsubsets/__init__.py @@ -7,12 +7,14 @@ import re import sys import warnings -from importlib import resources +# importlib.resources.files only available since Python>3.9, +# temporarily use backport +from importlib_resources import files from fontTools import ttLib from . import subsets -nam_files = resources.files("gfsubsets.data") +nam_files = files("gfsubsets.data") class NamFileDict(dict): diff --git a/Lib/gfsubsets/subsets.py b/Lib/gfsubsets/subsets.py index 7f6f94f..279ecd8 100644 --- a/Lib/gfsubsets/subsets.py +++ b/Lib/gfsubsets/subsets.py @@ -15,10 +15,12 @@ # limitations under the License. # import os -from importlib import resources +# importlib.resources.files only available since Python>3.9, +# temporarily use backport +from importlib_resources import files subset_files = [resource.name for resource - in resources.files("gfsubsets.data").iterdir() + in files("gfsubsets.data").iterdir() if resource.name.endswith("_unique-glyphs.nam")] SUBSETS = sorted( diff --git a/pyproject.toml b/pyproject.toml index 7000b00..13c5359 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,6 +19,15 @@ authors = [ {name = 'Garret Rieger', email = "grieger@google.com" }, {name = 'Roderick Sheeter', email = "rsheeter@google.com" } ] +dependencies = [ + "importlib_resources" # Backport for Python < 3.9 +] + +[project.optional-dependencies] +dev = [ + "youseedee" +] + [tool.setuptools.package-dir] gfsubsets = "Lib/gfsubsets"