diff --git a/ci/common_install.sh b/ci/common_install.sh index 9ad0391..45e5994 100644 --- a/ci/common_install.sh +++ b/ci/common_install.sh @@ -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 diff --git a/ci/enforce.sh b/ci/enforce.sh index f040f41..698f3d7 100755 --- a/ci/enforce.sh +++ b/ci/enforce.sh @@ -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