Patchwork setup: explain to distutils how we write rc versions

login
register
mail settings
Submitter Paul Morelle
Date Oct. 31, 2018, 8:02 p.m.
Message ID <5f86fca43d2ac438aeb3.1541016121@belenos.localdomain>
Download mbox | patch
Permalink /patch/36296/
State Accepted
Headers show

Comments

Paul Morelle - Oct. 31, 2018, 8:02 p.m.
# HG changeset patch
# User "Paul Morelle <paul.morelle@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.
Gregory Szorc - Oct. 31, 2018, 8:25 p.m.
On Wed, Oct 31, 2018 at 1:14 PM Paul Morelle <paul.morelle@octobus.net>
wrote:

> # HG changeset patch
> # User "Paul Morelle <paul.morelle@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
>

Queued for stable.


>
> 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):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

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