diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2020-10-06 20:03:04 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-10-06 20:03:04 -0400 |
| commit | f67c1b099d24a37a0c65bf08f88cb46e261d2a61 (patch) | |
| tree | 4c8b3b3b2073df6c608c91917ba89ee6a9d6a743 | |
| parent | 1ea521c51b0ed2967a9ff1d8ad41160043a8a981 (diff) | |
| download | python-setuptools-git-f67c1b099d24a37a0c65bf08f88cb46e261d2a61.tar.gz | |
Extract method for maybe_tag.
| -rw-r--r-- | setuptools/command/egg_info.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index c957154a..0b7ad677 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -123,12 +123,17 @@ class InfoCommon: return safe_name(self.distribution.get_name()) def tagged_version(self): - version = self.distribution.get_version() - # egg_info may be called more than once for a distribution, - # in which case the version string already contains all tags. - if self.vtags and version.endswith(self.vtags): - return safe_version(version) - return safe_version(version + self.vtags) + return safe_version(self._maybe_tag(self.distribution.get_version())) + + def _maybe_tag(self, version): + """ + egg_info may be called more than once for a distribution, + in which case the version string already contains all tags. + """ + return ( + version if self.vtags and version.endswith(self.vtags) + else version + self.vtags + ) def tags(self): version = '' |
