From cf2a66b24a3376fa7bbcf50af39594d316a7a1e6 Mon Sep 17 00:00:00 2001 From: adam Date: Wed, 29 Oct 2008 09:24:34 +0000 Subject: [PATCH] [E.A.] Fix the python2.5 problem only. --- salome_adm/cmake_files/FindPYTHON.cmake | 18 +++++++++--------- salome_adm/cmake_files/am2cmake.py | 16 ++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/salome_adm/cmake_files/FindPYTHON.cmake b/salome_adm/cmake_files/FindPYTHON.cmake index b57878b7c..2f6bff9da 100644 --- a/salome_adm/cmake_files/FindPYTHON.cmake +++ b/salome_adm/cmake_files/FindPYTHON.cmake @@ -5,27 +5,27 @@ ELSE(WINDOWS) FIND_PROGRAM(PYTHON_EXECUTABLE python) ENDIF(WINDOWS) +EXECUTE_PROCESS( + COMMAND python -c "import sys; sys.stdout.write(sys.version[:3])" + OUTPUT_VARIABLE PYTHON_VERSION + ) + SET(PYTHON_ROOT ${PYTHON_EXECUTABLE}) GET_FILENAME_COMPONENT(PYTHON_ROOT ${PYTHON_ROOT} PATH) GET_FILENAME_COMPONENT(PYTHON_ROOT ${PYTHON_ROOT} PATH) -FIND_PATH(PYTHON_INCLUDE_PATH Python.h PATHS ${PYTHON_ROOT}/include ${PYTHON_ROOT}/include/python2.5) +FIND_PATH(PYTHON_INCLUDE_PATH Python.h PATHS ${PYTHON_ROOT}/include ${PYTHON_ROOT}/include/python${PYTHON_VERSION}) IF(WINDOWS) - FIND_LIBRARY(PYTHON_LIBRARIES python25_d ${PYTHON_ROOT}/libs) + STRING(REPLACE "." "" PYTHON_VERSION_WITHOUT_DOT ${PYTHON_VERSION}) + FIND_LIBRARY(PYTHON_LIBRARIES python${PYTHON_VERSION_WITHOUT_DOT}_d ${PYTHON_ROOT}/libs) ELSE(WINDOWS) - FIND_LIBRARY(PYTHON_LIBRARIES python2.5 ${PYTHON_ROOT}/lib) + FIND_LIBRARY(PYTHON_LIBRARIES python${PYTHON_VERSION} ${PYTHON_ROOT}/lib) ENDIF(WINDOWS) SET(PYTHON_INCLUDES -I${PYTHON_INCLUDE_PATH}) SET(PYTHON_LIBS ${PYTHON_LIBRARIES}) -IF(WINDOWS) - SET(PYTHON_VERSION python2.5) -ELSE(WINDOWS) - GET_FILENAME_COMPONENT(PYTHON_VERSION ${PYTHON_INCLUDE_PATH} NAME) -ENDIF(WINDOWS) - IF(WINDOWS) SET(PYTHON_INCLUDES ${PYTHON_INCLUDES} -DHAVE_DEBUG_PYTHON) ENDIF(WINDOWS) diff --git a/salome_adm/cmake_files/am2cmake.py b/salome_adm/cmake_files/am2cmake.py index 5a3054f4e..a2d5bd0a6 100644 --- a/salome_adm/cmake_files/am2cmake.py +++ b/salome_adm/cmake_files/am2cmake.py @@ -494,7 +494,7 @@ class CMakeFile(object): SET(IDL_HEADER ${CMAKE_CURRENT_BINARY_DIR}/${base}.hh) install(FILES ${IDL_HEADER} DESTINATION include/salome) INSTALL(CODE "SET(IDL_FILE ${input})") - INSTALL(CODE "SET(DIR lib/${PYTHON_VERSION}/site-packages/salome)") + INSTALL(CODE "SET(DIR lib/python${PYTHON_VERSION}/site-packages/salome)") INSTALL(CODE "SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})") INSTALL(CODE "SET(OMNIORB_IDL_PYTHON ${OMNIORB_IDL_PYTHON})") INSTALL(CODE "SET(IDLPYFLAGS ${IDLPYFLAGS})") @@ -615,9 +615,9 @@ class CMakeFile(object): "dist_salomescript_DATA" : "bin/salome", "dist_salomescript_PYTHON" : "bin/salome", "nodist_salomescript_DATA" : "bin/salome", - "salomepython_PYTHON" : "lib/python2.5/site-packages/salome", - "nodist_salomepython_PYTHON" : "lib/python2.5/site-packages/salome", - "sharedpkgpython_PYTHON" : "lib/python2.5/site-packages/salome/shared_modules", + "salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome", + "nodist_salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome", + "sharedpkgpython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules", } for key, value in d.items(): if self.__thedict__.has_key(key): @@ -792,13 +792,13 @@ class CMakeFile(object): ENDIF(name STREQUAL SalomePyQt) ELSE(BEGIN_WITH_lib) IF(WINDOWS) - INSTALL(TARGETS ${name} DESTINATION lib/python2.5/site-packages/salome) + INSTALL(TARGETS ${name} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome) ELSE(WINDOWS) GET_TARGET_PROPERTY(version ${name} VERSION) GET_TARGET_PROPERTY(soversion ${name} SOVERSION) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION lib/python2.5/site-packages/salome RENAME ${name}.so.${version}) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION lib/python2.5/site-packages/salome RENAME ${name}.so.${soversion}) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION lib/python2.5/site-packages/salome RENAME ${name}.so) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}.so.${version}) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}.so.${soversion}) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}.so) ENDIF(WINDOWS) ENDIF(BEGIN_WITH_lib) ''') -- 2.39.2