gnulib-tool.py will currently crash immediately on start if the underlying
Python version is 2.6 or lower. The immediate crash that is seen occurs during
the check for the Python version. The check uses a syntax which was only
introduced in 2.7. I haven't checked, but I believe that the rest of the script
also uses 2.7+ syntax. Hence, I have also added a check to the script to exit
out if the version of Python being used is less than 2.7.


-- 
Thanking You,
Darshit Shah
PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6
From de43800deb2fa524eea054d1e8b7185814d58dbb Mon Sep 17 00:00:00 2001
From: Darshit Shah <dar...@gnu.org>
Date: Sat, 13 Oct 2018 21:17:56 +0200
Subject: [PATCH 2/2] pygnulib: Don't crash immediately on older Python
 versions

* pygnulib/constants.py: sys.version_info is a named tuple only since
Python 2.7. Use the indexed version to support older versions.
Exit out if the installed Python is older than 2.7.
---
 ChangeLog             | 6 ++++++
 pygnulib/constants.py | 8 +++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index b0aa8e29d..c15ba9736 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-10-13  Darshit Shah   <dar...@gnu.org>
+
+       * pygnulib/constants.py: sys.version_info is a named tuple only since
+       Python 2.7. Use the indexed version to support older versions.
+       Exit out if the installed Python is older than 2.7.
+
 2018-10-13  Darshit Shah   <dar...@gnu.org>
 
        * bootstrap.conf: Introduce option use_pygnulib
diff --git a/pygnulib/constants.py b/pygnulib/constants.py
index 2dc64e6b6..e6d23cf54 100644
--- a/pygnulib/constants.py
+++ b/pygnulib/constants.py
@@ -34,11 +34,17 @@ __copyright__ = '2002-2017 Free Software Foundation, Inc.'
 # Backward compatibility
 
#===============================================================================
 # Check for Python version
-if sys.version_info.major == 2:
+if sys.version_info[0] == 2:
     PYTHON3 = False
 else:
     PYTHON3 = True
 
+# If using Python 2, ensure that at least version 2.7 is used. Older versions
+# are not supported
+if not PYTHON3 or sys.version_info[1] < 7:
+    print("Python version must be atleast 2.7. Exiting.")
+    sys.exit(1)
+
 # Create string compatibility
 if not PYTHON3:
     string = unicode
-- 
2.19.1

Attachment: signature.asc
Description: PGP signature

Reply via email to