Skip to content

Commit

Permalink
Merge pull request #1948 from ceph/py312-centos
Browse files Browse the repository at this point in the history
bootstrap: Improve Python version detection; default to 3.12 on CentOS & Fedora
  • Loading branch information
zmc authored May 28, 2024
2 parents b853422 + 9c258ce commit e1979f0
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,11 @@ if [ -z "$PYTHON" ]; then
for i in 12 11 10; do
command -v "python3.$i" && PYTHON="python3.$i" && break
done
fi
if [ -z "$PYTHON" ]; then
# This would be bizarre, but I suppose possible
PYTHON=${PYTHON:-"python3"}
fi
PYTHON_VER_OUT=$($PYTHON --version)
PYTHON_BIN=$(command -v $PYTHON)
if [ -z $PYTHON_BIN -o ! -e $PYTHON_BIN -o ! -x $PYTHON_BIN ]; then
echo "Cannot find $PYTHON!"
exit 1
fi
VENV=${VENV:-"virtualenv"}

case "$(uname -s)" in
Linux)
Expand Down Expand Up @@ -85,7 +80,8 @@ Linux)
fi
;;
CentOSStream)
deps=(python3-pip python3-devel)
PYTHON=python3.12
deps=($PYTHON-pip $PYTHON-devel)
for package in ${deps[@]}; do
if ! rpm -q --whatprovides $package ; then
missing="${missing:+$missing }$package"
Expand All @@ -105,7 +101,9 @@ Linux)
fi
;;
Fedora)
deps=(python3-pip python3-devel libev-devel libvirt-devel libffi-devel)
PYTHON=python3.12
deps=($PYTHON-pip $PYTHON-devel)
deps=($PYTHON-pip $PYTHON-devel libev-devel libvirt-devel libffi-devel)
for package in ${deps[@]}; do
if ! rpm -q --whatprovides $package; then
missing="${missing:+$missing }$package"
Expand Down Expand Up @@ -176,6 +174,14 @@ Darwin)
;;
esac

PYTHON_BIN=$(command -v $PYTHON)
if [ -z $PYTHON_BIN -o ! -e $PYTHON_BIN -o ! -x $PYTHON_BIN ]; then
echo "Cannot find $PYTHON!"
exit 1
fi
PYTHON_VER_OUT=$($PYTHON_BIN --version)

VENV=${VENV:-"virtualenv"}
# If the venv was set to use system site-packages, fix that
if [ -f "$VENV/pyvenv.cfg" ]; then
sed -i'' -e 's/\(include-system-site-packages\s*=\s*\)true/\1false/g' $VENV/pyvenv.cfg
Expand Down

0 comments on commit e1979f0

Please sign in to comment.