diff --git a/build.sh b/build.sh index 9d812d6dcc8..e0d0d45da2e 100755 --- a/build.sh +++ b/build.sh @@ -452,8 +452,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 0d4147c9f66..67f4761f376 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 8b6889cd340..87b5718de29 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')