From 2935ce07cc4d529c5d21c093fb000a22f8defd0a Mon Sep 17 00:00:00 2001 From: risemeup1 <62429225+risemeup1@users.noreply.github.com> Date: Fri, 9 Dec 2022 21:04:50 +0800 Subject: [PATCH] support py3 in setup.py (#48905) * support py3 in setup.py * support setup.py bdist_wheel in py3 * support py3 in setup.py * modify run_setup --- paddle/scripts/paddle_build.sh | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 47e64afb16c..23895ef14c9 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -769,8 +769,8 @@ function run_linux_cpu_test() { mkdir -p ${PADDLE_ROOT}/build cd ${PADDLE_ROOT}/build pip install hypothesis - if [ -d "${PADDLE_ROOT}/build/python/dist/" ]; then - pip install ${PADDLE_ROOT}/build/python/dist/*whl + if [ -d "${PADDLE_ROOT}/dist/" ]; then + pip install ${PADDLE_ROOT}/dist/*whl fi cp ${PADDLE_ROOT}/build/python/paddle/fluid/tests/unittests/op_test.py ${PADDLE_ROOT}/build/python cp ${PADDLE_ROOT}/build/python/paddle/fluid/tests/unittests/testsuite.py ${PADDLE_ROOT}/build/python @@ -3463,6 +3463,12 @@ function check_coverage_build() { } function run_setup(){ rm -rf ${PADDLE_ROOT}/build + # Build script will not fail if *.deb does not exist + rm *.deb 2>/dev/null || true + # Delete previous built egg packages + rm -rf ${PADDLE_ROOT}/dist 2>/dev/null || true + # Delete previous built paddle cache + rm -rf ${PADDLE_ROOT}/build/python/paddle 2>/dev/null || true startTime_s=`date +%s` SYSTEM=`uname -s` @@ -3477,7 +3483,6 @@ function run_setup(){ export PYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 export PYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/ export PYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib - pip3.7 install --user -r ${PADDLE_ROOT}/python/requirements.txt else exit 1 @@ -3525,15 +3530,7 @@ function run_setup(){ else if [ "$1" != "" ]; then echo "using python abi: $1" - if [ "$1" == "cp36-cp36m" ]; then - export LD_LIBRARY_PATH=/opt/_internal/cpython-3.6.0/lib/:${LD_LIBRARY_PATH} - export PATH=/opt/_internal/cpython-3.6.0/bin/:${PATH} - #after changing "PYTHON_LIBRARY:FILEPATH" to "PYTHON_LIBRARY" ,we can use export - export PYTHON_EXECUTABLE=/opt/_internal/cpython-3.6.0/bin/python3 - export PYTHON_INCLUDE_DIR=/opt/_internal/cpython-3.6.0/include/python3.6m - export PYTHON_LIBRARIES=/opt/_internal/cpython-3.6.0/lib/libpython3.so - pip3.6 install -r ${PADDLE_ROOT}/python/requirements.txt - elif [ "$1" == "cp37-cp37m" ]; then + if [ "$1" == "cp37-cp37m" ]; then export LD_LIBRARY_PATH=/opt/_internal/cpython-3.7.0/lib/:${LD_LIBRARY_PATH} export PATH=/opt/_internal/cpython-3.7.0/bin/:${PATH} #after changing "PYTHON_LIBRARY:FILEPATH" to "PYTHON_LIBRARY" ,we can use export @@ -3651,7 +3648,7 @@ function run_setup(){ # reset ccache zero stats for collect PR's actual hit rate ccache -z - python setup.py install;build_error=$? + python setup.py $2;build_error=$? # ci will collect ccache hit rate collect_ccache_hits @@ -3871,7 +3868,7 @@ function main() { build_mac ;; cicheck_py37) - cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number} + run_setup ${PYTHON_ABI:-""} bdist_wheel run_linux_cpu_test ${PYTHON_ABI:-""} ${PROC_RUN:-1} ;; test_cicheck_py37) @@ -3884,7 +3881,7 @@ function main() { parallel_test ;; build_gpubox) - run_setup ${PYTHON_ABI:-""} + run_setup ${PYTHON_ABI:-""} install ;; check_xpu) cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number} -- GitLab