$OpenBSD: patch-Modules_FindPythonInterp_cmake,v 1.11 2016/11/28 09:15:13 dcoppa Exp $
--- Modules/FindPythonInterp.cmake.orig	Fri Nov 11 15:37:13 2016
+++ Modules/FindPythonInterp.cmake	Fri Nov 25 22:31:44 2016
@@ -36,6 +36,8 @@
 # get the currently active Python version by default with a consistent version
 # of PYTHON_LIBRARIES.
 
+set(MODPY_VERSION $ENV{MODPY_VERSION})
+
 unset(_Python_NAMES)
 
 set(_PYTHON1_VERSIONS 1.6 1.5)
@@ -68,19 +70,23 @@ find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
 
 # Set up the versions we know about, in the order we will search. Always add
 # the user supplied additional versions to the front.
-set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
-# If FindPythonInterp has already found the major and minor version,
-# insert that version next to get consistent versions of the interpreter and
-# library.
-if(DEFINED PYTHONLIBS_VERSION_STRING)
-  string(REPLACE "." ";" _PYTHONLIBS_VERSION "${PYTHONLIBS_VERSION_STRING}")
-  list(GET _PYTHONLIBS_VERSION 0 _PYTHONLIBS_VERSION_MAJOR)
-  list(GET _PYTHONLIBS_VERSION 1 _PYTHONLIBS_VERSION_MINOR)
-  list(APPEND _Python_VERSIONS ${_PYTHONLIBS_VERSION_MAJOR}.${_PYTHONLIBS_VERSION_MINOR})
-endif()
-# Search for the current active python version first
-list(APPEND _Python_VERSIONS ";")
-list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
+if(MODPY_VERSION)
+  set(_Python_VERSIONS ${MODPY_VERSION})
+else(MODPY_VERSION)
+  set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
+  # If FindPythonInterp has already found the major and minor version,
+  # insert that version next to get consistent versions of the interpreter and
+  # library.
+  if(DEFINED PYTHONLIBS_VERSION_STRING)
+    string(REPLACE "." ";" _PYTHONLIBS_VERSION "${PYTHONLIBS_VERSION_STRING}")
+    list(GET _PYTHONLIBS_VERSION 0 _PYTHONLIBS_VERSION_MAJOR)
+    list(GET _PYTHONLIBS_VERSION 1 _PYTHONLIBS_VERSION_MINOR)
+    list(APPEND _Python_VERSIONS ${_PYTHONLIBS_VERSION_MAJOR}.${_PYTHONLIBS_VERSION_MINOR})
+  endif()
+  # Search for the current active python version first
+  list(APPEND _Python_VERSIONS ";")
+  list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
+endif(MODPY_VERSION)
 
 unset(_PYTHON_FIND_OTHER_VERSIONS)
 unset(_PYTHON1_VERSIONS)
