diff --git a/build.sh b/build.sh index 8bb5f3d95a757eb838e58be4cc0be5bdc6803af9..6dc699000aee8623b2deba09d3482885d21b8d4d 100755 --- a/build.sh +++ b/build.sh @@ -462,8 +462,10 @@ if [[ "X$INC_BUILD" = "Xoff" ]]; then bash "${PROJECT_PATH}/package.sh" ge elif [[ "X$ENABLE_GPU" = "Xon" ]]; then bash "${PROJECT_PATH}/package.sh" ms gpu - elif [[ "X$ENABLE_D" = "Xon" ]] || [[ "X$ENABLE_CPU" = "Xon" ]]; then - bash "${PROJECT_PATH}/package.sh" ms + elif [[ "X$ENABLE_D" = "Xon" ]]; then + bash "${PROJECT_PATH}/package.sh" ms ascend + elif [[ "X$ENABLE_CPU" = "Xon" ]]; then + bash "${PROJECT_PATH}/package.sh" ms cpu else bash "${PROJECT_PATH}/package.sh" debug fi diff --git a/package.sh b/package.sh index 0d4147c9f66662989db3b81c23f9381ee5c6c2de..67f4761f37607b9f98eedc1e1ff12555a93dd017 100755 --- a/package.sh +++ b/package.sh @@ -96,14 +96,29 @@ if [ -n "$1" ];then else export BACKEND_POLICY="ms" fi + +# package name +if [[ "X$1" = "Xge" ]]; then + export MS_PACKAGE_NAME="mindspore" +elif [[ "X$1" = "Xms" && "X$2" = "Xgpu" ]]; then + export MS_PACKAGE_NAME="mindspore-gpu" +elif [[ "X$1" = "Xms" && "X$2" = "Xascend" ]]; then + export MS_PACKAGE_NAME="mindspore-ascend" +elif [[ "X$1" = "Xms" && "X$2" = "Xcpu" ]]; then + export MS_PACKAGE_NAME="mindspore" +else + export MS_PACKAGE_NAME="mindspore" +fi + ${PYTHON} "${BASEPATH}/setup_package.py" bdist_wheel chmod -R 700 ${PACKAGE_PATH}/mindspore/ -chmod -R 700 ${PACKAGE_PATH}/mindspore.egg-info/ +chmod -R 700 ${PACKAGE_PATH}/${MS_PACKAGE_NAME//-/_}.egg-info/ # rename package PACKAGE_FULL_NAME=$(find "${PACKAGE_PATH}" -iname "*.whl") PACKAGE_BASE_NAME=$(echo ${PACKAGE_FULL_NAME} | awk -F / '{print $NF}' | awk -F - '{print $1"-"$2}') +PACKAGE_BASE_NAME=${PACKAGE_BASE_NAME//_*-/-} PACKAGE_NEW_NAME="${PACKAGE_BASE_NAME}-${PY_TAGS}-${PLATFORM_TAG}.whl" cp -rf "${PACKAGE_PATH}/dist"/*.whl "${PACKAGE_PATH}/${PACKAGE_NEW_NAME}" diff --git a/setup_package.py b/setup_package.py index 8b6889cd34042cd954b1c52c798016836e6b54a4..87b5718de29ecd9f1492bae8ccf0e21a81d8c9b4 100644 --- a/setup_package.py +++ b/setup_package.py @@ -21,7 +21,6 @@ from setuptools import setup, find_packages from setuptools.command.egg_info import egg_info from setuptools.command.build_py import build_py -package_name = 'mindspore' version = '0.1.0' author = 'The MindSpore Authors' author_email = 'contact@mindspore.cn' @@ -29,6 +28,7 @@ home_page = 'https://www.mindspore.cn' backend_policy = os.getenv('BACKEND_POLICY') commit_id = os.getenv('COMMIT_ID').replace("\n", "") +package_name = os.getenv('MS_PACKAGE_NAME').replace("\n", "") pwd = os.path.dirname(os.path.realpath(__file__)) pkg_dir = os.path.join(pwd, 'build/package')