packaging: extract pre-computed version when running from plain tarball stable 5.8rc1
authorJoerg Sonnenberger <joerg@bec.de>
Tue, 20 Apr 2021 20:35:46 +0200
branchstable
changeset 46996 8d2b62d716b0
parent 46995 01264552a1dc
child 46997 106402245301
child 47002 8fc2c867af54
packaging: extract pre-computed version when running from plain tarball The tarballs created by setup.py are not including the usual archive markers that `hg archive` leaves, so the rewrite of the version number computation actually left the empty version string around. This meant that installations from PyPI would use 0.0.0 as version string. Differential Revision: https://phab.mercurial-scm.org/D10502
setup.py
--- a/setup.py	Tue Apr 20 11:12:20 2021 -0400
+++ b/setup.py	Tue Apr 20 20:35:46 2021 +0200
@@ -437,6 +437,9 @@
             version = '%(latesttag)s+hg%(latesttagdistance)s.%(node).12s' % kw
     else:
         version = '0+hg' + kw.get('node', '')[:12]
+elif os.path.exists('mercurial/__version__.py'):
+    data = open('mercurial/__version__.py').read()
+    version = re.search('version = b"(.*)"', data).group(1)
 
 if version:
     versionb = version