This is an automated email from the ASF dual-hosted git repository.

kszucs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new fd1c63e  ARROW-9014: [Packaging] Bump the minor part of the 
automatically generated version in crossbow
fd1c63e is described below

commit fd1c63e11bcc51ef2040ddeabcf095d356e96194
Author: Krisztián Szűcs <[email protected]>
AuthorDate: Fri Jun 5 16:36:34 2020 +0200

    ARROW-9014: [Packaging] Bump the minor part of the automatically generated 
version in crossbow
    
    Crossbow uses setuptools_scm to generate a development version number using 
git describe command. This means that it finds the latest reachable tag from 
the current commit on master.
    
    The minor releases are created from the master branch whereas the patch 
release tags point to commits on maintenance branches (like 0.17.x) which means 
that if we already have released a patch version, like 0.17.1 then crossbow 
generates a version number like 0.17.0.dev
    {number-of-commits-from-0.17.0}
    and bumps its patch tag, eventually creating binary packages with version 
0.17.1.dev123.
    
    The main problem with this is that the produced nightly python wheels are 
not picked up by pip, because on pypi we already have that patch release 
available and pip doesn't consider 0.17.1.dev123 newer than 0.17.1 (with --pre 
option passed).
    
    So to force pip to install the newer nightly packages we need to bump the 
minor version instead.
    
    Closes #7327 from kszucs/crossbow-bump-minor-version
    
    Authored-by: Krisztián Szűcs <[email protected]>
    Signed-off-by: Krisztián Szűcs <[email protected]>
---
 dev/tasks/crossbow.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/dev/tasks/crossbow.py b/dev/tasks/crossbow.py
index a657a8d..adabe66 100755
--- a/dev/tasks/crossbow.py
+++ b/dev/tasks/crossbow.py
@@ -700,13 +700,23 @@ def get_version(root, **kwargs):
     subprojects, e.g. apache-arrow-js-XXX tags.
     """
     from setuptools_scm.git import parse as parse_git_version
-    from setuptools_scm.version import guess_next_version
 
+    # query the calculated version based on the git tags
     kwargs['describe_command'] = (
         'git describe --dirty --tags --long --match "apache-arrow-[0-9].*"'
     )
     version = parse_git_version(root, **kwargs)
-    return version.format_next_version(guess_next_version)
+
+    # increment the minor version, because there can be patch releases created
+    # from maintenance branches where the tags are unreachable from the
+    # master's HEAD, so the git command above generates 0.17.0.dev300 even if
+    # arrow has a never 0.17.1 patch release
+    pattern = r"^(\d+)\.(\d+)\.(\d+)$"
+    match = re.match(pattern, str(version.tag))
+    major, minor, patch = map(int, match.groups())
+
+    # the bumped version number after 0.17.x will be 0.18.0.dev300
+    return "{}.{}.{}.dev{}".format(major, minor + 1, patch, version.distance)
 
 
 class Serializable:

Reply via email to