INN commit: branches/2.6/m4 (python.m4)

INN Commit rra at isc.org
Sun Jan 17 21:48:51 UTC 2021


    Date: Sunday, January 17, 2021 @ 13:48:51
  Author: iulius
Revision: 10521

m4/python.m4: fix the detection of old Python 2.x versions

The current code for probing the presence of Python only workq with
Python 2.7+ and 3.1+ because the "major" attribute to sys.version_info
was only added in these versions.

Also, the construct 'x for y in z' is too recent and not known by
Python 2.3.0, the minimum version required for INN, so I changed it
to a classic map().  If two arguments were not given to the m4 macro,
the script also failed.  Now fixed.

Modified:
  branches/2.6/m4/python.m4

-----------+
 python.m4 |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Modified: python.m4
===================================================================
--- python.m4	2021-01-17 21:48:06 UTC (rev 10520)
+++ python.m4	2021-01-17 21:48:51 UTC (rev 10521)
@@ -59,13 +59,13 @@
 import sys
 two_okay = False
 three_okay = False
-if sys.argv[1]:
-    two_tuple = tuple(int(i) for i in sys.argv[1].split("."))
-    if sys.version_info.major == 2 and sys.version_info >= two_tuple:
+if len(sys.argv) > 1 and sys.argv[1]:
+    two_tuple = tuple(map(int, sys.argv[1].split(".")))
+    if sys.version_info[0] == 2 and sys.version_info >= two_tuple:
         two_okay = True
-if sys.argv[2]:
-    three_tuple = tuple(int(i) for i in sys.argv[2].split("."))
-    if sys.version_info.major > 2 and sys.version_info >= three_tuple:
+if len(sys.argv) > 2 and sys.argv[2]:
+    three_tuple = tuple(map(int, sys.argv[2].split(".")))
+    if sys.version_info[0] > 2 and sys.version_info >= three_tuple:
         three_okay = True
 assert(two_okay or three_okay)
 ]])



More information about the inn-committers mailing list