From e3d0e0bd40a279f77d2c23efd0d05610480bcd44 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 12 Nov 2010 10:22:22 +0000 Subject: [PATCH] Merge from V5_1_5_BR branch 12/11/2010 --- bin/setenv.py | 7 + configure.ac | 17 +- doc/docutils/Makefile.am | 2 +- idl/Makefile.am | 6 +- idl/SALOMEDS_Attributes.idl | 10 +- salome_adm/cmake_files/FindKERNEL.cmake | 15 +- salome_adm/cmake_files/FindPYTHON.cmake | 21 ++ salome_adm/cmake_files/FindSWIG.cmake | 6 + salome_adm/cmake_files/Makefile.am | 1 + salome_adm/cmake_files/am2cmake.py | 267 +++++++++++++++--- salome_adm/cmake_files/copytree1.py | 91 ++++++ salome_adm/unix/config_files/check_omniorb.m4 | 2 +- salome_adm/unix/config_files/check_vtk.m4 | 2 +- salome_adm/unix/config_files/hack_libtool.m4 | 2 +- salome_adm/unix/config_files/python.m4 | 12 + src/Container/SALOME_Container.py | 2 +- src/Container/SALOME_ContainerManager.cxx | 32 +-- src/Container/SALOME_PyNode.py | 4 +- src/KERNEL_PY/import_hook.py | 20 +- src/KERNEL_PY/kernel/studyedit.py | 4 +- src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx | 8 +- src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py | 17 +- .../Test/testcontainermanager.py | 30 +- .../Test/testresourcemanager.py | 42 +-- src/NamingService/SALOME_NamingService.cxx | 8 +- src/SALOMEDS/SALOMEDS_Study_i.cxx | 7 +- 26 files changed, 506 insertions(+), 129 deletions(-) create mode 100755 salome_adm/cmake_files/copytree1.py diff --git a/bin/setenv.py b/bin/setenv.py index 493bd0b4f..59fa58528 100755 --- a/bin/setenv.py +++ b/bin/setenv.py @@ -194,6 +194,13 @@ def set_env(args, modules_list, modules_root_dir, silent=False): python_version,"site-packages", salome_subdir), "PYTHONPATH") + import platform + if platform.machine() == "x86_64": + add_path(os.path.join(module_root_dir,"lib64", + python_version,"site-packages", + salome_subdir), + "PYTHONPATH") + pass add_path(os.path.join(module_root_dir,get_lib_dir(), python_version,"site-packages", salome_subdir, diff --git a/configure.ac b/configure.ac index 7e6479505..d7ab30eb8 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ # ================================================================ #AC_PREREQ(2.59) # -AC_INIT([Salome2 Project], [5.1.4], [paul.rascle@edf.fr], [SalomeKERNEL]) +AC_INIT([Salome2 Project], [5.1.5], [paul.rascle@edf.fr], [SalomeKERNEL]) # AC_CONFIG_AUX_DIR defines an alternative directory where to find the auxiliary # scripts such as config.guess, install-sh, ... @@ -513,6 +513,19 @@ echo generating Makefiles and configure files echo --------------------------------------------- echo +AC_CONFIG_COMMANDS([hack_libtool],[ +sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\ + if test \"\$(echo \$[@] | grep -E '\\\-L/usr/lib(/../lib)?(64)? ')\" == \"\" \n\ + then\n\ + cmd=\"\1 \$[@]\"\n\ + else\n\ + cmd=\"\1 \"\`echo \$[@] | sed -r -e 's|(.*)-L/usr/lib(/../lib)?(64)? (.*)|\\\1\\\4 -L/usr/lib\\\3|g'\`\n\ + fi\n\ + \$cmd\n\ +}\n\ +CC=\"hack_libtool\"%g" libtool +],[]) + # This list is initiated using autoscan and must be updated manually # when adding a new file .in to manage. When you execute # autoscan, the Makefile list is generated in the output file configure.scan. @@ -599,5 +612,3 @@ AC_OUTPUT([ \ src/Utils/Makefile \ src/Utils/Test/Makefile \ ]) - -AC_HACK_LIBTOOL diff --git a/doc/docutils/Makefile.am b/doc/docutils/Makefile.am index 84bfcf104..5db2edb5a 100644 --- a/doc/docutils/Makefile.am +++ b/doc/docutils/Makefile.am @@ -41,7 +41,7 @@ SPHINXBUILD = sphinx-build PAPEROPT_a4 = -D latex_paper_size=a4 ALLSPHINXOPTS = -d doctrees $(PAPEROPT_a4) $(SPHINXOPTS) $(SOURCEDIR) -SPHINX_PYTHONPATH = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(prefix)/bin/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages +SPHINX_PYTHONPATH = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(prefix)/lib64/python$(PYTHON_VERSION)/site-packages/salome:$(prefix)/bin/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages:$(OMNIORB_ROOT)/lib64/python$(PYTHON_VERSION)/site-packages SPHINX_LD_LIBRARY_PATH = $(OMNIORB_ROOT)/lib diff --git a/idl/Makefile.am b/idl/Makefile.am index 19f18e09c..f6ecf89b1 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -104,7 +104,8 @@ BASEIDL_SOURCES =\ Calcium_PortsSK.cc \ Palm_PortsSK.cc \ SALOME_PACOExtensionSK.cc \ - SALOME_ParamPortsSK.cc + SALOME_ParamPortsSK.cc \ + SALOME_ParametricSK.cc DYNIDL_SRCS = \ SALOME_PortsDynSK.cc Calcium_PortsDynSK.cc SALOME_ContainerManagerDynSK.cc \ @@ -112,7 +113,8 @@ DYNIDL_SRCS = \ SALOMEDSDynSK.cc SALOME_SessionDynSK.cc SALOME_RessourcesCatalogDynSK.cc \ DSC_EnginesDynSK.cc SALOME_ComponentDynSK.cc SALOME_GenericObjDynSK.cc SALOME_TypesDynSK.cc \ Palm_PortsDynSK.cc SALOME_ExceptionDynSK.cc SALOMEDS_AttributesDynSK.cc \ - LoggerDynSK.cc SALOME_PACOExtensionDynSK.cc SALOME_ParamPortsDynSK.cc SALOME_PyNodeDynSK.cc + LoggerDynSK.cc SALOME_PACOExtensionDynSK.cc SALOME_ParamPortsDynSK.cc SALOME_PyNodeDynSK.cc \ + SALOME_ParametricDynSK.cc MPIIDL_SOURCES = \ SALOME_MPIObjectSK.cc \ diff --git a/idl/SALOMEDS_Attributes.idl b/idl/SALOMEDS_Attributes.idl index 39130e2c3..bd40d4277 100644 --- a/idl/SALOMEDS_Attributes.idl +++ b/idl/SALOMEDS_Attributes.idl @@ -238,8 +238,14 @@ module SALOMEDS /*! \brief Comment attribute - The attribute stores a string value containing supplementary information about - the SObject. In particular it contains the data type of the %SComponent. + The attribute stores arbitrary string value containing supplementary information about + the SObject. This is common-usage attribute that can be used for any purpose. + + There is only one explicit limitation: for the SComponent %object representing + the root item of the SALOME component tree, the AttributeComment is used to store + component data type value. This attribute is automatically set with NewComponent() + function of StudyBuilder. Also, the value of this attribute is returned by the + ComponentDataType() function of SComponent interface. See \ref example6 for an example of this attribute usage in batchmode of %SALOME application. diff --git a/salome_adm/cmake_files/FindKERNEL.cmake b/salome_adm/cmake_files/FindKERNEL.cmake index ebbf458ee..5ad2994fa 100644 --- a/salome_adm/cmake_files/FindKERNEL.cmake +++ b/salome_adm/cmake_files/FindKERNEL.cmake @@ -22,29 +22,42 @@ SET(KERNEL_CXXFLAGS -I${KERNEL_ROOT_DIR}/include/salome) +FIND_LIBRARY(CalciumC CalciumC ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(DF DF ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(Launcher Launcher ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(LifeCycleCORBATest LifeCycleCORBATest ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(NamingServiceTest NamingServiceTest ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(OpUtil OpUtil ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(Registry Registry ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(ResourcesManager ResourcesManager ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SALOMEBasics SALOMEBasics ${KERNEL_ROOT_DIR}/lib/salome) -FIND_LIBRARY(SalomeBatch SalomeBatch ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeCatalog SalomeCatalog ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeCommunication SalomeCommunication ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeContainer SalomeContainer ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SalomeDatastream SalomeDatastream ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeDSCContainer SalomeDSCContainer ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeDSClient SalomeDSClient ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SalomeDSCSupervBasic SalomeDSCSupervBasic ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SalomeDSCSuperv SalomeDSCSuperv ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeDSImpl SalomeDSImpl ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SALOMEDSImplTest SALOMEDSImplTest ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeDS SalomeDS ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SALOMEDSTest SALOMEDSTest ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeGenericObj SalomeGenericObj ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeHDFPersist SalomeHDFPersist ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeIDLKernel SalomeIDLKernel ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeLauncher SalomeLauncher ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeLifeCycleCORBA SalomeLifeCycleCORBA ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SALOMELocalTrace SALOMELocalTrace ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SALOMELocalTraceTest SALOMELocalTraceTest ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeLoggerServer SalomeLoggerServer ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SalomeMPIContainer SalomeMPIContainer ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeNotification SalomeNotification ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeNS SalomeNS ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(SalomeResourcesManager SalomeResourcesManager ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SalomeTestComponentEngine SalomeTestComponentEngine ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SalomeTestMPIComponentEngine SalomeTestMPIComponentEngine ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(SALOMETraceCollectorTest SALOMETraceCollectorTest ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(TOOLSDS TOOLSDS ${KERNEL_ROOT_DIR}/lib/salome) +FIND_LIBRARY(UtilsTest UtilsTest ${KERNEL_ROOT_DIR}/lib/salome) FIND_LIBRARY(with_loggerTraceCollector with_loggerTraceCollector ${KERNEL_ROOT_DIR}/lib/salome) diff --git a/salome_adm/cmake_files/FindPYTHON.cmake b/salome_adm/cmake_files/FindPYTHON.cmake index 9c4bfeb4e..1748b93c3 100644 --- a/salome_adm/cmake_files/FindPYTHON.cmake +++ b/salome_adm/cmake_files/FindPYTHON.cmake @@ -199,8 +199,29 @@ ENDIF(PYTHON_STATUS) # ---- +SET(NUMPY_STATUS 0) +IF(PYTHON_STATUS) + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c "import numpy ; import sys ; sys.stdout.write(numpy.get_include())" + OUTPUT_VARIABLE NUMPY_INCLUDE_DIR + ERROR_QUIET + ) + IF(NUMPY_INCLUDE_DIR) + SET(NUMPY_STATUS 1) + ENDIF(NUMPY_INCLUDE_DIR) + IF(NUMPY_STATUS) + SET(PYTHON_INCLUDES ${PYTHON_INCLUDES} -I${NUMPY_INCLUDE_DIR}) + MESSAGE(STATUS "numpy found : ${NUMPY_INCLUDE_DIR}") + ELSE(NUMPY_STATUS) + MESSAGE(STATUS "numpy not found") + ENDIF(NUMPY_STATUS) +ENDIF(PYTHON_STATUS) + +# ---- + IF(PYTHON_STATUS) SET(PYTHON_CPPFLAGS ${PYTHON_INCLUDES}) + SET(PYLOGLEVEL WARNING) ELSE(PYTHON_STATUS) IF(PYTHON_IS_MANDATORY) MESSAGE(FATAL_ERROR "python not found ... mandatory ... abort") diff --git a/salome_adm/cmake_files/FindSWIG.cmake b/salome_adm/cmake_files/FindSWIG.cmake index 8f06c4e47..ed19d078f 100644 --- a/salome_adm/cmake_files/FindSWIG.cmake +++ b/salome_adm/cmake_files/FindSWIG.cmake @@ -91,3 +91,9 @@ ELSE(SWIG_STATUS) ENDIF(SWIG_STATUS) # ---- + +IF(NUMPY_STATUS) + SET(SWIG_FLAGS ${SWIG_FLAGS} -DWITH_NUMPY=WITH_NUMPY) +ENDIF(NUMPY_STATUS) + +# ---- diff --git a/salome_adm/cmake_files/Makefile.am b/salome_adm/cmake_files/Makefile.am index 2c2772d47..b08680ccb 100644 --- a/salome_adm/cmake_files/Makefile.am +++ b/salome_adm/cmake_files/Makefile.am @@ -24,6 +24,7 @@ include $(top_srcdir)/salome_adm/unix/make_common_starter.am dist_salome_cmake_DATA = \ am2cmake.py \ +copytree1.py \ FindBOOST.cmake \ FindCPPUNIT.cmake \ FindDOXYGEN.cmake \ diff --git a/salome_adm/cmake_files/am2cmake.py b/salome_adm/cmake_files/am2cmake.py index 5ee9e8e0f..9fb8632dc 100644 --- a/salome_adm/cmake_files/am2cmake.py +++ b/salome_adm/cmake_files/am2cmake.py @@ -205,31 +205,44 @@ class CMakeFile(object): "vtkImagingPythonD", ] kernel_list = [ + "CalciumC", "DF", "Launcher", + "LifeCycleCORBATest", + "NamingServiceTest", "OpUtil", "Registry", "ResourcesManager", "SALOMEBasics", - "SalomeBatch", "SalomeCatalog", "SalomeCommunication", "SalomeContainer", + "SalomeDatastream", "SalomeDSCContainer", "SalomeDSClient", + "SalomeDSCSupervBasic", + "SalomeDSCSuperv", "SalomeDSImpl", + "SALOMEDSImplTest", "SalomeDS", + "SALOMEDSTest", "SalomeGenericObj", "SalomeHDFPersist", "SalomeIDLKernel", "SalomeLauncher", "SalomeLifeCycleCORBA", "SALOMELocalTrace", + "SALOMELocalTraceTest", "SalomeLoggerServer", + "SalomeMPIContainer", "SalomeNotification", "SalomeNS", "SalomeResourcesManager", + "SalomeTestComponentEngine", + "SalomeTestMPIComponentEngine", + "SALOMETraceCollectorTest", "TOOLSDS", + "UtilsTest", "with_loggerTraceCollector", ] gui_list = [ @@ -243,6 +256,7 @@ class CMakeFile(object): "LogWindow", "ObjBrowser", "OCCViewer", + "OpenGLUtils", "Plot2d", "PyConsole", "PyInterp", @@ -250,9 +264,14 @@ class CMakeFile(object): "qtx", "QxScene", "SalomeApp", + "SalomeAppTest", "SalomeIDLGUI", "SalomeObject", "SalomePrs", + "SalomePyQtGUILight", + "SalomePyQtGUI", + "SalomePyQt", + "SalomePy", "SalomeSession", "SalomeStyle", "SOCC", @@ -263,9 +282,11 @@ class CMakeFile(object): "SUPERVGraph", "SVTK", "ToolsGUI", + "ViewerTools", "VTKViewer", ] geom_list = [ + "AdvancedGUI", "BasicGUI", "BlocksGUI", "BooleanGUI", @@ -295,6 +316,7 @@ class CMakeFile(object): "MeasureGUI", "NMTDS", "NMTTools", + "OCC2VTK", "OperationGUI", "PrimitiveGUI", "RepairGUI", @@ -304,6 +326,7 @@ class CMakeFile(object): "STEPImport", "STLExport", "TransformationGUI", + "VTKExport", ] med_list = [ "interpkernel", @@ -332,6 +355,7 @@ class CMakeFile(object): "paramedmem", "ParaMEDMEMTest", "SalomeIDLMED", + "SalomeIDLMEDTests", ] smesh_list = [ "GeomSelectionTools", @@ -615,8 +639,6 @@ class CMakeFile(object): newlines.append(""" SET(WITH_LOCAL 1) SET(WITH_BATCH 1) - set(VERSION 5.1.4) - set(XVERSION 0x050104) SET(CALCIUM_IDL_INT_F77 long) SET(CALCIUM_CORBA_INT_F77 CORBA::Long) SET(LONG_OR_INT int) @@ -632,8 +654,6 @@ class CMakeFile(object): SET(ENABLE_PYCONSOLE ON) SET(ENABLE_SUPERVGRAPHVIEWER ON) SET(ENABLE_QXGRAPHVIEWER ON) - set(VERSION 5.1.4) - set(XVERSION 0x050104) """) pass elif self.module == "geom": @@ -726,6 +746,10 @@ class CMakeFile(object): """) pass # -- + newlines.append(""" + set(VERSION 5.1.5) + set(XVERSION 0x050105) + """) pass # -- newlines.append(""" @@ -735,6 +759,9 @@ class CMakeFile(object): SET(AM_CPPFLAGS) SET(AM_CXXFLAGS) SET(LDADD) + SET(pythondir lib/python${PYTHON_VERSION}/site-packages) + SET(salomepythondir ${pythondir}/salome) + SET(salomepypkgdir ${salomepythondir}/salome) """) if self.module == "netgen": newlines.append(r''' @@ -958,10 +985,57 @@ class CMakeFile(object): return def finalize(self, newlines): - + # -- # Convert the .in files in build dir # -- + + import operator + mod = self.module + if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'): + newlines.append(r''' + SET(top_builddir + ${CMAKE_BINARY_DIR} + ) + SET(top_srcdir + ${CMAKE_SOURCE_DIR} + ) + SET(srcdir + ${CMAKE_CURRENT_SOURCE_DIR} + ) + SET(builddir + ${CMAKE_CURRENT_BINARY_DIR} + ) + SET(datadir + ${CMAKE_INSTALL_PREFIX}/share + ) + SET(docdir + ${datadir}/doc/salome + ) + ''') + self.files.append("static/header.html.in") + elif self.root[-len(mod):] == mod.upper() and operator.contains(self.root, 'doc') or mod in ['kernel', 'gui', 'geom', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui': + newlines.append(r''' + SET(top_builddir + ${CMAKE_BINARY_DIR} + ) + SET(top_srcdir + ${CMAKE_SOURCE_DIR} + ) + SET(srcdir + ${CMAKE_CURRENT_SOURCE_DIR} + ) + SET(builddir + ${CMAKE_CURRENT_BINARY_DIR} + ) + SET(datadir + ${CMAKE_INSTALL_PREFIX}/share + ) + SET(docdir + ${datadir}/doc/salome + ) + ''') + self.files.append("static/header.html.in") if self.module == "yacs": key = "salomegui" if self.root[-len(key):] == key: @@ -970,6 +1044,8 @@ class CMakeFile(object): pass for f in self.files: if f[-3:] == ".in": + if self.module == 'yacs' and f == "Doxyfile.in": + continue if f == "sstream.in": continue if f in ["runContainer.in", "stopContainer.in"]: @@ -995,7 +1071,104 @@ class CMakeFile(object): ''') pass pass - + + # -- + # add commands for generating of user's documentation + # -- + + upmod = self.module.upper() + doc_gui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/%s"%(upmod) + doc_tui_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome/tui/%s"%(upmod) + doc_destination = "${CMAKE_INSTALL_PREFIX}/share/doc/salome" + head_source = "${CMAKE_CURRENT_SOURCE_DIR}/images/head.png" + if mod == 'kernel': + copytree_src = "${CMAKE_SOURCE_DIR}/salome_adm/cmake_files" + else: + copytree_src = "$ENV{KERNEL_ROOT_DIR}/salome_adm/cmake_files" + str = "import re \nimport sys \noutfile = open(sys.argv[1], 'wb') \nfor line in open(sys.argv[2], 'rb').readlines():" + str += "\n if re.match('class '+sys.argv[3]+'DC', line): \n continue \n line = re.sub(r'^\s+\#', '#', line) \n line = re.sub(r'^\s+def', 'def', line) \n line = re.sub(sys.argv[3]+'DC', sys.argv[3], line)" + str += "\n outfile.write(line) \noutfile.close()" + + if mod in ['kernel', 'gui'] and self.root[-len('gui'):] == 'gui' or mod == 'med' and operator.contains(self.root, 'doxygen'): + if mod == 'med': + doc_source = "${CMAKE_CURRENT_BINARY_DIR}/doc_ref_user/html" + input = "Doxyfile_med_user" + else: + doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod) + input = "" + newlines.append("""\t ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} %s + COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; sys.path.append(r'''%s'''); shutil.rmtree(r'''%s''', True); import copytree1; copytree1.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s''')" + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + )"""%(input, copytree_src, doc_gui_destination, doc_source, doc_gui_destination, head_source, doc_gui_destination)) + + if mod in ['geom', 'smesh', 'visu'] and self.root[-len(mod):] == upmod and operator.contains(self.root, 'doc'): + ign = r"""'tempfile', '*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*'""" + if mod in ['geom', 'smesh']: + if mod == 'geom': + tmp = 'geompy' + input = "COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_tui \n\t\t" + else: + tmp = 'smesh' + input = '' + newlines.append(r""" + FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tempfile "%s") + ADD_CUSTOM_TARGET(usr_docs ${PYTHON_EXECUTABLE} tempfile ${CMAKE_BINARY_DIR}/src/%s_SWIG/%s.py ${CMAKE_SOURCE_DIR}/src/%s_SWIG/%sDC.py %s + %sCOMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py + COMMAND ${DOXYGEN_EXECUTABLE} doxyfile + COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''${CMAKE_BINARY_DIR}/src/%s_SWIG/%s.py''')" + COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; sys.path.append(r'''%s'''); shutil.rmtree(r'''%s''', True); import copytree1; copytree1.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''', r'''%s''', ignore=copytree1.ignore_patterns(%s)); shutil.copy(r'''%s''', r'''%s''')" + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + )"""%(str, upmod, tmp, upmod, tmp, tmp, input, upmod, tmp, copytree_src, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination)) + else: + newlines.append("""\t ADD_CUSTOM_TARGET(usr_docs ${DOXYGEN_EXECUTABLE} doxyfile_idl + COMMAND ${DOXYGEN_EXECUTABLE} doxyfile + COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; sys.path.append(r'''%s'''); shutil.rmtree(r'''%s''',True); import copytree1; copytree1.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''',r'''%s''', ignore=copytree1.ignore_patterns(%s)); shutil.copy(r'''%s''',r'''%s''')" + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + )"""%(copytree_src, doc_gui_destination, doc_gui_destination, ign, head_source, doc_gui_destination)) + + # -- + # add commands for generating of developer's documentation + # -- + + upmod = self.module.upper() + if mod in ['kernel', 'gui', 'med', 'smesh', 'visu'] and self.root[-len('tui'):] == 'tui': + if mod == 'kernel': + tmp = """\tADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE} -u + COMMAND ${DOXYGEN_EXECUTABLE} + COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''${CMAKE_CURRENT_BINARY_DIR}/doxyfile.bak''')" """ + tmp1="" + else: + tmp = """\tADD_CUSTOM_TARGET(dev_docs ${DOXYGEN_EXECUTABLE}""" + if mod == 'visu': + tmp1= r"""\n COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/visuscreen.png''', r'''%s''')" """%(doc_tui_destination) + elif mod == 'smesh': + extra_srcdir = "${CMAKE_CURRENT_SOURCE_DIR}/extra" + tmp1= """\n COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/smeshscreen.png''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.pdf''', r'''%s'''); copy(r'''%s/PluginMeshers.html''', r'''%s''')" + COMMAND ${PYTHON_EXECUTABLE} -c "from shutil import copy; copy(r'''%s/AddNetgenInSalome2.ps''', r'''%s'''); copy(r'''%s/AddNetgenInSalome2.sxw''', r'''%s''')" """%(doc_tui_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination, extra_srcdir,doc_destination,extra_srcdir,doc_destination) + else: + tmp1="" + doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod) + newlines.append(tmp + """ + COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; sys.path.append(r'''%s'''); shutil.rmtree(r'''%s''', True); import copytree1; copytree1.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s''')" """%(copytree_src, doc_tui_destination, doc_source, doc_tui_destination, head_source, doc_tui_destination) + tmp1 + """ + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + )""") + if mod == 'geom' and self.root[-len('tui'):] == 'tui': + tmp = 'geompy' + doc_source = "${CMAKE_CURRENT_BINARY_DIR}/%s"%(upmod) + newlines.append(r""" + FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tempfile "%s") + ADD_CUSTOM_TARGET(dev_docs ${PYTHON_EXECUTABLE} tempfile ${CMAKE_BINARY_DIR}/src/%s_SWIG/%s.py ${CMAKE_SOURCE_DIR}/src/%s_SWIG/%sDC.py %s + COMMAND ${DOXYGEN_EXECUTABLE} doxyfile + COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''${CMAKE_BINARY_DIR}/src/%s_SWIG/%s.py''')" + COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; sys.path.append(r'''%s'''); shutil.rmtree(r'''%s''', True); import copytree1; copytree1.copytree(r'''%s''', r'''%s'''); shutil.copy(r'''%s''', r'''%s'''); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/geomscreen.png''', r'''%s''')" + VERBATIM + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + )"""%(str, upmod, tmp, upmod, tmp, tmp, upmod, tmp, copytree_src, doc_tui_destination, doc_source, doc_tui_destination, head_source, doc_tui_destination, doc_tui_destination)) + # -- # convert the SUBDIRS in cmake grammar # -- @@ -1082,7 +1255,10 @@ class CMakeFile(object): pass newlines.append(''' INSTALL(CODE "SET(IDL_FILE ${input})") - INSTALL(CODE "SET(DIR lib/python${PYTHON_VERSION}/site-packages/salome)") + INSTALL(CODE "SET(DIR ${salomepythondir})") + IF(WINDOWS) + INSTALL(CODE "SET(DIR bin/salome)") + ENDIF(WINDOWS) INSTALL(CODE "SET(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})") INSTALL(CODE "SET(OMNIORB_IDL_PYTHON ${OMNIORB_IDL_PYTHON})") # -- @@ -1305,26 +1481,29 @@ class CMakeFile(object): resdir = self.hxxmodule pass d = { - "salomeadmux_DATA" : "salome_adm/unix", - "dist_salomeadmux_DATA" : "salome_adm/unix", - "dist_salome_cmake_DATA" : "salome_adm/cmake_files", - "dist_salomem4_DATA" : "salome_adm/unix/config_files", - "dist_salome4depr_DATA" : "salome_adm/unix/config_files/DEPRECATED", - "dist_admlocalm4_DATA" : "adm_local/unix/config_files", - "dist_admlocal_cmake_DATA" : "adm_local/cmake_files", - "salomeinclude_DATA" : "include/salome", - "salomeinclude_HEADERS" : "include/salome", - "dist_salomeres_DATA" : "share/salome/resources/%s"%(resdir), - "nodist_salomeres_DATA" : "share/salome/resources/%s"%(resdir), - "nodist_salomeres_SCRIPTS" : "share/salome/resources/%s"%(resdir), - "dist_salomescript_SCRIPTS" : "bin/salome", - "dist_salomescript_DATA" : "bin/salome", - "dist_salomescript_PYTHON" : "bin/salome", - "nodist_salomescript_DATA" : "bin/salome", - "salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome", - "nodist_salomepython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome", - "dist_salomepython_DATA" : "lib/python${PYTHON_VERSION}/site-packages/salome", - "sharedpkgpython_PYTHON" : "lib/python${PYTHON_VERSION}/site-packages/salome/shared_modules", + "salomeadmux_DATA" : "salome_adm/unix", + "dist_salomeadmux_DATA" : "salome_adm/unix", + "dist_salome_cmake_DATA" : "salome_adm/cmake_files", + "dist_salomem4_DATA" : "salome_adm/unix/config_files", + "dist_salome4depr_DATA" : "salome_adm/unix/config_files/DEPRECATED", + "dist_admlocalm4_DATA" : "adm_local/unix/config_files", + "dist_admlocal_cmake_DATA" : "adm_local/cmake_files", + "salomeinclude_DATA" : "include/salome", + "salomeinclude_HEADERS" : "include/salome", + "nodist_salomeinclude_HEADERS" : "include/salome", + "dist_salomeres_DATA" : "share/salome/resources/%s"%(resdir), + "nodist_salomeres_DATA" : "share/salome/resources/%s"%(resdir), + "nodist_salomeres_SCRIPTS" : "share/salome/resources/%s"%(resdir), + "dist_salomescript_SCRIPTS" : "bin/salome", + "dist_salomescript_DATA" : "bin/salome", + "dist_salomescript_PYTHON" : "bin/salome", + "nodist_salomescript_DATA" : "bin/salome", + "salomepython_PYTHON" : "${salomepythondir}", + "nodist_salomepython_PYTHON" : "${salomepythondir}", + "dist_salomepython_DATA" : "${salomepythondir}", + "sharedpkgpython_PYTHON" : "${salomepythondir}/shared_modules", + "salomepypkg_PYTHON" : "${salomepypkgdir}", + "mypkgpython_PYTHON" : "${mypkgpythondir}", } if self.module == "medfile": d = { @@ -1518,7 +1697,24 @@ class CMakeFile(object): SET(f) ENDIF(f STREQUAL v) ENDFOREACH(v ${vars}) + IF(f) + string(REGEX MATCH "^-I" test_include ${f}) + if(test_include) + string(REGEX REPLACE "^-I" "" include_dir ${f}) + if(include_dir) + if(include_dir STREQUAL /usr/include) + else(include_dir STREQUAL /usr/include) + string(REGEX MATCH "^\\." test_dot ${include_dir}) + if(test_dot) + set(include_dir ${CMAKE_CURRENT_BINARY_DIR}/${include_dir}) + endif(test_dot) + include_directories(${include_dir}) + endif(include_dir STREQUAL /usr/include) + endif(include_dir) + else(test_include) SET(flags "${flags} ${f}") + endif(test_include) + ENDIF(f) ENDFOREACH(f ${var}) SET_TARGET_PROPERTIES(${name} PROPERTIES COMPILE_FLAGS "${flags}") ''') @@ -1744,18 +1940,18 @@ class CMakeFile(object): ''') newlines.append(r''' IF(WINDOWS) - INSTALL(TARGETS ${name} DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome) + INSTALL(TARGETS ${name} DESTINATION ${salomepythondir}) IF(CMAKE_BUILD_TYPE STREQUAL Release) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome/${name}.dll DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}.pyd) + INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}.pyd) ELSE(CMAKE_BUILD_TYPE STREQUAL Release) - INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome/${name}.dll DESTINATION lib/python${PYTHON_VERSION}/site-packages/salome RENAME ${name}_d.pyd) + INSTALL(FILES ${CMAKE_INSTALL_PREFIX}/${salomepythondir}/${name}.dll DESTINATION ${salomepythondir} RENAME ${name}_d.pyd) ENDIF(CMAKE_BUILD_TYPE STREQUAL Release) 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/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) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${version}) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so.${soversion}) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${name}.so.${version} DESTINATION ${salomepythondir} RENAME ${name}.so) ENDIF(WINDOWS) ''') newlines.append(r''' @@ -1935,7 +2131,10 @@ class CMakeFile(object): ELSE(f STREQUAL SALOME_ContainerPy.py) IF(f STREQUAL am2cmake.py) ELSE(f STREQUAL am2cmake.py) + IF(f STREQUAL copytree1.py) + ELSE(f STREQUAL copytree1.py) INSTALL(SCRIPT ${CMAKE_SOURCE_DIR}/salome_adm/cmake_files/install_and_compile_python_file.cmake) + ENDIF(f STREQUAL copytree1.py) ENDIF(f STREQUAL am2cmake.py) ENDIF(f STREQUAL SALOME_ContainerPy.py) ''') diff --git a/salome_adm/cmake_files/copytree1.py b/salome_adm/cmake_files/copytree1.py new file mode 100755 index 000000000..5a6c6ac5e --- /dev/null +++ b/salome_adm/cmake_files/copytree1.py @@ -0,0 +1,91 @@ +import os +import sys +import stat +from os.path import abspath +import fnmatch + +import shutil + +class Error(EnvironmentError): + pass +try: + WindowsError +except NameError: + WindowsError = None + +def ignore_patterns(*patterns): + """Function that can be used as copytree() ignore parameter. + + Patterns is a sequence of glob-style patterns + that are used to exclude files""" + def _ignore_patterns(path, names): + ignored_names = [] + for pattern in patterns: + ignored_names.extend(fnmatch.filter(names, pattern)) + return set(ignored_names) + return _ignore_patterns + +def copytree(src, dst, symlinks=False, ignore=None): + """Recursively copy a directory tree using shutil.copy2(). + + The destination directory must not already exist. + If exception(s) occur, an Error is raised with a list of reasons. + + If the optional symlinks flag is true, symbolic links in the + source tree result in symbolic links in the destination tree; if + it is false, the contents of the files pointed to by symbolic + links are copied. + + The optional ignore argument is a callable. If given, it + is called with the `src` parameter, which is the directory + being visited by copytree(), and `names` which is the list of + `src` contents, as returned by os.listdir(): + + callable(src, names) -> ignored_names + + Since copytree() is called recursively, the callable will be + called once for each directory that is copied. It returns a + list of names relative to the `src` directory that should + not be copied. + + XXX Consider this example code rather than the ultimate tool. + + """ + names = os.listdir(src) + if ignore is not None: + ignored_names = ignore(src, names) + else: + ignored_names = set() + + os.makedirs(dst) + errors = [] + for name in names: + if name in ignored_names: + continue + srcname = os.path.join(src, name) + dstname = os.path.join(dst, name) + try: + if symlinks and os.path.islink(srcname): + linkto = os.readlink(srcname) + os.symlink(linkto, dstname) + elif os.path.isdir(srcname): + copytree(srcname, dstname, symlinks, ignore) + else: + shutil.copy2(srcname, dstname) + # XXX What about devices, sockets etc.? + except (IOError, os.error), why: + errors.append((srcname, dstname, str(why))) + # catch the Error from the recursive copytree so that we can + # continue with other files + except Error, err: + errors.extend(err.args[0]) + try: + shutil.copystat(src, dst) + except OSError, why: + if WindowsError is not None and isinstance(why, WindowsError): + # Copying file access times may fail on Windows + pass + else: + errors.extend((src, dst, str(why))) + if errors: + raise Error, errors diff --git a/salome_adm/unix/config_files/check_omniorb.m4 b/salome_adm/unix/config_files/check_omniorb.m4 index 3590669be..fd381029e 100644 --- a/salome_adm/unix/config_files/check_omniorb.m4 +++ b/salome_adm/unix/config_files/check_omniorb.m4 @@ -210,7 +210,7 @@ if test "x$omniORB_ok" = "xyes" then OMNIORB_IDLCXXFLAGS="-Wba -nf -I${OMNIORB_ROOT}/idl" - OMNIORB_IDLPYFLAGS_1='-bpython' + OMNIORB_IDLPYFLAGS_1='-bpython -nf ' OMNIORB_IDLPYFLAGS_2=" -I${OMNIORB_ROOT}/idl" OMNIORB_IDLPYFLAGS=${OMNIORB_IDLPYFLAGS_1}${OMNIORB_IDLPYFLAGS_2} diff --git a/salome_adm/unix/config_files/check_vtk.m4 b/salome_adm/unix/config_files/check_vtk.m4 index 219e549ac..40c4e4c0a 100644 --- a/salome_adm/unix/config_files/check_vtk.m4 +++ b/salome_adm/unix/config_files/check_vtk.m4 @@ -190,7 +190,7 @@ CPPFLAGS="$CPPFLAGS_old" if test "x$vtk_ok" = "xyes" then - VTK_INCLUDES="$LOCAL_INCLUDES" + VTK_INCLUDES="$LOCAL_INCLUDES -DVTK_EXCLUDE_STRSTREAM_HEADERS" dnl vtk libraries diff --git a/salome_adm/unix/config_files/hack_libtool.m4 b/salome_adm/unix/config_files/hack_libtool.m4 index 4ad515aab..54a65dc87 100644 --- a/salome_adm/unix/config_files/hack_libtool.m4 +++ b/salome_adm/unix/config_files/hack_libtool.m4 @@ -28,7 +28,7 @@ dnl to the native libraries (installed in /usr/lib[64]) instead of those supplie dnl with specific -Ldir options. AC_DEFUN([AC_HACK_LIBTOOL],[ -sed -i "s%^CC=\"\(.*\)\"%function hack_libtool { \n\ +sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\ if test \"\$(echo \$[@] | grep -E '\\\-L/usr/lib(/../lib)?(64)? ')\" == \"\" \n\ then\n\ cmd=\"\1 \$[@]\"\n\ diff --git a/salome_adm/unix/config_files/python.m4 b/salome_adm/unix/config_files/python.m4 index 5260f7eb3..e842a2798 100644 --- a/salome_adm/unix/config_files/python.m4 +++ b/salome_adm/unix/config_files/python.m4 @@ -64,6 +64,11 @@ AC_DEFUN([CHECK_PYTHON], AC_SUBST(PYTHON_VERSION) PY_MAKEFILE=${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python$PYTHON_VERSION/config/Makefile + if test ! -f "$PY_MAKEFILE"; then + if test "${build_cpu::6}" = "x86_64" ; then + PY_MAKEFILE=${PYTHON_PREFIX}/lib64/python$PYTHON_VERSION/config/Makefile + fi + fi if test ! -f "$PY_MAKEFILE"; then AC_MSG_WARN([*** Couldn't find ${PY_MAKEFILE}. Maybe you are *** missing the development portion of the python installation]) @@ -77,6 +82,13 @@ AC_DEFUN([CHECK_PYTHON], PYTHON_LIBS="-L${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}" PYTHON_LIB=$PYTHON_LIBS PYTHON_LIBA=${PYTHON_PREFIX}/lib${LIB_LOCATION_SUFFIX}/python$PYTHON_VERSION/config/libpython$PYTHON_VERSION.a + if test "${build_cpu::6}" = "x86_64" ; then + if test "$PY_MAKEFILE" = "${PYTHON_PREFIX}/lib64/python$PYTHON_VERSION/config/Makefile" ; then + PYTHON_LIBS="-L${PYTHON_PREFIX}/lib64/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}" + PYTHON_LIB=$PYTHON_LIBS + PYTHON_LIBA=${PYTHON_PREFIX}/lib64/python$PYTHON_VERSION/config/libpython$PYTHON_VERSION.a + fi + fi dnl At times (like when building shared libraries) you may want dnl to know which OS Python thinks this is. diff --git a/src/Container/SALOME_Container.py b/src/Container/SALOME_Container.py index d3dfc6482..c830f8d96 100644 --- a/src/Container/SALOME_Container.py +++ b/src/Container/SALOME_Container.py @@ -128,7 +128,7 @@ class SALOME_Container_i: def create_pynode(self,nodeName,code): try: - node=SALOME_PyNode.PyNode_i(nodeName,code,self._poa) + node=SALOME_PyNode.PyNode_i(nodeName,code,self._poa,self) id_o = self._poa.activate_object(node) comp_o = self._poa.id_to_reference(id_o) comp_iors = self._orb.object_to_string(comp_o) diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 4d5a9db91..a22a39c2f 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -291,14 +291,10 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param std::string containerNameInNS; if(params.isMPI){ int nbproc; - if ( (params.resource_params.nb_node <= 0) && (params.resource_params.nb_proc_per_node <= 0) ) + if ( params.nb_proc <= 0 ) nbproc = 1; - else if ( params.resource_params.nb_node == 0 ) - nbproc = params.resource_params.nb_proc_per_node; - else if ( params.resource_params.nb_proc_per_node == 0 ) - nbproc = params.resource_params.nb_node; else - nbproc = params.resource_params.nb_node * params.resource_params.nb_proc_per_node; + nbproc = params.nb_proc; if( getenv("LIBBATCH_NODEFILE") != NULL ) machFile = machinesFile(nbproc); // A mpi parallel container register on zero node in NS @@ -596,14 +592,10 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer if (params.isMPI) { - if ((params.resource_params.nb_node <= 0) && (params.resource_params.nb_proc_per_node <= 0)) + if ( params.nb_proc <= 0 ) nbproc = 1; - else if (params.resource_params.nb_node == 0) - nbproc = params.resource_params.nb_proc_per_node; - else if (params.resource_params.nb_proc_per_node == 0) - nbproc = params.resource_params.nb_node; else - nbproc = params.resource_params.nb_node * params.resource_params.nb_proc_per_node; + nbproc = params.nb_proc; } // "ssh -l user machine distantPath/runRemote.sh hostNS portNS WORKINGDIR workingdir \ @@ -703,14 +695,10 @@ SALOME_ContainerManager::BuildCommandToLaunchLocalContainer { o << "mpirun -np "; - if ( (params.resource_params.nb_node <= 0) && (params.resource_params.nb_proc_per_node <= 0) ) + if ( params.nb_proc <= 0 ) nbproc = 1; - else if ( params.resource_params.nb_node == 0 ) - nbproc = params.resource_params.nb_proc_per_node; - else if ( params.resource_params.nb_proc_per_node == 0 ) - nbproc = params.resource_params.nb_node; else - nbproc = params.resource_params.nb_node * params.resource_params.nb_proc_per_node; + nbproc = params.nb_proc; o << nbproc << " "; @@ -917,14 +905,10 @@ SALOME_ContainerManager::BuildTempFileToLaunchRemoteContainer tempOutputFile << "mpirun -np "; int nbproc; - if ( (params.resource_params.nb_node <= 0) && (params.resource_params.nb_proc_per_node <= 0) ) + if ( params.nb_proc <= 0 ) nbproc = 1; - else if ( params.resource_params.nb_node == 0 ) - nbproc = params.resource_params.nb_proc_per_node; - else if ( params.resource_params.nb_proc_per_node == 0 ) - nbproc = params.resource_params.nb_node; else - nbproc = params.resource_params.nb_node * params.resource_params.nb_proc_per_node; + nbproc = params.nb_proc; std::ostringstream o; diff --git a/src/Container/SALOME_PyNode.py b/src/Container/SALOME_PyNode.py index f02d54f36..cf50f8ca6 100644 --- a/src/Container/SALOME_PyNode.py +++ b/src/Container/SALOME_PyNode.py @@ -48,14 +48,16 @@ class Generic(SALOME__POA.GenericObj): class PyNode_i (Engines__POA.PyNode,Generic): """The implementation of the PyNode CORBA IDL""" - def __init__(self, nodeName,code,poa): + def __init__(self, nodeName,code,poa,my_container): """Initialize the node : compilation in the local context""" Generic.__init__(self,poa) self.nodeName=nodeName self.code=code + self.my_container=my_container._container linecache.cache[nodeName]=0,None,string.split(code,'\n'),nodeName ccode=compile(code,nodeName,'exec') self.context={} + self.context["my_container"] = self.my_container exec ccode in self.context def execute(self,funcName,argsin): diff --git a/src/KERNEL_PY/import_hook.py b/src/KERNEL_PY/import_hook.py index 3d628ecab..d812d8f67 100755 --- a/src/KERNEL_PY/import_hook.py +++ b/src/KERNEL_PY/import_hook.py @@ -119,6 +119,7 @@ def import_module(partname, fqname, parent): """ Try to import module fqname It's parent is module parent and has name partname """ + #print "import_module",partname, fqname, parent try: m = sys.modules[fqname] except KeyError: @@ -129,6 +130,7 @@ def import_module(partname, fqname, parent): def ensure_fromlist(m, fromlist, recursive=0): """ Return the real modules list to be imported """ + #print "ensure_fromlist",m, fromlist, recursive l=[] for sub in fromlist: if sub == "*": @@ -139,11 +141,23 @@ def ensure_fromlist(m, fromlist, recursive=0): pass else: l.extend(ensure_fromlist(m, all, 1)) - elif hasattr(m,sub): - submod=getattr(m,sub) + else: + #try to find if sub is an attribute (eventually dotted) of m + components=sub.split('.') + has_submod=True + submod=m + for comp in components: + if hasattr(submod,comp): + submod=getattr(submod, comp) + else: + has_submod=False + break + + if has_submod: + #the attribute has been found if type(submod) == type(sys): l.append(("%s.%s" % (m.__name__, sub),submod)) - else: + else: subname="%s.%s" % (m.__name__, sub) submod = import_module(sub, subname, m) if not submod: diff --git a/src/KERNEL_PY/kernel/studyedit.py b/src/KERNEL_PY/kernel/studyedit.py index 4823daf37..09e41c360 100644 --- a/src/KERNEL_PY/kernel/studyedit.py +++ b/src/KERNEL_PY/kernel/studyedit.py @@ -236,9 +236,9 @@ class StudyEditor: (comment is None or childItem.GetComment() == comment) and \ (icon is None or \ self.getIcon(childItem) == icon) and \ - (IOR is None or childItem.GetIOR() == IOR and \ + (IOR is None or childItem.GetIOR() == IOR) and \ (typeId is None or \ - self.getTypeId(childItem) == typeId)): + self.getTypeId(childItem) == typeId): foundItem = childItem childIterator.Next() return foundItem diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index 4c5c24360..e616e68aa 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -498,14 +498,10 @@ int SALOME_LifeCycleCORBA::NbProc(const Engines::ContainerParameters& params) { if( !isMpiContainer(params) ) return 0; - else if( (params.resource_params.nb_node <= 0) && (params.resource_params.nb_proc_per_node <= 0) ) + else if( params.nb_proc <= 0 ) return 1; - else if( params.resource_params.nb_node == 0 ) - return params.resource_params.nb_proc_per_node; - else if( params.resource_params.nb_proc_per_node == 0 ) - return params.resource_params.nb_node; else - return params.resource_params.nb_node * params.resource_params.nb_proc_per_node; + return params.nb_proc; } //============================================================================= diff --git a/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py b/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py index 417cf4e16..fb610bf3c 100644 --- a/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py +++ b/src/LifeCycleCORBA_SWIG/LifeCycleCORBA.py @@ -41,12 +41,17 @@ class LifeCycleCORBA (SALOME_LifeCycleCORBA): componentName) class MachineParameters (Engines.MachineParameters): - def __init__(self, container_name='', hostname='', componentList=[], computerList=[], OS='', - mem_mb=0, cpu_clock=0, nb_proc_per_node=0, nb_node=0, isMPI=False, workingdir='', - mode='start', policy='altcycl', parallelLib='', nb_component_nodes=0): - Engines.MachineParameters.__init__(self,container_name, hostname, componentList, computerList, OS, - mem_mb, cpu_clock, nb_proc_per_node, nb_node, isMPI, workingdir, - mode, policy, parallelLib, nb_component_nodes) + def __init__(self, container_name='', hostname='', componentList=[], computerList=[], OS='', + mem_mb=0, cpu_clock=0, nb_proc_per_node=0, nb_node=0, isMPI=False, workingdir='', + mode='start', policy='altcycl', parallelLib='', nb_component_nodes=0): + Engines.MachineParameters.__init__(self,container_name, hostname, componentList, computerList, OS, + mem_mb, cpu_clock, nb_proc_per_node, nb_node, isMPI, workingdir, + mode, policy, parallelLib, nb_component_nodes) + +class ContainerParameters (Engines.ContainerParameters): + def __init__(self, container_name='', mode='start', workingdir='', nb_proc=0, isMPI=False, parallelLib='',resource_params=None): + if resource_params is None:resource_params=ResourceParameters() + Engines.ContainerParameters.__init__(self,container_name, mode, workingdir, nb_proc, isMPI, parallelLib,resource_params) class ResourceParameters (Engines.ResourceParameters): def __init__(self, name="", hostname="", OS="", componentList=[], diff --git a/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py b/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py index 4e7b68d8f..dde270f3d 100644 --- a/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py +++ b/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py @@ -42,35 +42,33 @@ Test with catalog : def test0(self): """""" - p=LifeCycleCORBA.MachineParameters(container_name="MyContainer",mode="start", - policy="best",componentList=["PYHELLO"]) - co=cm.StartContainer( p ) - print "Container:",co,co.getHostName(), co.getPID(),co._get_name() + rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"]) + p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="start",resource_params=rp) + co=cm.GiveContainer( p ) self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer") - co=cm.StartContainer( p ) + co=cm.GiveContainer( p ) self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer") def test1(self): """""" - p=LifeCycleCORBA.MachineParameters(container_name="MyContainer",mode="get", - policy="best",componentList=["PYHELLO"]) - co=cm.StartContainer( p ) - print "Container:",co,co.getHostName(), co.getPID(),co._get_name() + rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"]) + p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="get",resource_params=rp) + co=cm.GiveContainer( p ) self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer") - co=cm.StartContainer( p ) + co=cm.GiveContainer( p ) self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer") def test2(self): """""" - p=LifeCycleCORBA.MachineParameters(container_name="MyContainer",mode="getorstart", - policy="best",componentList=["PYHELLO"]) - co=cm.StartContainer( p ) - print "Container:",co,co.getHostName(), co.getPID(),co._get_name() + rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"]) + p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="getorstart",resource_params=rp) + co=cm.GiveContainer( p ) self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer") - co=cm.StartContainer( p ) + co=cm.GiveContainer( p ) self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer") if __name__ == '__main__': - unittest.main() + suite = unittest.TestLoader().loadTestsFromTestCase(TestContainerManager) + unittest.TextTestRunner().run(suite) diff --git a/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py b/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py index e8211ffc5..2ec086bcf 100644 --- a/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py +++ b/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py @@ -21,6 +21,7 @@ import unittest import salome import LifeCycleCORBA +import SALOME salome.salome_init() cm= salome.lcc.getContainerManager() rm= salome.lcc.getResourcesManager() @@ -49,55 +50,60 @@ Test with CatalogResources.xml: def test0(self): """host required""" - params=LifeCycleCORBA.MachineParameters(hostname="m3") + params=LifeCycleCORBA.ResourceParameters(hostname="m3") machineList=rm.GetFittingResources(params) self.assertEqual(machineList, ["m3"]) def test1(self): """OS required""" - params=LifeCycleCORBA.MachineParameters(OS="Linux") - machineList=rm.GetFittingResources(params) - self.assertEqual(machineList, []) + params=LifeCycleCORBA.ResourceParameters(OS="Linux") + self.assertRaises(SALOME.SALOME_Exception,rm.GetFittingResources,params) def test2(self): """component add required""" - params=LifeCycleCORBA.MachineParameters(componentList=["add"]) + params=LifeCycleCORBA.ResourceParameters(componentList=["add"]) machineList=rm.GetFittingResources(params) self.assertEqual(machineList, ['claui2c6', 'm1', 'm2']) def test3(self): """component tutu required""" - machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["tutu"])) + params=LifeCycleCORBA.ResourceParameters(componentList=["tutu"]) + machineList=rm.GetFittingResources(params) self.assertEqual(machineList, ['m1', 'm2', 'm3']) def test4(self): """component tata required""" - machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["tata"])) + params=LifeCycleCORBA.ResourceParameters(componentList=["tata"]) + machineList=rm.GetFittingResources(params) self.assertEqual(machineList, ['m1', 'm2']) def test5(self): """component titi required""" - machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["titi"])) + params=LifeCycleCORBA.ResourceParameters(componentList=["titi"]) + machineList=rm.GetFittingResources(params) self.assertEqual(machineList, ['m1', 'm2']) def test6(self): """component toto required""" - machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["toto"])) + params=LifeCycleCORBA.ResourceParameters(componentList=["toto"]) + machineList=rm.GetFittingResources(params) self.assertEqual(machineList, ['claui2c6', 'm1', 'm2']) def test7(self): """components add and toto required""" - machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["add","toto"])) + params=LifeCycleCORBA.ResourceParameters(componentList=["add","toto"]) + machineList=rm.GetFittingResources(params) self.assertEqual(machineList, ['claui2c6', 'm1', 'm2']) def test8(self): """components add and toto required""" - machineDef=rm.GetMachineParameters('claui2c6') + machineDef=rm.GetResourceDefinition('claui2c6') self.assertEqual(machineDef.componentList, ['toto', 'add']) def test10(self): """policy altcycl""" - machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["add","toto"])) + params=LifeCycleCORBA.ResourceParameters(componentList=["add","toto"]) + machineList=rm.GetFittingResources(params) self.assertEqual(rm.Find('altcycl',machineList), "claui2c6") self.assertEqual(rm.Find('altcycl',machineList), "m1") self.assertEqual(rm.Find('altcycl',machineList), "m2") @@ -107,7 +113,8 @@ Test with CatalogResources.xml: def test11(self): """policy cycl""" - machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["add","toto"])) + params=LifeCycleCORBA.ResourceParameters(componentList=["add","toto"]) + machineList=rm.GetFittingResources(params) self.assertEqual(rm.Find('cycl',machineList), "claui2c6") self.assertEqual(rm.Find('cycl',machineList), "m1") self.assertEqual(rm.Find('cycl',machineList), "m2") @@ -117,13 +124,15 @@ Test with CatalogResources.xml: def test12(self): """policy first""" - machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["add","toto"])) + params=LifeCycleCORBA.ResourceParameters(componentList=["add","toto"]) + machineList=rm.GetFittingResources(params) self.assertEqual(rm.Find('first',machineList), "claui2c6") self.assertEqual(rm.Find('first',machineList), "claui2c6") def test13(self): """policy best""" - machineList=rm.GetFittingResources(LifeCycleCORBA.MachineParameters(componentList=["add","toto"])) + params=LifeCycleCORBA.ResourceParameters(componentList=["add","toto"]) + machineList=rm.GetFittingResources(params) self.assertEqual(rm.Find('best',machineList), "claui2c6") self.assertEqual(rm.Find('best',machineList), "m1") self.assertEqual(rm.Find('best',machineList), "m2") @@ -132,5 +141,6 @@ Test with CatalogResources.xml: self.assertEqual(rm.Find('best',machineList), "m2") if __name__ == '__main__': - unittest.main() + suite = unittest.TestLoader().loadTestsFromTestCase(TestResourceManager) + unittest.TextTestRunner().run(suite) diff --git a/src/NamingService/SALOME_NamingService.cxx b/src/NamingService/SALOME_NamingService.cxx index 80bb67144..6e4444976 100644 --- a/src/NamingService/SALOME_NamingService.cxx +++ b/src/NamingService/SALOME_NamingService.cxx @@ -636,14 +636,10 @@ SALOME_NamingService::ContainerName(const Engines::ContainerParameters& params) if ( !params.isMPI ) nbproc = 0; - else if ( (params.resource_params.nb_node <= 0) && (params.resource_params.nb_proc_per_node <= 0) ) + else if ( params.nb_proc <= 0 ) nbproc = 1; - else if ( params.resource_params.nb_node == 0 ) - nbproc = params.resource_params.nb_proc_per_node; - else if ( params.resource_params.nb_proc_per_node == 0 ) - nbproc = params.resource_params.nb_node; else - nbproc = params.resource_params.nb_node * params.resource_params.nb_proc_per_node; + nbproc = params.nb_proc; std::string ret = ContainerName(params.container_name); diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 56be377dc..94e3537e0 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -678,7 +678,7 @@ SALOMEDS::UseCaseBuilder_ptr SALOMEDS_Study_i::GetUseCaseBuilder() void SALOMEDS_Study_i::Close() { SALOMEDS::Locker lock; - + RemovePostponed(-1); SALOMEDS::SComponentIterator_var itcomponent = NewComponentIterator(); @@ -756,7 +756,10 @@ void SALOMEDS_Study_i::RemovePostponed(CORBA::Long /*theUndoLimit*/) try { CORBA::Object_var obj = _orb->string_to_object(anIORs[i].c_str()); SALOME::GenericObj_var aGeneric = SALOME::GenericObj::_narrow(obj); - if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy(); + //rnv: To avoid double deletion of the Salome Generic Objects: + //rnv: 1. First decrement of the reference count in the SALOMEDSImpl_AttributeIOR::~SALOMEDSImpl_AttributeIOR(); + //rnv: 2. Second decrement of the reference count in the next string : aGeneric->Destroy(); + //if (!CORBA::is_nil(aGeneric)) aGeneric->Destroy(); } catch (...) {} } -- 2.39.2