Skip to content

Commit

Permalink
support py3 in setup.py (#48905)
Browse files Browse the repository at this point in the history
* support py3 in setup.py

* support setup.py bdist_wheel in py3

* support py3 in setup.py

* modify run_setup
  • Loading branch information
risemeup1 committed Dec 9, 2022
1 parent 7b2b0c1 commit 2935ce0
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions paddle/scripts/paddle_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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}
Expand Down

0 comments on commit 2935ce0

Please sign in to comment.