Skip to content

Commit

Permalink
Merge pull request #974 from UV-CDAT/system-python-updated
Browse files Browse the repository at this point in the history
System python updated
  • Loading branch information
aashish24 committed Jan 21, 2015
2 parents 1f24e74 + 4448ddc commit 71421b7
Show file tree
Hide file tree
Showing 192 changed files with 1,091 additions and 587 deletions.
5 changes: 3 additions & 2 deletions CMake/cdat_modules/cdat_external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (CDAT_BUILD_VCS_LEGACY)
set(qt_flags "--enable-qt-framework")
endif()

set(cdat_xtra_flags "--enable-vcs-legacy ${qt_flags} --with-qt=${QT_ROOT} --with-qt-lib=${QT_LIB_DIR} --with-qt-inc=${QT_INC_DIR}" --with-qt-bin=${QT_BINARY_DIR})
set(cdat_xtra_flags "--enable-vcs-legacy ${qt_flags} --with-qt=${QT_ROOT} --with-qt-lib=${QT_LIB_DIR} --with-qt-inc=${QT_INC_DIR} --with-qt-bin=${QT_BINARY_DIR}")
endif()

if (CDAT_BUILD_WITH_LIBDRS)
Expand All @@ -25,6 +25,7 @@ endif()

set(cdat_build_dir ${CMAKE_CURRENT_BINARY_DIR}/cdat-build)

set(WORKING_DIR "${cdat_CMAKE_BINARY_DIR}")
configure_file(${cdat_CMAKE_SOURCE_DIR}/cdat_modules_extra/cdat_python_install_step.cmake.in
${cdat_CMAKE_BINARY_DIR}/cdat_python_install_step.cmake
@ONLY)
Expand All @@ -37,7 +38,7 @@ ExternalProject_Add(CDAT
PATCH_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -DPYTHON_INSTALL_ARGS=${cdat_xtra_flags} -P ${cdat_CMAKE_BINARY_DIR}/cdat_python_install_step.cmake
INSTALL_COMMAND env "PYTHONPATH=$ENV{PYTHONPATH}" ${CMAKE_COMMAND} -DPYTHON_INSTALL_ARGS=${cdat_xtra_flags} -P ${cdat_CMAKE_BINARY_DIR}/cdat_python_install_step.cmake
DEPENDS ${CDAT_deps}
)

Expand Down
4 changes: 2 additions & 2 deletions CMake/cdat_modules/pixman_external.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

set(pixman_source "${CMAKE_CURRENT_BINARY_DIR}/build/pixman")
set(pixman_install "${cdat_EXTERNALS}")
#set(pixman_configure_args "--disable-gtk")
set(pixman_configure_args "--disable-gtk")

