Skip to content

Commit 5188e27

Browse files
authored
Fix version parsing with rc release. (dmlc#9493)
1 parent f380c10 commit 5188e27

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

python-package/xgboost/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,11 @@ def _load_lib() -> ctypes.CDLL:
235235

236236
def parse(ver: str) -> Tuple[int, int, int]:
237237
"""Avoid dependency on packaging (PEP 440)."""
238-
# 2.0.0-dev or 2.0.0
238+
# 2.0.0-dev, 2.0.0, or 2.0.0rc1
239239
major, minor, patch = ver.split("-")[0].split(".")
240+
rc = patch.find("rc")
241+
if rc != -1:
242+
patch = patch[:rc]
240243
return int(major), int(minor), int(patch)
241244

242245
libver = _lib_version(lib)

0 commit comments

Comments
 (0)