[igt-dev] [PATCH i-g-t v2 10/19] scripts/igt_doc.py: sets the minimal version to run the script

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri Mar 10 19:41:16 UTC 2023


From: Mauro Carvalho Chehab <mchehab at kernel.org>

according with vermin, the minimal version for this script is 3.6 due
to:

	  'argparse' module requires 2.7, 3.2
	  'enumerate' member requires 2.3, 3.0
	  'json' module requires 2.6, 3.0
	  'open(encoding)' requires !2, 3.0
	  'os.path.realpath' member requires 2.2, 3.0
	  'sorted' member requires 2.4, 3.0
	  'sorted(key)' requires 2.4, 3.0
	  'str.format' member requires 2.6, 3.0
	  'subprocess' module requires 2.4, 3.0
	  'subprocess.run' member requires !2, 3.5
	  'sys.version_info' member requires 2.0, 3.0
	  `with` requires 2.5, 3.0
	  f-strings require !2, 3.6
	  print(expr) requires 2.0, 3.0

So, print an error if one tries to run with an older version.

Signed-off-by: Mauro Carvalho Chehab <mchehab at kernel.org>
Acked-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 scripts/igt_doc.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/igt_doc.py b/scripts/igt_doc.py
index 0795272275..5b08ac1442 100755
--- a/scripts/igt_doc.py
+++ b/scripts/igt_doc.py
@@ -18,6 +18,10 @@ import re
 import subprocess
 import sys
 
+MIN_PYTHON = (3, 6)
+if sys.version_info < MIN_PYTHON:
+    sys.exit("Python %s.%s or later is required.\n" % MIN_PYTHON) # pylint: disable=C0209
+
 IGT_BUILD_PATH = 'build'
 IGT_RUNNER = 'runner/igt_runner'
 
-- 
2.34.1



More information about the igt-dev mailing list