From f0170b9c21cf7c740b93ead98fc7962c623e9b6b Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Thu, 25 Feb 2021 14:26:02 +0800 Subject: [PATCH] fix(whl): opt whl version example: 1:export PUBLIC_VERSION_POSTFIX=rc1 for create a rc1 version 2:export PUBLIC_VERSION_POSTFIX=dev20210225 for create daily version 3:export PUBLIC_VERSION_POSTFIX=rc1.dev20210225 and export LOCAL_VERSION=mc40 for create special version GitOrigin-RevId: 8caa7646d0ca6f6d7b91081b2a68a21a75ccab9e --- imperative/python/setup.py | 14 +++++++++++--- scripts/whl/BUILD_PYTHON_WHL_README.md | 2 +- scripts/whl/manylinux2014/build_wheel_common.sh | 1 + 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/imperative/python/setup.py b/imperative/python/setup.py index 1d140698..47677f77 100644 --- a/imperative/python/setup.py +++ b/imperative/python/setup.py @@ -47,11 +47,19 @@ with open("megengine/version.py") as fp: __version__ = v['__version__'] email = 'megengine@megvii.com' -local_version = os.environ.get('LOCAL_VERSION') -if local_version: - __version__ = '{}{}'.format(__version__, local_version) +# https://www.python.org/dev/peps/pep-0440 +# Public version identifiers: [N!]N(.N)*[{a|b|rc}N][.postN][.devN] +# PUBLIC_VERSION_POSTFIX use to handle rc or dev info +public_version_postfix = os.environ.get('PUBLIC_VERSION_POSTFIX') +if public_version_postfix: + __version__ = '{}{}'.format(__version__, public_version_postfix) sdk_name = os.environ.get('SDK_NAME', 'cpu') __version__ = '{}+{}'.format(__version__, sdk_name) +# Local version identifiers: [+] +# reserved for special whl package +local_version = os.environ.get('LOCAL_VERSION') +if local_version: + __version__ = '{}.{}'.format(__version__, local_version) packages = find_packages(exclude=['test']) megengine_data = [ diff --git a/scripts/whl/BUILD_PYTHON_WHL_README.md b/scripts/whl/BUILD_PYTHON_WHL_README.md index fe883abd..4270a751 100755 --- a/scripts/whl/BUILD_PYTHON_WHL_README.md +++ b/scripts/whl/BUILD_PYTHON_WHL_README.md @@ -72,7 +72,7 @@ export TENSORRT_ROOT_DIR=/path/to/tensorrt ALL_PYTHON="36m" ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cu101 ``` -* If you just want to build with cpu only version, you can set `BUILD_WHL_CPU_ONLY` environment 'ON'. eg: +* If you just want to build with cpu only version, you can set `-sdk` environment 'cpu'. eg: ```bash ALL_PYTHON="36m" ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cpu ``` diff --git a/scripts/whl/manylinux2014/build_wheel_common.sh b/scripts/whl/manylinux2014/build_wheel_common.sh index 8b7d29a2..ab534474 100755 --- a/scripts/whl/manylinux2014/build_wheel_common.sh +++ b/scripts/whl/manylinux2014/build_wheel_common.sh @@ -199,6 +199,7 @@ fi docker run --rm -it $TMPFS_ARGS \ -e UID=${USERID} \ + -e PUBLIC_VERSION_POSTFIX=${PUBLIC_VERSION_POSTFIX} \ -e LOCAL_VERSION=${LOCAL_VERSION} \ -e BUILD_WHL_CPU_ONLY=${BUILD_WHL_CPU_ONLY} \ -e ALL_PYTHON="${ALL_PYTHON}" \