@@ -640,17 +640,20 @@ def get_version(root, **kwargs):
640640 'git describe --dirty --tags --long --match "apache-arrow-[0-9].*"'
641641 )
642642 version = parse_git_version (root , ** kwargs )
643-
644- # increment the minor version, because there can be patch releases created
645- # from maintenance branches where the tags are unreachable from the
646- # master's HEAD, so the git command above generates 0.17.0.dev300 even if
647- # arrow has a never 0.17.1 patch release
648- pattern = r"^(\d+)\.(\d+)\.(\d+)$"
649- match = re .match (pattern , str (version .tag ))
643+ tag = str (version .tag )
644+
645+ # We may get a development tag for the next version, such as "5.0.0.dev0",
646+ # or the tag of an already released version, such as "4.0.0".
647+ # In the latter case, we need to increment the version so that the computed
648+ # version comes after any patch release (the next feature version after
649+ # 4.0.0 is 5.0.0).
650+ pattern = r"^(\d+)\.(\d+)\.(\d+)"
651+ match = re .match (pattern , tag )
650652 major , minor , patch = map (int , match .groups ())
653+ if 'dev' not in tag :
654+ major += 1
651655
652- # the bumped version number after 0.17.x will be 0.18.0.dev300
653- return "{}.{}.{}.dev{}" .format (major , minor + 1 , patch , version .distance )
656+ return "{}.{}.{}.dev{}" .format (major , minor , patch , version .distance )
654657
655658
656659class Serializable :
0 commit comments