You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

package.sh 1.7 kB

5 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. # Copyright 2021 Huawei Technologies Co., Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. set -e
  16. BASEPATH=$(cd "$(dirname $0)/../"; pwd)
  17. OUTPUT_PATH="${BASEPATH}/output"
  18. PYTHON=$(which python3)
  19. if [ ! -d ${OUTPUT_PATH} ]; then
  20. mkdir -pv "${OUTPUT_PATH}"
  21. fi
  22. write_checksum() {
  23. cd "${OUTPUT_PATH}"
  24. PACKAGE_LIST=$(ls akg-*.whl)
  25. for PACKAGE_NAME in $PACKAGE_LIST; do
  26. echo $PACKAGE_NAME
  27. sha256sum -b "$PACKAGE_NAME" >"$PACKAGE_NAME.sha256"
  28. done
  29. }
  30. cd ${BASEPATH}
  31. ${PYTHON} setup.py sdist bdist_wheel
  32. for file in `ls ${BASEPATH}/dist/*.whl`
  33. do
  34. file_name=$(basename $file)
  35. prefix=`echo $file_name | cut -d '-' -f 1-2`
  36. CUR_ARCH=`arch`
  37. PY_VERSION=`python3 --version`
  38. PY_TAGS=""
  39. if [[ $PY_VERSION == *3.7* ]]; then
  40. PY_TAGS="cp37-cp37m"
  41. elif [[ $PY_VERSION == *3.8* ]]; then
  42. PY_TAGS="cp38-cp38"
  43. else
  44. echo "Error: Could not find Python 3.8 or Python 3.7"
  45. exit 1
  46. fi
  47. new_file_name="${prefix}-${PY_TAGS}-linux_${CUR_ARCH}.whl"
  48. mv $file ${BASEPATH}/dist/${new_file_name}
  49. done
  50. mv ${BASEPATH}/dist/*.whl ${OUTPUT_PATH}
  51. write_checksum
  52. echo "------Successfully created akg package------"