[Piglit] [PATCH 07/34] Add dependency on Python six

Dylan Baker baker.dylan.c at gmail.com
Fri Feb 20 18:17:54 PST 2015


Six is a module that provides a clean, standardized interface for
handling python2 and python3 from the same code base. This adds a
requirement on six as a build-time dependency, the plan is to use it
only for python generators (those called during build time)

While it certainly is possible to reimplement much of what six does
scratch and not add another python dependency, I think it's better to
just use six. For one thing a large number of python modules already
depend on six, so the chances are good that most people already have it
installed. Second, it's the de facto standard for supporting complex
code bases in 2 and 3, so it's familiar and many of the corner cases
have already been addressed.

This adds the necessary cmake boilerplate to ensure that six is
available. At this time I don't know of a specific version being
required, but I am currently using 1.9.0
---
 CMakeLists.txt                    |  1 +
 cmake/Modules/FindPythonSix.cmake | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 cmake/Modules/FindPythonSix.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index db5f718..1a81eed 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -192,6 +192,7 @@ ENDIF()
 find_package(PythonInterp 2.7 REQUIRED)
 find_package(PythonNumpy 1.6.2 REQUIRED)
 find_package(PythonMako 0.7.3 REQUIRED)
+find_package(PythonSix REQUIRED)
 
 # Default to compiling with debug information (`gcc -g`):
 if(NOT CMAKE_BUILD_TYPE)
diff --git a/cmake/Modules/FindPythonSix.cmake b/cmake/Modules/FindPythonSix.cmake
new file mode 100644
index 0000000..96b9a0c
--- /dev/null
+++ b/cmake/Modules/FindPythonSix.cmake
@@ -0,0 +1,22 @@
+# Copyright (C) 2015 Intel Corporation
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
+# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+include(PythonModule)
+basic_python_module(six PythonSix)
-- 
2.3.0



More information about the Piglit mailing list