Blob Blame Raw
diff -up openwsman-2.6.2/bindings/CMakeLists.txt.orig openwsman-2.6.2/bindings/CMakeLists.txt
--- openwsman-2.6.2/bindings/CMakeLists.txt.orig	2015-10-19 15:27:46.000000000 +0200
+++ openwsman-2.6.2/bindings/CMakeLists.txt	2016-08-10 11:55:36.588710280 +0200
@@ -10,6 +10,7 @@ include_directories(${CMAKE_BINARY_DIR})
 
 IF( BUILD_PYTHON )
 add_subdirectory(python)
+add_subdirectory(python3)
 ENDIF( BUILD_PYTHON )
 
 IF( BUILD_RUBY )
diff -up openwsman-2.6.2/bindings/python3/CMakeLists.txt.orig openwsman-2.6.2/bindings/python3/CMakeLists.txt
--- openwsman-2.6.2/bindings/python3/CMakeLists.txt.orig	2016-08-10 11:55:36.577710278 +0200
+++ openwsman-2.6.2/bindings/python3/CMakeLists.txt	2016-08-10 15:15:46.005991322 +0200
@@ -12,11 +12,28 @@ enable_testing()
 
 add_subdirectory(tests)
 
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" OUTPUT_VARIABLE PYTHON_LIB_DIR)
-STRING(REPLACE "\n" "" PYTHON_LIB_DIR "${PYTHON_LIB_DIR}")
+MESSAGE(STATUS "Python3 build:")
+unset(Python_ADDITIONAL_VERSIONS)
+set(Python_ADDITIONAL_VERSIONS 3.5)
+FIND_PACKAGE(PythonLibs)
+IF (PYTHON_LIBRARY)
+  FIND_PACKAGE(PythonInterp REQUIRED)
+  #MESSAGE(STATUS "Found PythonLibs...")
+  FIND_PACKAGE(PythonLinkLibs)
+  #IF (PYTHON_LINK_LIBS)
+  #  MESSAGE(STATUS "Building Python...")
+  #ENDIF (PYTHON_LINK_LIBS)
+ENDIF (PYTHON_LIBRARY)
+
+set(PYTHON3_EXECUTABLE "${PYTHON_EXECUTABLE}")
+set(PYTHON3_INCLUDE_DIRS "${PYTHON_INCLUDE_DIRS}")
+set({PYTHON3_INCLUDE_PATH "${PYTHON_INCLUDE_PATH}")
 
-MESSAGE(STATUS "Python executable: ${PYTHON_EXECUTABLE}")
-MESSAGE(STATUS "Python lib dir: ${PYTHON_LIB_DIR}")
+EXECUTE_PROCESS(COMMAND ${PYTHON3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))" OUTPUT_VARIABLE PYTHON3_LIB_DIR)
+STRING(REPLACE "\n" "" PYTHON3_LIB_DIR "${PYTHON3_LIB_DIR}")
+
+MESSAGE(STATUS "Python executable: ${PYTHON3_EXECUTABLE}")
+MESSAGE(STATUS "Python lib dir: ${PYTHON3_LIB_DIR}")
 
 SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/openwsman_wrap.c" )
 
@@ -36,14 +53,14 @@ SET(pywsman_SRCS ${SWIG_OUTPUT} ${CMAKE_
 ADD_LIBRARY( pywsman SHARED ${pywsman_SRCS} )
 SET_TARGET_PROPERTIES( pywsman PROPERTIES PREFIX "_" )
 
-INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_DIRS} )
+INCLUDE_DIRECTORIES( ${PYTHON3_INCLUDE_DIRS} )
 # RHEL5 needs this:
-INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} )
+INCLUDE_DIRECTORIES( ${PYTHON3_INCLUDE_PATH} )
 INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
 INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/bindings ${CMAKE_SOURCE_DIR}/include )
 
 TARGET_LINK_LIBRARIES( pywsman wsman )
 TARGET_LINK_LIBRARIES( pywsman wsman_client )
 
