INN commit: trunk/m4 (python.m4)

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


    Date: Sunday, January 17, 2021 @ 13:34:50
  Author: iulius
Revision: 10516

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:
  trunk/m4/python.m4

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

Modified: python.m4
===================================================================
--- python.m4	2021-01-17 21:32:02 UTC (rev 10515)
+++ python.m4	2021-01-17 21:34:50 UTC (rev 10516)
@@ -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