Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support py3 in setup.py #48905

Merged
merged 4 commits into from
Dec 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 13 additions & 29 deletions paddle/scripts/paddle_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -768,8 +768,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,25 +3463,18 @@ 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`
if [ "$SYSTEM" == "Darwin" ]; then
echo "Using python abi: $1"
if [ "$1" == "cp36-cp36m" ] || [ "$1" == "" ]; then
if [ -d "/Library/Frameworks/Python.framework/Versions/3.6" ]; then
export LD_LIBRARY_PATH=/Library/Frameworks/Python.framework/Versions/3.6/lib/
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/Library/Frameworks/Python.framework/Versions/3.6/lib/
export PATH=/Library/Frameworks/Python.framework/Versions/3.6/bin/:${PATH}
#after changing "PYTHON_LIBRARY:FILEPATH" to "PYTHON_LIBRARY" ,we can use export
export PYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/3.6/bin/python3
export PYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m/
export PYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6m.dylib
pip3.6 install --user -r ${PADDLE_ROOT}/python/requirements.txt
else
exit 1
fi
elif [ "$1" == "cp37-cp37m" ]; then
if [ "$1" == "cp37-cp37m" ]; then
if [ -d "/Library/Frameworks/Python.framework/Versions/3.7" ]; then
export LD_LIBRARY_PATH=/Library/Frameworks/Python.framework/Versions/3.7/lib/
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:/Library/Frameworks/Python.framework/Versions/3.7/lib/
Expand All @@ -3490,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 @@ -3538,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 @@ -3664,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 @@ -3884,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 @@ -3897,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