summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2022-03-29 03:03:34 +0100
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2022-03-29 03:03:34 +0100
commitcc93191764ed8b5de21369eec53aba32e692389c (patch)
treea116ab27bab79b2282b8aa72030113310b16bb80
parent8bfc5f7164defc24386531e3f45cd223d4e275ba (diff)
downloadpython-setuptools-git-cc93191764ed8b5de21369eec53aba32e692389c.tar.gz
Fix duplicated version tags in egg_info
Previously egg_info was adding duplicated tags to the version string. This was happening because of the version normalization. When the version normalization was applied to the string the tag was modified, then later egg_info could no longer recognize it before applying. The fix for this problem was to normalize the tag string before applying.
-rw-r--r--setuptools/command/egg_info.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 63389654..ea47e519 100644
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -140,13 +140,18 @@ class InfoCommon:
else version + self.vtags
)
- def tags(self):
+ def _safe_tags(self, tags: str) -> str:
+ # To implement this we can rely on `safe_version` pretending to be version 0
+ # followed by tags. Then we simply discard the starting 0 (fake version number)
+ return safe_version(f"0{tags}")[1:]
+
+ def tags(self) -> str:
version = ''
if self.tag_build:
version += self.tag_build
if self.tag_date:
version += time.strftime("-%Y%m%d")
- return version
+ return self._safe_tags(version)
vtags = property(tags)