changeset 46996:8d2b62d716b0 stable 5.8rc1

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
author Joerg Sonnenberger <joerg@bec.de>
date Tue, 20 Apr 2021 20:35:46 +0200
parents 01264552a1dc
children 106402245301 8fc2c867af54
files setup.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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