jjb: lttng-tools: Make python2 optionnal for agents builds
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 19 Jul 2022 15:33:24 +0000 (11:33 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Tue, 19 Jul 2022 15:33:29 +0000 (11:33 -0400)
The new Enterprise Linux 9 nodes don't have python2 at all, make it
optionnal in the build script.

Change-Id: I8cfe7125336ee2999c5e41fbdd57b42fdfdc6fd3
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
scripts/lttng-tools/build.sh

index c7f1d5ea7f989535925317a4cf848b3afdf55427..49e2a0392a4048da0498b34ab1f5779d228cdb22 100755 (executable)
@@ -248,10 +248,12 @@ cygwin|cygwin64|msys32|msys64)
     PYTHON2=python2
     PYTHON3=python3
 
-    P2_VERSION=$($PYTHON2 -c 'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))')
-    P3_VERSION=$($PYTHON3 -c 'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))')
+    if command -v $PYTHON2 >/dev/null 2>&1; then
+        P2_VERSION=$($PYTHON2 -c 'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))')
+        DEPS_PYTHON2="$WORKSPACE/deps/build/lib/python$P2_VERSION/site-packages"
+    fi
 
-    DEPS_PYTHON2="$WORKSPACE/deps/build/lib/python$P2_VERSION/site-packages"
+    P3_VERSION=$($PYTHON3 -c 'import sys;v = sys.version.split()[0].split("."); print("{}.{}".format(v[0], v[1]))')
     DEPS_PYTHON3="$WORKSPACE/deps/build/lib/python$P3_VERSION/site-packages"
     ;;
 esac
@@ -327,7 +329,7 @@ agents)
 
     export JAVA_HOME="/usr/lib/jvm/default-java"
     export CLASSPATH="$DEPS_JAVA/lttng-ust-agent-all.jar:/usr/share/java/log4j-api.jar:/usr/share/java/log4j-core.jar:/usr/share/java/log4j-1.2.jar"
-    export PYTHONPATH="$DEPS_PYTHON2:$DEPS_PYTHON3"
+    export PYTHONPATH="${DEPS_PYTHON2:-}${DEPS_PYTHON2:+:}$DEPS_PYTHON3"
 
     CONF_OPTS+=("--enable-test-java-agent-all" "--enable-test-python-agent-all")
 
This page took 0.02417 seconds and 4 git commands to generate.