Skip to content

Commit

Permalink
Correct a flaw in the Python 3 version checking
Browse files Browse the repository at this point in the history
It turns out the ax_python_devel.m4 version check assumes that
("3.X+1.0" >= "3.X.0") is True in Python, which is not when X+1
is 10 or above and X is not. (Also presumably X+1=100 and ...)

So let's refactor the check to succeed then.

Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
  • Loading branch information
rincebrain committed May 18, 2021
1 parent 7457b02 commit 44a325c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config/ax_python_devel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ to something else than an empty string.
if test -n "$1"; then
AC_MSG_CHECKING([for a version of Python $1])
ac_supports_python_ver=`$PYTHON -c "import sys; \
from packaging import version; \
ver = sys.version.split ()[[0]]; \
print (ver $1)"`
(tst_cmp,tst_ver) = \"$1\".split (); \
eval (\"print (version.parse (ver) \"+ tst_cmp +\" version.parse (tst_ver))\")"`
if test "$ac_supports_python_ver" = "True"; then
AC_MSG_RESULT([yes])
else
Expand Down

0 comments on commit 44a325c

Please sign in to comment.