Skip to content

Commit a77001a

Browse files
committed
python: ttfautohint: Python 3.12 support
Since python 3.12, pkg_resources has been moved to setuptools. Also, it is deprecated. - Kozea/Radicale#1184 - mu-editor/mu#2485 - python/cpython#95299 $ python -m ttfautohint --help Traceback (most recent call last): File "/usr/lib/python3.12/site-packages/ttfautohint/_version.py", line 2, in <module> from pkg_resources import get_distribution, DistributionNotFound ModuleNotFoundError: No module named 'pkg_resources' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<frozen runpy>", line 189, in _run_module_as_main File "<frozen runpy>", line 148, in _get_module_details File "<frozen runpy>", line 112, in _get_module_details File "/usr/lib/python3.12/site-packages/ttfautohint/__init__.py", line 12, in <module> from ttfautohint._version import __version__ File "/usr/lib/python3.12/site-packages/ttfautohint/_version.py", line 4, in <module> except (ImportError, DistributionNotFound): ^^^^^^^^^^^^^^^^^^^^ NameError: name 'DistributionNotFound' is not defined Signed-off-by: Shohei Maruyama <[email protected]>
1 parent 5b66ad2 commit a77001a

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/python/ttfautohint/_version.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
try:
2-
from pkg_resources import get_distribution, DistributionNotFound
3-
__version__ = get_distribution("ttfautohint-py").version
4-
except (ImportError, DistributionNotFound):
5-
# either pkg_resources is missing or package is not installed
6-
import warnings
7-
warnings.warn(
8-
"'ttfautohint-py' is missing the required distribution metadata. "
9-
"Please make sure it was installed correctly.", UserWarning,
10-
stacklevel=2)
11-
__version__ = "0.0.0"
1+
from importlib import metadata
2+
3+
__version__ = metadata.version("ttfautohint-py")

0 commit comments

Comments
 (0)