[Request] [+ ] D10502: packaging: extract pre-computed version when running from plain tarball

joerg.sonnenberger (Joerg Sonnenberger) phabricator at mercurial-scm.org
Tue Apr 20 18:36:37 UTC 2021


joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The tarballs created by setup.py are not including the usual archive
  markers as `hg export` 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.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D10502

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -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



To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210420/2b207dfb/attachment.html>


More information about the Mercurial-patches mailing list