diff --git a/doc/source/conf.py b/doc/source/conf.py index 814f295..d9781e8 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -18,8 +18,7 @@ import os import sys - -from pkg_resources import get_distribution +from importlib.metadata import version as get_version # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -61,7 +60,7 @@ # built documents. # # get version using setuptools-scm -release = get_distribution("pydecorate").version +release = get_version("pydecorate") # The full version, including alpha/beta/rc tags. # for example take major/minor version = ".".join(release.split(".")[:2]) diff --git a/pydecorate/decorator_agg.py b/pydecorate/decorator_agg.py index ba3514e..2fcbd94 100644 --- a/pydecorate/decorator_agg.py +++ b/pydecorate/decorator_agg.py @@ -17,11 +17,14 @@ # along with this program. If not, see . """Aggdraw-based image decoration class.""" +from pathlib import Path + import aggdraw -from pkg_resources import resource_filename from pydecorate.decorator_base import DecoratorBase +HERE = Path(__file__).parent + class DecoratorAGG(DecoratorBase): """Aggdraw-based image decoration class.""" @@ -30,8 +33,8 @@ def add_scale(self, colormap, **kwargs): self._add_scale(colormap, **kwargs) def _load_default_font(self): - font_path = resource_filename("pydecorate.fonts", "DejaVuSerif.ttf") - return aggdraw.Font("black", font_path, size=16) + font_path = HERE / "fonts" / "DejaVuSerif.ttf" + return aggdraw.Font("black", font_path.as_posix(), size=16) def _load_font(self): try: diff --git a/pydecorate/fonts/__init__.py b/pydecorate/fonts/__init__.py index d47c660..e69de29 100644 --- a/pydecorate/fonts/__init__.py +++ b/pydecorate/fonts/__init__.py @@ -1 +0,0 @@ -# Need this directory to be a module so that pkg_resources.resource_filename properly finds it diff --git a/setup.py b/setup.py index 5982f66..bebfa05 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,7 @@ packages=["pydecorate"], include_package_data=True, package_data={"pydecorate": ["fonts/*.ttf"]}, - install_requires=["pillow", "aggdraw", "numpy", "setuptools"], + install_requires=["pillow", "aggdraw", "numpy"], setup_requires=["setuptools_scm", "setuptools_scm_git_archive"], scripts=[], data_files=[],