ExternalProject_Add(pixman
LIST_SEPARATOR ^^
Expand All @@ -12,7 +12,7 @@ ExternalProject_Add(pixman
URL_MD5 ${PIX_MD5}
BUILD_IN_SOURCE 1
PATCH_COMMAND ""
CONFIGURE_COMMAND ${CMAKE_COMMAND} -DINSTALL_DIR=${pixman_install} -DWORKING_DIR=${pixman_source} -P ${cdat_CMAKE_BINARY_DIR}/cdat_configure_step.cmake
CONFIGURE_COMMAND ${CMAKE_COMMAND} -DCONFIGURE_ARGS=${pixman_configure_args} -DINSTALL_DIR=${pixman_install} -DWORKING_DIR=${pixman_source} -P ${cdat_CMAKE_BINARY_DIR}/cdat_configure_step.cmake
DEPENDS ${pixman_deps}
${ep_log_options}
)
Expand Down
17 changes: 16 additions & 1 deletion CMake/cdat_modules/pyqt_external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@
#
set(PyQt_source "${CMAKE_CURRENT_BINARY_DIR}/build/PyQt")
message("[INFO] Using environment PYTHONPATH \"$ENV{PYTHONPATH}\"")
set(PyQt_configure_command env PYTHONPATH=$ENV{PYTHONPATH} ${PYTHON_EXECUTABLE} configure.py -q ${QT_QMAKE_EXECUTABLE} --confirm-license -b ${CMAKE_INSTALL_PREFIX}/bin -d ${PYTHON_SITE_PACKAGES} -v ${CMAKE_INSTALL_PREFIX}/include -v ${CMAKE_INSTALL_PREFIX}/share -p ${CMAKE_INSTALL_PREFIX}/share/plugins -n ${CMAKE_INSTALL_PREFIX}/share/qsci --assume-shared -e QtGui -e QtHelp -e QtMultimedia -e QtNetwork -e QtDeclarative -e QtOpenGL -e QtScript -e QtScriptTools -e QtSql -e QtSvg -e QtTest -e QtWebKit -e QtXml -e QtXmlPatterns -e QtCore)
set(PyQt_configure_command
env PYTHONPATH=${PYTHONPATH}
"${PYTHON_EXECUTABLE}" configure.py
-q "${QT_QMAKE_EXECUTABLE}"
--confirm-license
-b "${CMAKE_INSTALL_PREFIX}/bin"
-d "${PYTHON_SITE_PACKAGES}"
-v "${CMAKE_INSTALL_PREFIX}/include"
-v "${CMAKE_INSTALL_PREFIX}/share"
-p "${CMAKE_INSTALL_PREFIX}/share/plugins"
-n "${CMAKE_INSTALL_PREFIX}/share/qsci"
--assume-shared
-e QtGui -e QtHelp -e QtMultimedia -e QtNetwork -e QtDeclarative -e QtOpenGL
-e QtScript -e QtScriptTools -e QtSql -e QtSvg -e QtTest -e QtWebKit
-e QtXml -e QtXmlPatterns -e QtCore
)

ExternalProject_Add(PyQt
DOWNLOAD_DIR ${CDAT_PACKAGE_CACHE_DIR}
Expand Down
8 changes: 4 additions & 4 deletions CMake/cdat_modules/pyqt_pkg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ set(PYQT_MAJOR 4)
set(PYQT_MINOR 8)
set(PYQT_PATCH 3)
set(PYQT_MAJOR_SRC 4)
set(PYQT_MINOR_SRC 10)
set(PYQT_PATCH_SRC 1)
set(PYQT_MINOR_SRC 11)
set(PYQT_PATCH_SRC 3)
set(PYQT_VERSION ${PYQT_MAJOR_SRC}.${PYQT_MINOR_SRC}.${PYQT_PATCH_SRC})
set(PYQT_URL ${LLNL_URL})
set(PYQT_GZ_APPLE PyQt-mac-gpl-${PYQT_VERSION}.tar.gz)
set(PYQT_GZ_UNIX PyQt-x11-gpl-${PYQT_VERSION}.tar.gz)
set(PYQT_MD5_APPLE f8feb678212cf4f84d5cf5317b1f5bc2 )
set(PYQT_MD5_UNIX e5973c4ec0b0469f329bc00209d2ad9c )
set(PYQT_MD5_APPLE 9bd050f1d0c91510ea8be9f41878144c )
set(PYQT_MD5_UNIX 997c3e443165a89a559e0d96b061bf70 )
set(PYQT_SOURCE ${PYQT_URL}/${PYQT_GZ_${CMAKE_PLATFORM}})
set(PYQT_MD5 ${PYQT_MD5_${CMAKE_PLATFORM}})

Expand Down
2 changes: 1 addition & 1 deletion CMake/cdat_modules/pyspharm_external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ExternalProject_Add(pyspharm
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND env LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} PYTHONPATH=$ENV{PYTHONPATH} ${PYTHON_EXECUTABLE} setup.py build
INSTALL_COMMAND env LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} PYTHONPATH=$ENV{PYTHONPATH} ${PYTHON_EXECUTABLE} setup.py install
INSTALL_COMMAND env LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH} PYTHONPATH=$ENV{PYTHONPATH} ${PYTHON_EXECUTABLE} setup.py install --prefix=${PYTHON_SITE_PACKAGES_PREFIX}
DEPENDS ${pyspharm_deps}
${ep_log_options}
)
15 changes: 8 additions & 7 deletions CMake/cdat_modules/python_pkg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,37 @@ add_cdat_package(Python ${PYTHON_MAJOR_SRC}.${PYTHON_MINOR_SRC}.${PYTHON_PATCH_S
# FIXME: Name style
set(CDAT_OS_XTRA_PATH "")

set(PYTHON_SITE_PACKAGES ${CMAKE_INSTALL_PREFIX})
set(PYTHON_SITE_PACKAGES_PREFIX ${CMAKE_INSTALL_PREFIX})
set(PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES_PREFIX}/lib/python${PYVER}/site-packages)
if (APPLE)
set(PYTHON_SITE_PACKAGES ${CMAKE_INSTALL_PREFIX}/Library/Frameworks/Python.framework/Versions/${PYVER})
set(PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES_PREFIX}/Library/Frameworks/Python.framework/Versions/${PYVER}/lib/python${PYVER}/site-packages)
endif()
set(PYTHONPATH ${PYTHON_SITE_PACKAGES}/lib/python${PYVER}/site-packages:${PYTHON_SITE_PACKAGES}/lib/python/site-packages)
set(PYTHONPATH ${PYTHON_SITE_PACKAGES})

