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
--- 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