Skip to content

Commit

Permalink
More protections against system python (alisw#5586)
Browse files Browse the repository at this point in the history
There is no reason why we should have interference from system python
when building python itself.
  • Loading branch information
ktf authored Aug 21, 2024
1 parent 66166a6 commit ebe26d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
PYTHONPATH: "$PYTHON_ROOT/lib/python/site-packages"
prefer_system: "(?!slc5|ubuntu)"
prefer_system_check:
python3 -c 'import sys; import sqlite3; sys.exit(1 if sys.version_info < (3, 5) else 0)' && python3 -m pip --help > /dev/null && printf '#include "pyconfig.h"' | cc -c $(python3-config --includes) -xc -o /dev/null -; if [ $? -ne 0 ]; then printf "Python, the Python development packages, and pip must be installed on your system.\nUsually those packages are called python, python-devel (or python-dev) and python-pip.\n"; exit 1; fi
python3 -c 'import sys; import sqlite3; sys.exit(1 if sys.version_info < (3, 9) else 0)' && python3 -m pip --help > /dev/null && printf '#include "pyconfig.h"' | cc -c $(python3-config --includes) -xc -o /dev/null -; if [ $? -ne 0 ]; then printf "Python, the Python development packages, and pip must be installed on your system.\nUsually those packages are called python, python-devel (or python-dev) and python-pip.\n"; exit 1; fi
---
rsync -av --exclude '**/.git' $SOURCEDIR/ $BUILDDIR/
Expand All @@ -28,6 +28,8 @@ export LIBFFI_ROOT
# If the python installer finds another pip, it won't install the new one
export PATH=$(echo $PATH | awk -v RS=':' -v ORS=':' '!/python/ {print}' | sed 's/:$//')
unset PYTHONUSERBASE
unset PYTHONHOME
unset PYTHONPATH
# The only way to pass externals to Python
LDFLAGS=
Expand Down

0 comments on commit ebe26d2

Please sign in to comment.