if (CDAT_USE_SYSTEM_PYTHON)
include(FindPythonInterp)
find_package(PythonInterp)
set(PYVER ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
# \NOTE This is required or else FindPythonLibs may find whatever version is
# listed first internally and if that version exists on the system. For example
# a system might have python version 2.6 and 2.7 both installed.
set(Python_ADDITIONAL_VERSIONS ${PYVER})
include(FindPythonLibs)
find_package(PythonLibs)
set(PYTHON_SITE_PACKAGES ${CMAKE_INSTALL_PREFIX}/lib/python${PYVER}/site-packages)
message("[INFO] Using system python ${PYTHON_EXECUTABLE}")
message("[INFO] Putting packages in directory ${PYTHON_SITE_PACKAGES}")
set(PYTHON_EXTRA_PREFIX "--prefix=${CMAKE_INSTALL_PREFIX}")
message("[INFO] Setting up prefix for installing python packages into: ${PYTHON_EXTRA_PREFIX}")
set(ENV{LD_LIBRARY_PATH} $ENV{LD_LIBRARY_PATH})
set(PYTHONPATH "${PYTHON_SITE_PACKAGES}:$ENV{PYTHONPATH}")
set(ENV{PYTHONPATH} "${PYTHONPATH}")
message("[INFO] Set PYTHONPATH to $ENV{PYTHONPATH}")
get_filename_component(PYTHON_EXECUTABLE_PATH ${PYTHON_EXECUTABLE} PATH)
set(PYTHON_LIBRARY ${PYTHON_LIBRARIES})
message("[INFO] set PYTHON_LIBRARY TO" ${PYTHON_LIBRARY})
set(PYTHON_INCLUDE ${PYTHON_INCLUDE_DIRS})

if(APPLE)
set(CDAT_OS_XTRA_PATH ${CMAKE_INSTALL_PREFIX}/Library/Frameworks/Python.framework/Versions/${PYVER}/bin)
endif()

else ()
set(PYTHON_EXECUTABLE ${CMAKE_INSTALL_PREFIX}/bin/python)
message("[INFO] Building python at ${PYTHON_EXECUTABLE}")
Expand Down
6 changes: 3 additions & 3 deletions CMake/cdat_modules/sip_pkg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ set(SIP_MAJOR 4)
set(SIP_MINOR 12)
set(SIP_PATCH 1)
set(SIP_MAJOR_SRC 4)
set(SIP_MINOR_SRC 14)
set(SIP_PATCH_SRC 6)
set(SIP_MINOR_SRC 16)
set(SIP_PATCH_SRC 4)
set(SIP_VERSION ${SIP_MAJOR_SRC}.${SIP_MINOR_SRC}.${SIP_PATCH_SRC})
set(SIP_URL http://www.riverbankcomputing.com/static/Downloads/sip${SIP_MAJOR_SRC})
set(SIP_URL ${LLNL_URL})
set(SIP_GZ sip-${SIP_MAJOR_SRC}.${SIP_MINOR_SRC}.${SIP_PATCH_SRC}.tar.gz)
set(SIP_MD5 d6493b9f0a7911566545f694327314c4 )
set(SIP_MD5 a9840670a064dbf8f63a8f653776fec9 )
set(SIP_SOURCE ${SIP_URL}/${SIP_GZ})


Expand Down
2 changes: 1 addition & 1 deletion CMake/cdat_modules/windspharm_external.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ExternalProject_Add(windspharm
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ""
BUILD_COMMAND ${PYTHON_EXECUTABLE} setup.py build
INSTALL_COMMAND ${PYTHON_EXECUTABLE} setup.py install ${PYTHON_EXTRA_PREFIX}
INSTALL_COMMAND env "PYTHONPATH=$ENV{PYTHONPATH}" "${PYTHON_EXECUTABLE}" setup.py install "${PYTHON_EXTRA_PREFIX}"
DEPENDS ${windspharm_deps}
${ep_log_options}
)
2 changes: 1 addition & 1 deletion CMake/cdat_modules_extra/ESMP_install_step.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
include(@cdat_CMAKE_BINARY_DIR@/cdat_common_environment.cmake)

file(GLOB_RECURSE ESMP_esmfmkfile "@cdat_EXTERNALS@/lib/libO/*.mk")
file(RELATIVE_PATH _rel_path @PYTHON_SITE_PACKAGES@/ESMP/src ${ESMP_esmfmkfile})
file(RELATIVE_PATH _rel_path @PYTHON_SITE_PACKGES_PREFIX@/ESMP/src ${ESMP_esmfmkfile})

set(ENV{ESMFMKFILE} ${_rel_path})
foreach( item ${ESMP_esmfmkfile})
Expand Down
4 changes: 2 additions & 2 deletions CMake/cdat_modules_extra/cdat_common_environment.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ endif()

set(ENV{EXTERNALS} "@cdat_EXTERNALS@")

set(PYTHONUSERBASE @PYTHON_SITE_PACKAGES@)
set(PYTHONUSERBASE @PYTHON_SITE_PACKAGES_PREFIX@)
#if ("@EGG_INSTALLER@" STREQUAL "PIP")
# # Set python userbase so that pip install packages locally
# set(PYTHONUSERBASE @PYTHON_SITE_PACKAGES@)
# set(PYTHONUSERBASE @CMAKE_INSTALL_PREFIX@)
# set(EGG_CMD env @LIBRARY_PATH@=$ENV{@LIBRARY_PATH@} PYTHONUSERBASE=${PYTHONUSERBASE} @PIP_BINARY@ install --user -v --download-cache @CDAT_PACKAGE_CACHE_DIR@ )
# if (NOT "${PIP_CERTIFICATE}" STREQUAL "")
# set(EGG_CMD ${EGG_CMD} --cert=${PIP_CERTIFICATE})
Expand Down
4 changes: 2 additions & 2 deletions CMake/cdat_modules_extra/ffmpeg_configure_step.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ if (CDAT_BUILD_YASM)
endif()

EXECUTE_PROCESS(
COMMAND sh configure ${_yasmexe} --disable-static --disable-network --disable-zlib --disable-ffserver --disable-ffplay --disable-decoders --enable-shared --enable-swscale --prefix=@ffmpeg_install@
#COMMAND sh configure --prefix=@ffmpeg_install@ ${_yasmexe}
COMMAND sh configure ${_yasmexe} --extra-cxxflags=@ffmpeg_source@ --disable-static --disable-network --disable-zlib --disable-ffserver --disable-ffplay --disable-decoders --enable-shared --enable-swscale --prefix=@ffmpeg_install@
#COMMAND sh configure --prefix=@ffmpeg_install@ ${_yasmexe} --extra-cxxflags=@ffmpeg_source@
WORKING_DIRECTORY "@ffmpeg_source@"
RESULT_VARIABLE rv
)
7 changes: 7 additions & 0 deletions CMake/cdat_modules_extra/install.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,13 @@ SOURCE = 'CDAT'
def get_version():
return Version

def get_prefix():
import os
try:
return os.environ["UVCDAT_SETUP_PATH"]
except KeyError:
raise RuntimeError("UVCDAT environment not configured. Please source the setup_runtime script.")

def runCheck():
import cdat_info,os
if cdat_info.ping_checked is False:
Expand Down
2 changes: 1 addition & 1 deletion CMake/cdat_modules_extra/pyzmq_install_step.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(APPLE)
endif()

execute_process(
COMMAND env @LIBRARY_PATH@="$ENV{LD_LIBRARY_PATH}" "@PYTHON_EXECUTABLE@" setup.py install --zmq=@cdat_EXTERNALS@
COMMAND env @LIBRARY_PATH@="$ENV{LD_LIBRARY_PATH}" "@PYTHON_EXECUTABLE@" setup.py install --zmq=@cdat_EXTERNALS@ --prefix=@PYTHON_SITE_PACKAGES_PREFIX@
WORKING_DIRECTORY "@pyzmq_binary@"
RESULT_VARIABLE res
OUTPUT_VARIABLE pyzmq_OUT
Expand Down
141 changes: 141 additions & 0 deletions CMake/cmake_modules/FindPythonInterp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# - Find python interpreter
# This module finds if Python interpreter is installed and determines where the
# executables are. This code sets the following variables:
#
# PYTHONINTERP_FOUND - Was the Python executable found
# PYTHON_EXECUTABLE - path to the Python interpreter
#
# PYTHON_VERSION_STRING - Python version found e.g. 2.5.2
# PYTHON_VERSION_MAJOR - Python major version found e.g. 2
# PYTHON_VERSION_MINOR - Python minor version found e.g. 5
# PYTHON_VERSION_PATCH - Python patch version found e.g. 2
#
# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of
# version numbers that should be taken into account when searching for Python.
# You need to set this variable before calling find_package(PythonInterp).

#=============================================================================
# Copyright 2005-2010 Kitware, Inc.
# Copyright 2011 Bjoern Ricks <[email protected]>
# Copyright 2012 Rolf Eike Beer <[email protected]>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)

unset(_Python_NAMES)

set(_PYTHON1_VERSIONS 1.6 1.5)
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
set(_PYTHON3_VERSIONS 3.4 3.3 3.2 3.1 3.0)

if(PythonInterp_FIND_VERSION)
if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}")
string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ})
unset(_PYTHON_FIND_OTHER_VERSIONS)
if(NOT PythonInterp_FIND_VERSION_EXACT)
foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
endif()
endforeach()
endif()
unset(_PYTHON_FIND_MAJ_MIN)
unset(_PYTHON_FIND_MAJ)
else()
list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION})
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS})
endif()
else()
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
endif()

