diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 703a0bae..e54c8ebd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -8,6 +8,8 @@ v1.16.0 * avoid shlex.split on windows * fix #218 - better handling of mercurial edge-cases with tag commits being considered as the tagged commit +* fix #223 - remove the dependency on the interal SetupttoolsVersion + as it was removed after long-standing deprecation v1.15.7 ====== diff --git a/setuptools_scm/version.py b/setuptools_scm/version.py index e5d51380..a5438c4a 100644 --- a/setuptools_scm/version.py +++ b/setuptools_scm/version.py @@ -7,15 +7,22 @@ from pkg_resources import iter_entry_points from distutils import log +from pkg_resources import parse_version -try: - from pkg_resources import parse_version, SetuptoolsVersion -except ImportError as e: - parse_version = SetuptoolsVersion = None + +def _get_version_class(): + modern_version = parse_version("1.0") + if isinstance(modern_version, tuple): + return None + else: + return type(modern_version) + + +VERSION_CLASS = _get_version_class() def _warn_if_setuptools_outdated(): - if parse_version is None: + if VERSION_CLASS is None: log.warn("your setuptools is too old (<12)") log.warn("setuptools_scm functionality is degraded") @@ -44,7 +51,7 @@ def tag_to_version(tag): return version version = parse_version(version) trace('version', repr(version)) - if isinstance(version, SetuptoolsVersion): + if isinstance(version, VERSION_CLASS): return version @@ -92,7 +99,7 @@ def format_choice(self, clean_format, dirty_format): def _parse_tag(tag, preformatted): if preformatted: return tag - if SetuptoolsVersion is None or not isinstance(tag, SetuptoolsVersion): + if VERSION_CLASS is None or not isinstance(tag, VERSION_CLASS): tag = tag_to_version(tag) return tag