[Piglit] [PATCH] Remove dependency on Python 2.7.

Paul Berry stereotype441 at gmail.com
Mon Jul 25 14:01:55 PDT 2011


This patch is intended to be squashed into "Add comprehensive tests of
builtin functions with uniform input."

Remove the dependency on Python 2.7 by using optparse instead of
argparse.  Update CMakeLists.txt and README to reflect the dependency
change.

This permits Piglit to be built on platforms that ship with Python
2.6, such as Ubuntu 10.10 and Snow Leopard.  Numpy is still required.
---
 CMakeLists.txt                               |    6 +++---
 README                                       |    2 +-
 generated_tests/gen_builtin_uniform_tests.py |   11 ++++++-----
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 559c9db..8bbbd79 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,14 +13,14 @@ find_package(GLUT REQUIRED)
 find_package(PNG REQUIRED)
 find_package(X11)
 
-# Check for presence of Python 2.7 or greater.
+# Check for presence of Python 2.6 or greater.
 execute_process(
-	COMMAND python -c "import sys; assert sys.version >= '2.7'"
+	COMMAND python -c "import sys; assert sys.version >= '2.6'"
 	OUTPUT_QUIET
 	ERROR_QUIET
 	RESULT_VARIABLE python_version_check_error_code)
 if(NOT(python_version_check_error_code EQUAL 0))
-	message(FATAL_ERROR "python version 2.7 or greater required")
+	message(FATAL_ERROR "python version 2.6 or greater required")
 endif(NOT(python_version_check_error_code EQUAL 0))
 
 # Check for the presence of numpy, which is needed to build generated
diff --git a/README b/README
index 54c8327..1f567e3 100644
--- a/README
+++ b/README
@@ -28,7 +28,7 @@ The original tests have been taken from
 
 First of all, you need to make sure that the following are installed:
 
-  - Python 2.7 or greater
+  - Python 2.6 or greater
   - numpy (http://www.numpy.org)
   - cmake (http://www.cmake.org)
   - GL, glu and glut libraries and development packages (i.e. headers)
diff --git a/generated_tests/gen_builtin_uniform_tests.py b/generated_tests/gen_builtin_uniform_tests.py
index 708ccd8..eaa9533 100644
--- a/generated_tests/gen_builtin_uniform_tests.py
+++ b/generated_tests/gen_builtin_uniform_tests.py
@@ -46,8 +46,8 @@
 
 from builtin_function import *
 import abc
-import argparse
 import numpy
+import optparse
 import os
 import os.path
 import sys
@@ -314,13 +314,14 @@ def all_tests():
 
 def main():
     desc = 'Generate shader tests that test built-in functions using uniforms'
-    parser = argparse.ArgumentParser(description=desc)
-    parser.add_argument(
+    usage = 'usage: %prog [-h] [--names-only]'
+    parser = optparse.OptionParser(description=desc, usage=usage)
+    parser.add_option(
 	'--names-only', dest='names_only', action='store_true',
 	help="Don't output files, just generate a list of filenames to stdout")
-    args = parser.parse_args()
+    options, args = parser.parse_args()
     for test in all_tests():
-	if not args.names_only:
+	if not options.names_only:
 	    test.generate_shader_test()
 	print test.filename()
 
-- 
1.7.6



More information about the Piglit mailing list