Skip to content

lal determining wrong Python3 version

In addition to #679 (closed), I also spotted that Python versions > 3.9 are subject to misidentification,

checking for /usr/bin/python3 version... 3.1

when the version is actually 3.10 (Ubuntu 22.04) or 3.11 (Debian 12).

Basically the configure script extracts three characters despite there are four.

Up to 7.2.4, I used the following patch:

--- lal-7.2.4.orig/configure
+++ lal-7.2.4/configure
@@ -11033,7 +11033,7 @@ $as_echo_n "checking for $am_display_PYT
 if ${am_cv_python_version+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`
+  am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(\"%d.%d\" % sys.version_info[:2])"`
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5
 $as_echo "$am_cv_python_version" >&6; }

but there may be more elegant/efficient approaches...