@@ -180,15 +180,23 @@ def main():
180
180
# the package version to before building the dists.
181
181
build_version = expect_version = sys .argv [1 ]
182
182
183
- # '-SNAPSHOT' means we're making a pre-release.
184
- if "-SNAPSHOT" in build_version :
185
- # If there's no +dev already (as is the case on dev
186
- # branches like 7.x, master) then we need to add one.
187
- if not version .endswith ("+dev" ):
183
+ # Any prefixes in the version specifier mean we're making
184
+ # a pre-release which will modify __versionstr__ locally
185
+ # and not produce a git tag.
186
+ if any (x in build_version for x in ("-SNAPSHOT" , "-rc" , "-alpha" , "-beta" )):
187
+ # If a snapshot, then we add '+dev'
188
+ if "-SNAPSHOT" in build_version :
188
189
version = version + "+dev"
189
- expect_version = expect_version .replace ("-SNAPSHOT" , "" )
190
+ # alpha/beta/rc -> aN/bN/rcN
191
+ else :
192
+ pre_number = re .search (r"-(a|b|rc)(?:lpha|eta|)(\d+)$" , expect_version )
193
+ version = version + pre_number .group (1 ) + pre_number .group (2 )
194
+
195
+ expect_version = re .sub (
196
+ r"-(?:SNAPSHOT|alpha\d+|beta\d+|rc\d+)$" , "" , expect_version
197
+ )
190
198
if expect_version .endswith (".x" ):
191
- expect_version = expect_version [:- 2 ]
199
+ expect_version = expect_version [:- 1 ]
192
200
193
201
# For snapshots we ensure that the version in the package
194
202
# at least *starts* with the version. This is to support
0 commit comments