-INSTALL(TARGETS pywsman LIBRARY DESTINATION ${PYTHON_LIB_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pywsman.py DESTINATION ${PYTHON_LIB_DIR} )
+INSTALL(TARGETS pywsman LIBRARY DESTINATION ${PYTHON3_LIB_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pywsman.py DESTINATION ${PYTHON3_LIB_DIR} )
diff -up openwsman-2.6.2/bindings/python/CMakeLists.txt.orig openwsman-2.6.2/bindings/python/CMakeLists.txt
--- openwsman-2.6.2/bindings/python/CMakeLists.txt.orig	2015-10-19 15:27:46.000000000 +0200
+++ openwsman-2.6.2/bindings/python/CMakeLists.txt	2016-08-10 15:00:21.126141161 +0200
@@ -12,11 +12,52 @@ enable_testing()
 
 add_subdirectory(tests)
 
-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" OUTPUT_VARIABLE PYTHON_LIB_DIR)
-STRING(REPLACE "\n" "" PYTHON_LIB_DIR "${PYTHON_LIB_DIR}")
+MESSAGE(STATUS "Python2 build:")
+set(Python_ADDITIONAL_VERSIONS 2.7)
+FIND_PACKAGE(PythonLibs)
+IF (PYTHON_LIBRARY)
+  FIND_PACKAGE(PythonInterp REQUIRED)
+  #MESSAGE(STATUS "Found PythonLibs...")
+  FIND_PACKAGE(PythonLinkLibs)
+  #IF (PYTHON_LINK_LIBS)
+  #  MESSAGE(STATUS "Building Python...")
+  #ENDIF (PYTHON_LINK_LIBS)
+ENDIF (PYTHON_LIBRARY)
+
+set(PYTHON2_EXECUTABLE "${PYTHON_EXECUTABLE}")
+set(PYTHON2_INCLUDE_DIRS "${PYTHON_INCLUDE_DIRS}")
+set(PYTHON2_INCLUDE_PATH "${PYTHON_INCLUDE_PATH}")
+
+# clear FIND_PACKAGE(PythonLibs) side effects
+unset(PYTHONLIBS_FOUND)
+unset(PYTHON_LIBRARIES)
+unset(PYTHON_INCLUDE_PATH)
+unset(PYTHON_INCLUDE_DIRS)
+unset(PYTHON_DEBUG_LIBRARIES)
+unset(PYTHONLIBS_VERSION_STRING)
+unset(PYTHON_DEBUG_LIBRARY CACHE)
+unset(PYTHON_LIBRARY)
+unset(PYTHON_LIBRARY_DEBUG)
+unset(PYTHON_LIBRARY_RELEASE)
+unset(PYTHON_LIBRARY CACHE)
+unset(PYTHON_LIBRARY_DEBUG CACHE)
+unset(PYTHON_LIBRARY_RELEASE CACHE)
+unset(PYTHON_INCLUDE_DIR CACHE)
+unset(PYTHON_INCLUDE_DIR2 CACHE)
+
+# clear FIND_PACKAGE(PythonInterp) side effects
+unset(PYTHONINTERP_FOUND)
+unset(PYTHON_EXECUTABLE CACHE)
+unset(PYTHON_VERSION_STRING)
+unset(PYTHON_VERSION_MAJOR)
+unset(PYTHON_VERSION_MINOR)
+unset(PYTHON_VERSION_PATCH)
 
-MESSAGE(STATUS "Python executable: ${PYTHON_EXECUTABLE}")
-MESSAGE(STATUS "Python lib dir: ${PYTHON_LIB_DIR}")
+EXECUTE_PROCESS(COMMAND ${PYTHON2_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" OUTPUT_VARIABLE PYTHON2_LIB_DIR)
+STRING(REPLACE "\n" "" PYTHON2_LIB_DIR "${PYTHON2_LIB_DIR}")
+
+MESSAGE(STATUS "Python executable: ${PYTHON2_EXECUTABLE}")
+MESSAGE(STATUS "Python lib dir: ${PYTHON2_LIB_DIR}")
 
 SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/openwsman_wrap.c" )
 
@@ -36,14 +77,14 @@ SET(pywsman_SRCS ${SWIG_OUTPUT} ${CMAKE_
 ADD_LIBRARY( pywsman SHARED ${pywsman_SRCS} )
 SET_TARGET_PROPERTIES( pywsman PROPERTIES PREFIX "_" )
 
-INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_DIRS} )
+INCLUDE_DIRECTORIES( ${PYTHON2_INCLUDE_DIRS} )
 # RHEL5 needs this:
-INCLUDE_DIRECTORIES( ${PYTHON_INCLUDE_PATH} )
+INCLUDE_DIRECTORIES( ${PYTHON2_INCLUDE_PATH} )
 INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
 INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/bindings ${CMAKE_SOURCE_DIR}/include )
 
 TARGET_LINK_LIBRARIES( pywsman wsman )
 TARGET_LINK_LIBRARIES( pywsman wsman_client )
 
-INSTALL(TARGETS pywsman LIBRARY DESTINATION ${PYTHON_LIB_DIR})
-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pywsman.py DESTINATION ${PYTHON_LIB_DIR} )
+INSTALL(TARGETS pywsman LIBRARY DESTINATION ${PYTHON2_LIB_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pywsman.py DESTINATION ${PYTHON2_LIB_DIR} )
diff -up openwsman-2.6.2/CMakeLists.txt.orig openwsman-2.6.2/CMakeLists.txt
--- openwsman-2.6.2/CMakeLists.txt.orig	2015-10-19 15:27:46.000000000 +0200
+++ openwsman-2.6.2/CMakeLists.txt	2016-08-10 11:55:36.588710280 +0200
@@ -168,30 +168,6 @@ MESSAGE(STATUS "Building Ruby bindings"
  ENDIF(NOT RUBY_INCLUDE_PATH )
 ENDIF( BUILD_RUBY )
 
-IF( BUILD_PYTHON )
-  MESSAGE(STATUS "Building Python bindings" )
-  FIND_PACKAGE(PythonLibs)
-  IF (PYTHON_LIBRARY)
-    FIND_PACKAGE(PythonInterp REQUIRED)
-    MESSAGE(STATUS "Found PythonLibs...")
-    FIND_PACKAGE(PythonLinkLibs)
-    IF (PYTHON_LINK_LIBS)
-      MESSAGE(STATUS "Building Python...")
-    ENDIF (PYTHON_LINK_LIBS)
-  ENDIF (PYTHON_LIBRARY)
-  IF(NOT PYTHON_INCLUDE_DIRS )
-    # fallback for older versions of cmake
-    SET(PYTHON_INCLUDE_DIRS PYTHON_INCLUDE_PATH)
-  ENDIF(NOT PYTHON_INCLUDE_DIRS )
-  IF(NOT PYTHON_INCLUDE_DIRS )
-    IF(BUILD_PYTHON_EXPLICIT)
-      NO_HEADERS_WARNING_EXPL(BUILD_PYTHON Python)
-    ELSE(BUILD_PYTHON_EXPLICIT)
-      NO_HEADERS_WARNING(BUILD_PYTHON Python)
-    ENDIF(BUILD_PYTHON_EXPLICIT)
-  ENDIF(NOT PYTHON_INCLUDE_DIRS )
-ENDIF( BUILD_PYTHON )
-
 IF( BUILD_PERL )
   INCLUDE(FindPerl)
   IF(PERL_EXECUTABLE)