summaryrefslogtreecommitdiff
path: root/setuptools/command/egg_info.py
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2022-03-29 03:37:04 +0100
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2022-03-29 03:37:04 +0100
commitcabdd37db15e306060c1b5edcaeb242c218152f8 (patch)
tree4b502dc16a0b89388ca6ae14494fc1c99a7d0511 /setuptools/command/egg_info.py
parentcc93191764ed8b5de21369eec53aba32e692389c (diff)
downloadpython-setuptools-git-cabdd37db15e306060c1b5edcaeb242c218152f8.tar.gz
Restore tags in egg_info but change the idempotency check
Diffstat (limited to 'setuptools/command/egg_info.py')
-rw-r--r--setuptools/command/egg_info.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index ea47e519..c37ab81f 100644
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -136,14 +136,19 @@ class InfoCommon:
in which case the version string already contains all tags.
"""
return (
- version if self.vtags and version.endswith(self.vtags)
+ version if self.vtags and self._already_tagged(version)
else version + self.vtags
)
- def _safe_tags(self, tags: str) -> str:
+ def _already_tagged(self, version: str) -> bool:
+ # Depending on their format, tags may change with version normalization.
+ # So in addition the regular tags, we have to search for the normalized ones.
+ return version.endswith(self.vtags) or version.endswith(self._safe_tags())
+
+ def _safe_tags(self) -> 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:]
+ return safe_version(f"0{self.vtags}")[1:]
def tags(self) -> str:
version = ''
@@ -151,7 +156,7 @@ class InfoCommon:
version += self.tag_build
if self.tag_date:
version += time.strftime("-%Y%m%d")
- return self._safe_tags(version)
+ return version
vtags = property(tags)