Merge pull request #174 from sdarwin/python

pythonexecutable variable
This commit is contained in:
Alexander Grund
2022-06-24 09:50:49 +02:00
committed by GitHub
2 changed files with 25 additions and 3 deletions

View File

@@ -28,10 +28,21 @@ set -ex
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
if command -v python ; then
pythonexecutable="python"
elif command -v python3 ; then
pythonexecutable="python3"
elif command -v python2 ; then
pythonexecutable="python2"
else
echo "Please install Python!"
false
fi
. "$CI_DIR"/enforce.sh
if [ -z "$SELF" ]; then
export SELF=$(python "$CI_DIR/get_libname.py")
export SELF=$($pythonexecutable "$CI_DIR/get_libname.py")
fi
# Handle also /refs/head/master
@@ -57,7 +68,7 @@ if [[ -n "$GIT_FETCH_JOBS" ]]; then
DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS")
fi
python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools "${DEPINST_ARGS[@]}" $DEPINST $SELF
$pythonexecutable tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools "${DEPINST_ARGS[@]}" $DEPINST $SELF
# Deduce B2_TOOLSET if unset from B2_COMPILER
if [ -z "$B2_TOOLSET" ] && [ -n "$B2_COMPILER" ]; then

View File

@@ -10,6 +10,17 @@
set -e
if command -v python ; then
pythonexecutable="python"
elif command -v python3 ; then
pythonexecutable="python3"
elif command -v python2 ; then
pythonexecutable="python2"
else
echo "Please install Python!"
false
fi
function enforce_b2
{
local old_varname=$1
@@ -48,7 +59,7 @@ fi
# default parallel build jobs: number of CPUs available + 1
if [ -z "${B2_JOBS}" ]; then
cpus=$(grep -c 'processor' /proc/cpuinfo || python -c 'import multiprocessing as mp; print(mp.cpu_count())' || echo "2")
cpus=$(grep -c 'processor' /proc/cpuinfo || $pythonexecutable -c 'import multiprocessing as mp; print(mp.cpu_count())' || echo "2")
export B2_JOBS=$((cpus + 1))
fi