From b3e2c846a7d3dc93bbe10f0799507b62ec087402 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 23 Oct 2014 14:45:42 +0200 Subject: [PATCH] Make PARAVIEW_ROOT_DIR detection at runtime, not at compile time, to avoid big disillution after packaging --- src/ENGINE/CMakeLists.txt | 7 +------ .../no_wrap/{PVSERVER.py.in => PVSERVER.py} | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) rename src/ENGINE/no_wrap/{PVSERVER.py.in => PVSERVER.py} (92%) diff --git a/src/ENGINE/CMakeLists.txt b/src/ENGINE/CMakeLists.txt index 47dba95a..2d6c8c8c 100644 --- a/src/ENGINE/CMakeLists.txt +++ b/src/ENGINE/CMakeLists.txt @@ -36,12 +36,7 @@ IF(NOT SALOME_PARAVIS_MINIMAL_CORBA) INSTALL(FILES PARAVIS_Engine_i.hh DESTINATION ${SALOME_INSTALL_HEADERS}) ELSE() - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/no_wrap/PVSERVER.py.in ${CMAKE_CURRENT_BINARY_DIR}/PVSERVER.py @ONLY) - SET(_bin_SCRIPTS - ${CMAKE_CURRENT_BINARY_DIR}/PVSERVER.py - no_wrap/PVSERVER_utils.py - ) - + SET(_bin_SCRIPTS no_wrap/PVSERVER.py no_wrap/PVSERVER_utils.py) # --- rules --- SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_PYTHON}) ENDIF() diff --git a/src/ENGINE/no_wrap/PVSERVER.py.in b/src/ENGINE/no_wrap/PVSERVER.py similarity index 92% rename from src/ENGINE/no_wrap/PVSERVER.py.in rename to src/ENGINE/no_wrap/PVSERVER.py index 085c2d3a..fa3fd7d3 100644 --- a/src/ENGINE/no_wrap/PVSERVER.py.in +++ b/src/ENGINE/no_wrap/PVSERVER.py @@ -43,7 +43,6 @@ class PVSERVER_Impl: See the IDL for the documentation. """ MAX_PVSERVER_PORT_TRIES = 10 - PARAVIEW_ROOT_DIR = "@PARAVIEW_ROOT_DIR@" PVSERVER_DEFAULT_PORT = 11111 def __init__(self): @@ -51,7 +50,20 @@ class PVSERVER_Impl: self.pvserverPop = None # Popen object from subprocess module self.lastTrace = "" self.isGUIConnected = False # whether there is an active connection from the GUI. - + try: + import paraview + tmp=paraview.__file__ + except: + raise Exception("PVSERVER_Impl.__init__ : \"import paraview\" failed !") + # deduce dynamically PARAVIEW_ROOT_DIR from the paraview module location + self.PARAVIEW_ROOT_DIR = None + ZE_KEY_TO_FIND_PV_ROOT_DIR="lib" + li=tmp.split(os.path.sep) ; li.reverse() + if ZE_KEY_TO_FIND_PV_ROOT_DIR not in li: + raise Exception("PVSERVER_Impl.__init__ : error during dynamic deduction of PARAVIEW_ROOT_DIR : Loc of paraview module is \"%s\" ! \"%s\" is supposed to be the key to deduce it !"%(tmp,ZE_KEY_TO_FIND_PV_ROOT_DIR)) + li=li[li.index("lib")+1:] ; li.reverse() + self.PARAVIEW_ROOT_DIR = os.path.sep.join(li) + """ Private. Identify a free port to launch the PVServer. """ -- 2.39.2