From 7bd78305cfcd649f4bd49ab49a69d1a5849877e9 Mon Sep 17 00:00:00 2001 From: sdarwin Date: Wed, 22 Jun 2022 15:28:03 -0600 Subject: [PATCH 1/2] pythonexecutable variable --- ci/common_install.sh | 12 ++++++++++-- ci/enforce.sh | 10 +++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ci/common_install.sh b/ci/common_install.sh index 9ad0391..517c5d8 100644 --- a/ci/common_install.sh +++ b/ci/common_install.sh @@ -28,10 +28,18 @@ set -ex CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" +if command -v python ; then + export pythonexecutable="python" +elif command -v python3 ; then + export pythonexecutable="python3" +else + export pythonexecutable="python" +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 +65,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..03db228 100755 --- a/ci/enforce.sh +++ b/ci/enforce.sh @@ -10,6 +10,14 @@ set -e +if command -v python ; then + export pythonexecutable="python" +elif command -v python3 ; then + export pythonexecutable="python3" +else + export pythonexecutable="python" +fi + function enforce_b2 { local old_varname=$1 @@ -48,7 +56,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 From 22da9557b2469685b6a34710fefa3418d56c17a8 Mon Sep 17 00:00:00 2001 From: sdarwin Date: Thu, 23 Jun 2022 09:20:20 -0600 Subject: [PATCH 2/2] pythonexecutable variable - update --- ci/common_install.sh | 9 ++++++--- ci/enforce.sh | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ci/common_install.sh b/ci/common_install.sh index 517c5d8..45e5994 100644 --- a/ci/common_install.sh +++ b/ci/common_install.sh @@ -29,11 +29,14 @@ set -ex CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" if command -v python ; then - export pythonexecutable="python" + pythonexecutable="python" elif command -v python3 ; then - export pythonexecutable="python3" + pythonexecutable="python3" +elif command -v python2 ; then + pythonexecutable="python2" else - export pythonexecutable="python" + echo "Please install Python!" + false fi . "$CI_DIR"/enforce.sh diff --git a/ci/enforce.sh b/ci/enforce.sh index 03db228..698f3d7 100755 --- a/ci/enforce.sh +++ b/ci/enforce.sh @@ -11,11 +11,14 @@ set -e if command -v python ; then - export pythonexecutable="python" + pythonexecutable="python" elif command -v python3 ; then - export pythonexecutable="python3" + pythonexecutable="python3" +elif command -v python2 ; then + pythonexecutable="python2" else - export pythonexecutable="python" + echo "Please install Python!" + false fi function enforce_b2