From cc93191764ed8b5de21369eec53aba32e692389c Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Tue, 29 Mar 2022 03:03:34 +0100 Subject: 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. --- setuptools/command/egg_info.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'setuptools/command') 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) -- cgit v1.2.1