Skip to content

Commit 6aba843

Browse files
committed
Update build-dists to support all Elastic version specifiers
1 parent b7ebead commit 6aba843

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

elasticsearch/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
__versionstr__ = "8.0.0+dev"
18+
__versionstr__ = "8.0.0"

utils/build-dists.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,23 @@ def main():
180180
# the package version to before building the dists.
181181
build_version = expect_version = sys.argv[1]
182182

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:
188189
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+
)
190198
if expect_version.endswith(".x"):
191-
expect_version = expect_version[:-2]
199+
expect_version = expect_version[:-1]
192200

193201
# For snapshots we ensure that the version in the package
194202
# at least *starts* with the version. This is to support

0 commit comments

Comments
 (0)