[PATCH] setup: explain to distutils how we write rc versions

Paul Morelle paul.morelle at octobus.net
Wed Oct 31 20:02:01 UTC 2018


# HG changeset patch
# User "Paul Morelle <paul.morelle at octobus.net"
# Date 1541014362 -3600
#      Wed Oct 31 20:32:42 2018 +0100
# Node ID 5f86fca43d2ac438aeb3e482fc713906947f2abd
# Parent  5e5c8f2a1eb5f050a7d13b6f1b6a21fbc2fd1b65
# EXP-Topic rc-versions
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 5f86fca43d2a
setup: explain to distutils how we write rc versions

When we use a rc version number (e.g. 4.8rc0), bdist_msi is using
distutils.StrictVersion to parse it into a tuple of numbers.
By default, StrictVersion.version_re only recognizes [ab] for alpha/beta,
where mercurial may use '-rc' or 'rc'.
This change makes StrictVersion parse correctly our version numbers, so that
bdist_msi doesn't fail on rc versions.

diff -r 5e5c8f2a1eb5 -r 5f86fca43d2a setup.py
--- a/setup.py	Tue Oct 23 21:11:13 2018 +0900
+++ b/setup.py	Wed Oct 31 20:32:42 2018 +0100
@@ -168,6 +168,9 @@
 from distutils.sysconfig import get_python_inc, get_config_var
 from distutils.version import StrictVersion
 
+# Explain to distutils.StrictVersion how our release candidates are versionned
+StrictVersion.version_re = re.compile(r'^(\d+)\.(\d+)(\.(\d+))?-?(rc(\d+))?$')
+
 def write_if_changed(path, content):
     """Write content to a file iff the content hasn't changed."""
     if os.path.exists(path):


More information about the Mercurial-devel mailing list