list(APPEND _Python_NAMES python)

# Search for the current active python version first
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}
${_PYTHON_FIND_OTHER_VERSIONS}
)

unset(_PYTHON_FIND_OTHER_VERSIONS)
unset(_PYTHON1_VERSIONS)
unset(_PYTHON2_VERSIONS)
unset(_PYTHON3_VERSIONS)

# Search for newest python version if python executable isn't found
if(NOT PYTHON_EXECUTABLE)
foreach(_CURRENT_VERSION ${_Python_VERSIONS})
set(_Python_NAMES python${_CURRENT_VERSION})
if(WIN32)
list(APPEND _Python_NAMES python)
endif()
find_program(PYTHON_EXECUTABLE
NAMES ${_Python_NAMES}
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]
)
endforeach()
endif()

# determine python version string
if(PYTHON_EXECUTABLE)
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
"import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))"
OUTPUT_VARIABLE _VERSION
RESULT_VARIABLE _PYTHON_VERSION_RESULT
ERROR_QUIET)
if(NOT _PYTHON_VERSION_RESULT)
string(REPLACE ";" "." PYTHON_VERSION_STRING "${_VERSION}")
list(GET _VERSION 0 PYTHON_VERSION_MAJOR)
list(GET _VERSION 1 PYTHON_VERSION_MINOR)
list(GET _VERSION 2 PYTHON_VERSION_PATCH)
if(PYTHON_VERSION_PATCH EQUAL 0)
# it's called "Python 2.7", not "2.7.0"
string(REGEX REPLACE "\\.0$" "" PYTHON_VERSION_STRING "${PYTHON_VERSION_STRING}")
endif()
else()
# sys.version predates sys.version_info, so use that
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)"
OUTPUT_VARIABLE _VERSION
RESULT_VARIABLE _PYTHON_VERSION_RESULT
ERROR_QUIET)
if(NOT _PYTHON_VERSION_RESULT)
string(REGEX REPLACE " .*" "" PYTHON_VERSION_STRING "${_VERSION}")
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}")
if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}")
else()
set(PYTHON_VERSION_PATCH "0")
endif()
else()
# sys.version was first documented for Python 1.5, so assume
# this is older.
set(PYTHON_VERSION_STRING "1.4")
set(PYTHON_VERSION_MAJOR "1")
set(PYTHON_VERSION_MAJOR "4")
set(PYTHON_VERSION_MAJOR "0")
endif()
endif()
unset(_PYTHON_VERSION_RESULT)
unset(_VERSION)
endif()

# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)

mark_as_advanced(PYTHON_EXECUTABLE)
Loading

0 comments on commit 71421b7

Please sign in to comment.