diff --git a/setup.cfg b/setup.cfg index dd25e90..7b806d9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,6 +6,7 @@ long_description_content_type = text/markdown url = https://github.com/pylast/pylast author = Amr Hassan and Contributors author_email = amr.hassan@gmail.com +maintainer = Hugo van Kemenade license = Apache-2.0 license_file = LICENSE.txt classifiers = @@ -31,6 +32,8 @@ keywords = [options] packages = find: +install_requires = + importlib-metadata;python_version < '3.8' python_requires = >=3.6 package_dir = =src setup_requires = diff --git a/src/pylast/__init__.py b/src/pylast/__init__.py index c24cd43..43cecce 100644 --- a/src/pylast/__init__.py +++ b/src/pylast/__init__.py @@ -33,13 +33,18 @@ from http.client import HTTPSConnection from urllib.parse import quote_plus from xml.dom import Node, minidom -import pkg_resources +try: + # Python 3.8+ + import importlib.metadata as importlib_metadata +except ImportError: + # Python 3.7 and lower + import importlib_metadata __author__ = "Amr Hassan, hugovk, Mice Pápai" __copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2021 hugovk, 2017 Mice Pápai" __license__ = "apache2" __email__ = "amr.hassan@gmail.com" -__version__ = pkg_resources.get_distribution(__name__).version +__version__ = importlib_metadata.version(__name__) # 1 : This error does not exist