未验证 提交 2935ce07 编写于 作者: R risemeup1 提交者: GitHub

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
上级 7b2b0c1b
...@@ -769,8 +769,8 @@ function run_linux_cpu_test() { ...@@ -769,8 +769,8 @@ function run_linux_cpu_test() {
mkdir -p ${PADDLE_ROOT}/build mkdir -p ${PADDLE_ROOT}/build
cd ${PADDLE_ROOT}/build cd ${PADDLE_ROOT}/build
pip install hypothesis pip install hypothesis
if [ -d "${PADDLE_ROOT}/build/python/dist/" ]; then if [ -d "${PADDLE_ROOT}/dist/" ]; then
pip install ${PADDLE_ROOT}/build/python/dist/*whl pip install ${PADDLE_ROOT}/dist/*whl
fi 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/op_test.py ${PADDLE_ROOT}/build/python
cp ${PADDLE_ROOT}/build/python/paddle/fluid/tests/unittests/testsuite.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() { ...@@ -3463,6 +3463,12 @@ function check_coverage_build() {
} }
function run_setup(){ function run_setup(){
rm -rf ${PADDLE_ROOT}/build 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` startTime_s=`date +%s`
SYSTEM=`uname -s` SYSTEM=`uname -s`
...@@ -3477,7 +3483,6 @@ function run_setup(){ ...@@ -3477,7 +3483,6 @@ function run_setup(){
export PYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 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_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 export PYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7m.dylib
pip3.7 install --user -r ${PADDLE_ROOT}/python/requirements.txt pip3.7 install --user -r ${PADDLE_ROOT}/python/requirements.txt
else else
exit 1 exit 1
...@@ -3525,15 +3530,7 @@ function run_setup(){ ...@@ -3525,15 +3530,7 @@ function run_setup(){
else else
if [ "$1" != "" ]; then if [ "$1" != "" ]; then
echo "using python abi: $1" echo "using python abi: $1"
if [ "$1" == "cp36-cp36m" ]; then if [ "$1" == "cp37-cp37m" ]; 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
export LD_LIBRARY_PATH=/opt/_internal/cpython-3.7.0/lib/:${LD_LIBRARY_PATH} export LD_LIBRARY_PATH=/opt/_internal/cpython-3.7.0/lib/:${LD_LIBRARY_PATH}
export PATH=/opt/_internal/cpython-3.7.0/bin/:${PATH} export PATH=/opt/_internal/cpython-3.7.0/bin/:${PATH}
#after changing "PYTHON_LIBRARY:FILEPATH" to "PYTHON_LIBRARY" ,we can use export #after changing "PYTHON_LIBRARY:FILEPATH" to "PYTHON_LIBRARY" ,we can use export
...@@ -3651,7 +3648,7 @@ function run_setup(){ ...@@ -3651,7 +3648,7 @@ function run_setup(){
# reset ccache zero stats for collect PR's actual hit rate # reset ccache zero stats for collect PR's actual hit rate
ccache -z ccache -z
python setup.py install;build_error=$? python setup.py $2;build_error=$?
# ci will collect ccache hit rate # ci will collect ccache hit rate
collect_ccache_hits collect_ccache_hits
...@@ -3871,7 +3868,7 @@ function main() { ...@@ -3871,7 +3868,7 @@ function main() {
build_mac build_mac
;; ;;
cicheck_py37) 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} run_linux_cpu_test ${PYTHON_ABI:-""} ${PROC_RUN:-1}
;; ;;
test_cicheck_py37) test_cicheck_py37)
...@@ -3884,7 +3881,7 @@ function main() { ...@@ -3884,7 +3881,7 @@ function main() {
parallel_test parallel_test
;; ;;
build_gpubox) build_gpubox)
run_setup ${PYTHON_ABI:-""} run_setup ${PYTHON_ABI:-""} install
;; ;;
check_xpu) check_xpu)
cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number} cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册