From patchwork Tue Apr 20 18:36:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D10502: packaging: extract pre-computed version when running from plain tarball From: phabricator X-Patchwork-Id: 48819 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Tue, 20 Apr 2021 18:36:37 +0000 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 To: joerg.sonnenberger, #hg-reviewers Cc: mercurial-patches, mercurial-devel 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