summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2018-03-19 10:08:02 +0100
committerRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2018-03-19 10:08:02 +0100
commit4793406188d8db0983c279f624f37d7d0d16b20f (patch)
tree8a04242361bf30330a11e6011a2d62df39893c02
parent0373c11d2c8968a857ff06c94f101abebf825507 (diff)
downloadsetuptools-scm-4793406188d8db0983c279f624f37d7d0d16b20f.tar.gz
fix #223 - dont depend on SetuptoolsVersion as its dropped in v39
-rw-r--r--CHANGELOG.rst2
-rw-r--r--setuptools_scm/version.py21
2 files changed, 16 insertions, 7 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 703a0ba..e54c8eb 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 e5d5138..a5438c4 100644
--- a/setuptools_scm/version.py
+++ b/setuptools_scm/version.py
@@ -7,15 +7,22 @@ from .utils import trace
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 @@ class ScmVersion(object):
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