From e4ec3029fd75194c73491ea6893929cb146d6c02 Mon Sep 17 00:00:00 2001 From: ana Date: Tue, 3 Dec 2013 14:11:24 +0000 Subject: [PATCH] Porting Salome test system on Windows --- bin/CMakeLists.txt | 3 +- bin/killSalomeWithPort.py | 29 ++++++++++++++----- ...cherUtils.py => salomeLauncherUtils.py.in} | 6 ++-- salome_adm/cmake_files/FindSalomePython.cmake | 4 +++ 4 files changed, 30 insertions(+), 12 deletions(-) rename bin/{salomeLauncherUtils.py => salomeLauncherUtils.py.in} (97%) diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt index b2847db74..c17880a5b 100755 --- a/bin/CMakeLists.txt +++ b/bin/CMakeLists.txt @@ -20,6 +20,7 @@ ADD_SUBDIRECTORY(appliskel) SALOME_CONFIGURE_FILE(VERSION.in VERSION INSTALL ${SALOME_INSTALL_BINS}) +SALOME_CONFIGURE_FILE(salomeLauncherUtils.py.in salomeLauncherUtils.py) # =============================================================== # Files to be installed @@ -48,7 +49,7 @@ SET(SCRIPTS runSession.py runConsole.py salomeConsole.py - salomeLauncherUtils.py + ${CMAKE_CURRENT_BINARY_DIR}/salomeLauncherUtils.py salomeRunner.py salome_session.py salome_utils.py diff --git a/bin/killSalomeWithPort.py b/bin/killSalomeWithPort.py index 71dd45173..23b70628f 100755 --- a/bin/killSalomeWithPort.py +++ b/bin/killSalomeWithPort.py @@ -103,13 +103,20 @@ def appliCleanOmniOrbConfig(port): extension="cfg", hidden=True) if os.access(last_running_config,os.F_OK): - pointedPath = os.readlink(last_running_config) - if pointedPath[0] != '/': - pointedPath=os.path.join(os.path.dirname(last_running_config), pointedPath) - if pointedPath == omniorb_config: - os.unlink(last_running_config) + if not sys.platform == 'win32': + pointedPath = os.readlink(last_running_config) + if pointedPath[0] != '/': + pointedPath=os.path.join(os.path.dirname(last_running_config), pointedPath) + pass + if pointedPath == omniorb_config: + os.unlink(last_running_config) + pass pass - pass + else: + os.remove(last_running_config) + pass + pass + if os.access(omniorb_config,os.F_OK): os.remove(omniorb_config) pass @@ -126,8 +133,14 @@ def appliCleanOmniOrbConfig(port): current=stat.st_atime current_config=f if current_config: - os.symlink(os.path.normpath(current_config), last_running_config) - + if sys.platform == "win32": + import shutil + shutil.copyfile(os.path.normpath(current_config), last_running_config) + pass + else: + os.symlink(os.path.normpath(current_config), last_running_config) + pass + pass pass pass diff --git a/bin/salomeLauncherUtils.py b/bin/salomeLauncherUtils.py.in similarity index 97% rename from bin/salomeLauncherUtils.py rename to bin/salomeLauncherUtils.py.in index 33d867d7f..877bd8cb9 100644 --- a/bin/salomeLauncherUtils.py +++ b/bin/salomeLauncherUtils.py.in @@ -94,12 +94,12 @@ def getScriptsAndArgs(args=[]): currentScript = os.path.abspath(elt) # python script not necessary has .py extension pass if currentScript and callPython: - currentKey = "python "+currentScript + currentKey = "@PYTHONBIN@ "+currentScript scriptArgs.append({currentKey:[]}) callPython = False elif currentScript: if not os.access(currentScript, os.X_OK): - currentKey = "python "+currentScript + currentKey = "@PYTHONBIN@ "+currentScript scriptArgs.append({currentKey:[]}) else: ispython = False @@ -115,7 +115,7 @@ def getScriptsAndArgs(args=[]): except: pass if not ispython and currentScript[-3:] == ".py": - currentKey = "python "+currentScript + currentKey = "@PYTHONBIN@ "+currentScript else: currentKey = currentScript pass diff --git a/salome_adm/cmake_files/FindSalomePython.cmake b/salome_adm/cmake_files/FindSalomePython.cmake index 680f862a5..9fa592048 100644 --- a/salome_adm/cmake_files/FindSalomePython.cmake +++ b/salome_adm/cmake_files/FindSalomePython.cmake @@ -74,6 +74,10 @@ SET(_found1 ${PYTHONINTERP_FOUND}) IF (PYTHONINTERP_FOUND) # Now ensure we find the Python libraries matching the interpreter: # This uses the variable PYTHON_EXECUTABLE + + GET_FILENAME_COMPONENT(_python_bin "${PYTHON_EXECUTABLE}" NAME ) + SET(PYTHONBIN "${_python_bin}" CACHE STRING "Name of Python interpreter") + GET_FILENAME_COMPONENT(_python_dir "${PYTHON_EXECUTABLE}" PATH) GET_FILENAME_COMPONENT(CMAKE_INCLUDE_PATH "${_python_dir}/../include/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}" ABSOLUTE) GET_FILENAME_COMPONENT(CMAKE_LIBRARY_PATH "${_python_dir}/../lib" ABSOLUTE) -- 2.39.2