Skip to content

Commit 2935ce0

Browse files
authored
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
1 parent 7b2b0c1 commit 2935ce0

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

paddle/scripts/paddle_build.sh

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,8 @@ function run_linux_cpu_test() {
769769
mkdir -p ${PADDLE_ROOT}/build
770770
cd ${PADDLE_ROOT}/build
771771
pip install hypothesis
772-
if [ -d "${PADDLE_ROOT}/build/python/dist/" ]; then
773-
pip install ${PADDLE_ROOT}/build/python/dist/*whl
772+
if [ -d "${PADDLE_ROOT}/dist/" ]; then
773+
pip install ${PADDLE_ROOT}/dist/*whl
774774
fi
775775
cp ${PADDLE_ROOT}/build/python/paddle/fluid/tests/unittests/op_test.py ${PADDLE_ROOT}/build/python
776776
cp ${PADDLE_ROOT}/build/python/paddle/fluid/tests/unittests/testsuite.py ${PADDLE_ROOT}/build/python
@@ -3463,6 +3463,12 @@ function check_coverage_build() {
34633463
}
34643464
function run_setup(){
34653465
rm -rf ${PADDLE_ROOT}/build
3466+
# Build script will not fail if *.deb does not exist
3467+
rm *.deb 2>/dev/null || true
3468+
# Delete previous built egg packages
3469+
rm -rf ${PADDLE_ROOT}/dist 2>/dev/null || true
3470+
# Delete previous built paddle cache
3471+
rm -rf ${PADDLE_ROOT}/build/python/paddle 2>/dev/null || true
34663472
startTime_s=`date +%s`
34673473

34683474
SYSTEM=`uname -s`
@@ -3477,7 +3483,6 @@ function run_setup(){
34773483
export PYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
34783484
export PYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m/
34793485
export PYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib
3480-
34813486
pip3.7 install --user -r ${PADDLE_ROOT}/python/requirements.txt
34823487
else
34833488
exit 1
@@ -3525,15 +3530,7 @@ function run_setup(){
35253530
else
35263531
if [ "$1" != "" ]; then
35273532
echo "using python abi: $1"
3528-
if [ "$1" == "cp36-cp36m" ]; then
3529-
export LD_LIBRARY_PATH=/opt/_internal/cpython-3.6.0/lib/:${LD_LIBRARY_PATH}
3530-
export PATH=/opt/_internal/cpython-3.6.0/bin/:${PATH}
3531-
#after changing "PYTHON_LIBRARY:FILEPATH" to "PYTHON_LIBRARY" ,we can use export
3532-
export PYTHON_EXECUTABLE=/opt/_internal/cpython-3.6.0/bin/python3
3533-
export PYTHON_INCLUDE_DIR=/opt/_internal/cpython-3.6.0/include/python3.6m
3534-
export PYTHON_LIBRARIES=/opt/_internal/cpython-3.6.0/lib/libpython3.so
3535-
pip3.6 install -r ${PADDLE_ROOT}/python/requirements.txt
3536-
elif [ "$1" == "cp37-cp37m" ]; then
3533+
if [ "$1" == "cp37-cp37m" ]; then
35373534
export LD_LIBRARY_PATH=/opt/_internal/cpython-3.7.0/lib/:${LD_LIBRARY_PATH}
35383535
export PATH=/opt/_internal/cpython-3.7.0/bin/:${PATH}
35393536
#after changing "PYTHON_LIBRARY:FILEPATH" to "PYTHON_LIBRARY" ,we can use export
@@ -3651,7 +3648,7 @@ function run_setup(){
36513648
# reset ccache zero stats for collect PR's actual hit rate
36523649
ccache -z
36533650

3654-
python setup.py install;build_error=$?
3651+
python setup.py $2;build_error=$?
36553652

36563653
# ci will collect ccache hit rate
36573654
collect_ccache_hits
@@ -3871,7 +3868,7 @@ function main() {
38713868
build_mac
38723869
;;
38733870
cicheck_py37)
3874-
cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number}
3871+
run_setup ${PYTHON_ABI:-""} bdist_wheel
38753872
run_linux_cpu_test ${PYTHON_ABI:-""} ${PROC_RUN:-1}
38763873
;;
38773874
test_cicheck_py37)
@@ -3884,7 +3881,7 @@ function main() {
38843881
parallel_test
38853882
;;
38863883
build_gpubox)
3887-
run_setup ${PYTHON_ABI:-""}
3884+
run_setup ${PYTHON_ABI:-""} install
38883885
;;
38893886
check_xpu)
38903887
cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number}

0 commit comments

Comments
 (0)