diff --git a/setup.py b/setup.py index 82a9b3e..603f9c2 100644 --- a/setup.py +++ b/setup.py @@ -4,16 +4,20 @@ """ import sys +from distutils.version import LooseVersion +from importlib.metadata import PackageNotFoundError, version -from pkg_resources import VersionConflict, require from setuptools import setup try: - require("setuptools>=38.3") -except VersionConflict: - print("Error: version of setuptools is too old (<38.3)!") + setuptools_version = LooseVersion(version("setuptools")) + required_version = LooseVersion("38.3") + if setuptools_version < required_version: + print("Error: version of setuptools is too old (<38.3)!") + sys.exit(1) +except PackageNotFoundError: + print("setuptools not found") sys.exit(1) - if __name__ == "__main__": setup(use_scm_version=True)