mirror of
https://github.com/deepspeedai/DeepSpeed.git
synced 2025-10-20 15:33:51 +08:00
Fixup check release version script (#4413)
* Fixup check release version script
This commit is contained in:
@ -8,22 +8,13 @@ from packaging import version as pkg_version
|
|||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
parser.add_argument("--new_version", type=str, help="The new version being published.")
|
parser.add_argument("--release_version", type=str, help="The new version being published.")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
new_version = pkg_version.parse(args.new_version)
|
release_version = pkg_version.parse(args.release_version)
|
||||||
|
|
||||||
with open('./version.txt') as fd:
|
with open('./version.txt') as fd:
|
||||||
current_version = pkg_version.parse(fd.read())
|
repo_version = pkg_version.parse(fd.read())
|
||||||
|
|
||||||
# Valid version are those where the major/minor/micro are incremented by no more than one from the existing release, and the less significant values are reset to 0.
|
assert repo_version == release_version, f"{repo_version=} does not match {release_version=}, unable to proceed"
|
||||||
valid_major_update = pkg_version.Version(f'{current_version.major + 1}.0.0')
|
|
||||||
valid_minor_update = pkg_version.Version(f'{current_version.major}.{current_version.minor + 1}.0')
|
|
||||||
valid_micro_update = pkg_version.Version(
|
|
||||||
f'{current_version.major}.{current_version.minor}.{current_version.micro + 1}')
|
|
||||||
|
|
||||||
valid_versions = [valid_major_update, valid_minor_update, valid_micro_update]
|
|
||||||
|
|
||||||
if new_version not in valid_versions:
|
|
||||||
raise Exception(f'{new_version} is an invalid version. Valid versions are {valid_versions}.\n')
|
|
||||||
|
@ -26,7 +26,7 @@ if [ "${version}" != `cat version.txt` ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "checking that the version is valid"
|
echo "checking that the version is valid"
|
||||||
python release/check_release_version.py --new_version ${version}
|
python release/check_release_version.py --release_version ${version}
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
echo 'please check the version number selected'
|
echo 'please check the version number selected'
|
||||||
exit 1
|
exit 1
|
||||||
|
Reference in New Issue
Block a user