--- /dev/null
+Python/bin
+Python/lib
+Python/share
+gcc/bin
+gcc/lib
+gcc/lib64
+gcc/libexec
+gcc/share
+lapack/lib
+openmpi/bin
+openmpi/lib
+hdf5/bin
+hdf5/lib
+cgns/bin
+cgns/lib
+tbb/lib
+nlopt/lib
+libxml2/bin
+libxml2/lib
+netcdf/bin
+netcdf/lib
+gdal/bin
+gdal/lib
+gdal/share
+boost/lib
+omniORB/bin
+omniORB/lib
+cppunit/bin
+cppunit/lib
+LIBBATCH/lib
+freetype/bin
+freetype/lib
+qt/plugins
+qt/bin
+qt/lib
+sip/bin
+sip/lib
+PyQt/bin
+PyQt/lib
+PyQt/sip
+freeimage/bin
+freeimage/lib
+CAS/bin
+CAS/lib
+CAS/share
+qwt/lib
+matplotlib/lib
+embree/lib
+rkCommon/lib
+openVKL/lib
+ospray/lib
+cminpack/bin
+cminpack/lib
+cminpack/share
+FMILibrary/bin
+FMILibrary/lib
+PyFMI/lib
+openturns/bin
+openturns/lib
+catalyst/lib
+ParaView/bin
+ParaView/lib
+graphviz/bin
+graphviz/lib
+pmml/bin
+pmml/lib
+opencv/bin
+opencv/lib
+tcl/bin
+tcl/lib
+planegcs/lib
+medfile/bin
+medfile/lib
+metis/bin
+metis/lib
+metis/bin
+petsc/lib
+TTK/bin
+TTK/lib
+C3PO/bin
+C3PO/lib
+root/bin
+root/lib
+zeromq/bin
+zeromq/lib
\ No newline at end of file
--- /dev/null
+{
+ "name": "3dparty",
+ "descr": "SALOME extension",
+ "depends_on": [],
+ "author": "SALOME Team",
+ "components": [ "Python", "gcc", "lapack", "openmpi", "hdf5", "cgns", "tbb", "nlopt", "libxml2", "netcdf", "gdal", "boost", "omniORB", "cppunit", "LIBBATCH", "freetype", "qt", "sip", "PyQt", "freeimage", "CAS", "qwt", "matplotlib", "embree", "rkCommon", "openVKL", "ospray", "cminpack", "FMILibrary", "PyFMI", "openturns", "catalyst", "ParaView", "graphviz", "pmml", "opencv", "tcl", "planegcs", "medfile", "metis", "petsc", "TTK", "C3PO", "root", "zeromq" ]
+}
+
--- /dev/null
+
+#!/usr/bin/env python3
+# -*- coding:utf-8 -*-
+
+"""
+SALOME application environment.
+"""
+
+import os
+import sys
+from SalomeOnDemandTK.extension_query import ext_info_dict
+
+
+def init(context, ext_root_dir):
+ """
+ Set an environment for SALOME app.
+
+ Args:
+ context - an SalomeContext object.
+ ext_root_dir - a path to __SALOME_EXT__ directory.
+
+ Returns:
+ None.
+ """
+
+ BINDIR = os.path.join(ext_root_dir, 'bin')
+ LIBDIR = os.path.join(ext_root_dir, 'lib')
+ python_version = '{}.{}'.format(sys.version_info[0], sys.version_info[1])
+ python_libdir = os.path.join('lib', 'python' + python_version, 'site-packages')
+
+ reinitialise_paths = True
+
+ #[SALOME_COMMON]
+
+ out_dir_Path=os.path.dirname(os.path.realpath(__file__))
+
+ # Seting SALOME modules environment
+ modules = ext_info_dict(out_dir_Path)
+ for module in modules:
+ print
+ for component in modules[module][2].split(', '):
+ context.setVariable('%s_ROOT_DIR'%component, ext_root_dir, overwrite=True)
+ # Seting SALOME prerequis and tools environment
+ context.addToPath(BINDIR)
+ context.addToLdLibraryPath(LIBDIR)
+ context.addToPythonPath(BINDIR)
+ context.addToPythonPath(LIBDIR)
+ context.addToPythonPath(os.path.join(ext_root_dir, python_libdir))
+ context.addToPythonPath(os.path.join(ext_root_dir, 'lib', 'python' + python_version))
+
+ #[Python]
+ context.setVariable(r"PYTHON_VERSION", python_version, overwrite=True)
+ context.addToPath(ext_root_dir)
+ context.setVariable(r"PYTHONBIN", os.path.join(BINDIR,'python3'), overwrite=True)
+
+ #[gcc]
+ context.addToLdLibraryPath(os.path.join(ext_root_dir, 'lib64'))
+
+ #[openmpi]
+ context.setVariable(r"MPIEXEC_EXECUTABLE", os.path.join(BINDIR, 'mpiexec'), overwrite=True)
+ context.addToPath(os.path.join(ext_root_dir,'include'))
+
+ #[qt]
+ context.setVariable(r"QTDIR", ext_root_dir, overwrite=True)
+ context.setVariable(r"QT5_ROOT_DIR", ext_root_dir, overwrite=True)
+ context.setVariable(r"QT_PLUGIN_PATH", os.path.join(ext_root_dir,'plugins'), overwrite=True)
+ context.setVariable(r"QT_QPA_PLATFORM_PLUGIN_PATH", os.path.join(ext_root_dir,'plugins'), overwrite=True)
+
+ #[PyQt]
+ context.addToPythonPath(os.path.join(ext_root_dir, 'sip',python_libdir))
+
+ #[CAS]
+ context.setVariable(r"CSF_ShadersDirectory", os.path.join( ext_root_dir, 'share/opencascade/resources/Shaders'), overwrite=True)
+ context.setVariable(r"CSF_UnitsLexicon", os.path.join( ext_root_dir, 'share/opencascade/resources/UnitsAPI/Lexi_Expr.dat'), overwrite=True)
+ context.setVariable(r"CSF_UnitsDefinition", os.path.join( ext_root_dir, 'share/opencascade/resources/UnitsAPI/Units.dat'), overwrite=True)
+ context.setVariable(r"CSF_SHMessage", os.path.join( ext_root_dir, 'share/opencascade/resources/SHMessage'), overwrite=True)
+ context.setVariable(r"CSF_XSMessage", os.path.join( ext_root_dir, 'share/opencascade/resources/XSMessage'), overwrite=True)
+ context.setVariable(r"CSF_MDTVTexturesDirectory", os.path.join( ext_root_dir, 'share/opencascade/resources/Textures'), overwrite=True)
+ context.setVariable(r"MMGT_REENTRANT", r"1", overwrite=True)
+ context.setVariable(r"CSF_StandardDefaults", os.path.join( ext_root_dir, 'share/opencascade/resources/StdResource'), overwrite=True)
+ context.setVariable(r"CSF_PluginDefaults", os.path.join( ext_root_dir, 'share/opencascade/resources/StdResource'), overwrite=True)
+ context.addToPath(ext_root_dir)
+
+ #[ParaView]
+ context.setVariable(r"PV_PLUGIN_PATH", os.path.join(LIBDIR,'paraview-5.11'), overwrite=True)
+ context.addToVariable(r"PV_PLUGIN_PATH", os.path.join(LIBDIR,'paraview-5.11','plugins'),separator=":")
+ context.addToPythonPath(os.path.join(LIBDIR,'paraview-5.11', 'site-packages'))
+ context.addToPythonPath(os.path.join(LIBDIR,'paraview-5.11', 'site-packages', 'vtk'))
+ context.addToPath(os.path.join(ext_root_dir,'include', 'paraview-5.11'))
+ context.addToLdLibraryPath(os.path.join(LIBDIR,'paraview-5.11'))
+ context.addToPythonPath(os.path.join(LIBDIR,'paraview-5.11'))
+ context.addToPythonPath(python_libdir)
\ No newline at end of file
+
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
-Add a custom environment to the SALOME extension.
+SALOME application environment.
"""
import os
import sys
+from SalomeOnDemandTK.extension_query import ext_info_dict
-def init(context, root_dir):
+def init(context, ext_root_dir):
"""
- Set an environment for an extension on start of SALOME app.
+ Set an environment for SALOME app.
Args:
context - an SalomeContext object.
- root_dir - a path to __SALOME_EXT__ directory.
+ ext_root_dir - a path to __SALOME_EXT__ directory.
Returns:
None.
reinitialise_paths = True
- #[KERNEL]
- kernel_root_dir = os.path.join(root_dir, 'KERNEL')
- context.setVariable('KERNEL_ROOT_DIR', kernel_root_dir, overwrite=True)
- context.addToPath(os.path.join(kernel_root_dir, 'bin', 'salome'))
- context.addToLdLibraryPath(os.path.join(kernel_root_dir, 'lib', 'salome'))
- context.addToPythonPath(os.path.join(kernel_root_dir, 'bin', 'salome'))
- context.addToPythonPath(os.path.join(kernel_root_dir, 'lib', 'salome'))
- context.addToPythonPath(os.path.join(kernel_root_dir, python_libdir, 'salome'))
-
- #[GUI]
- gui_root_dir = os.path.join(root_dir, 'GUI')
- context.setVariable('GUI_ROOT_DIR', gui_root_dir, overwrite=True)
- context.addToPath(os.path.join(gui_root_dir, 'bin', 'salome'))
- context.addToLdLibraryPath(os.path.join(gui_root_dir, 'lib', 'salome'))
- context.addToPythonPath(os.path.join(gui_root_dir, 'bin', 'salome'))
- context.addToPythonPath(os.path.join(gui_root_dir, 'lib', 'salome'))
- context.addToPythonPath(os.path.join(gui_root_dir, python_libdir, 'salome'))
-
- gui_res_dir = os.path.join(gui_root_dir, 'share', 'salome', 'resources', 'gui')
+ #[SALOME_COMMON]
+
+ out_dir_Path=os.path.dirname(os.path.realpath(__file__))
+
+ # Seting SALOME modules environment
+ modules = ext_info_dict(out_dir_Path)
+ for module in modules:
+ print
+ for component in modules[module][2].split(', '):
+ context.setVariable('%s_ROOT_DIR'%component, ext_root_dir, overwrite=True)
+ context.addToPath(os.path.join(ext_root_dir, 'bin', 'salome'))
+ context.addToLdLibraryPath(os.path.join(ext_root_dir, 'lib', 'salome'))
+ context.addToPythonPath(os.path.join(ext_root_dir, 'bin', 'salome'))
+ context.addToPythonPath(os.path.join(ext_root_dir, 'lib', 'salome'))
+ context.addToPythonPath(os.path.join(ext_root_dir, python_libdir, 'salome'))
+
+ # Seting SALOME prerequis and tools environment
+ context.addToPath(os.path.join(ext_root_dir, 'bin'))
+ context.addToLdLibraryPath(os.path.join(ext_root_dir, 'lib'))
+ context.addToPythonPath(os.path.join(ext_root_dir, 'bin'))
+ context.addToPythonPath(os.path.join(ext_root_dir, 'lib'))
+ context.addToPythonPath(os.path.join(ext_root_dir, python_libdir))
+
+ res_dir = os.path.join(ext_root_dir, 'share', 'salome', 'resources', 'gui')
if reinitialise_paths:
- context.setVariable('SalomeAppConfig', gui_res_dir, overwrite=True)
+ context.setVariable('SalomeAppConfig', res_dir, overwrite=True)
else:
- context.addToVariable('SalomeAppConfig', gui_res_dir, separator=os.pathsep)
+ context.addToVariable('SalomeAppConfig', res_dir, separator=os.pathsep)
# List of the files those actually written to the archive.
# It goes to the salomexc file then.
files_abs, files_rel = list_files_filter(top_repository, included_files_patterns)
+ id = 0
+ for f in files_rel:
+ fsplit = f.split('/')
+ del fsplit[0]
+ files_rel[id] = '/'.join(fsplit)
+ id +=1
add_files(ext, files_abs, files_rel)
# Write the control file - list of the files inside extension's dir
isvalid_filename, isvalid_dirname, ext_info_bykey, set_selext_env, get_app_root, \
check_if_installed
-
def unpack_salomex(salome_root, salomex):
"""
Unpack a given salome extension archive into SALOME install root.
global args
config_var = appname+'Config'
+ ############################
+ # parse command line options
+ pars = CreateOptionParser(exeName=exeName)
+ cmd_opts = pars.parse_args(sys.argv[1:])
+ ############################
+
# check KERNEL_ROOT_DIR
kernel_root_dir = os.environ.get("KERNEL_ROOT_DIR", None)
- if kernel_root_dir is None:
+ if kernel_root_dir is None and not cmd_opts.on_demand:
print("""
For each SALOME module, the environment variable <moduleN>_ROOT_DIR must be set.
KERNEL_ROOT_DIR is mandatory.
""")
sys.exit(1)
- ############################
- # parse command line options
- pars = CreateOptionParser(exeName=exeName)
- cmd_opts = pars.parse_args(sys.argv[1:])
- ############################
-
# Process --print-port option
if cmd_opts.print_port:
from searchFreePort import searchFreePort
else:
dirs += re.split('[;|:]', os.getenv(config_var))
- if not keepEnvironment:
+ if not keepEnvironment and not cmd_opts.on_demand:
if os.getenv("GUI_ROOT_DIR") and os.path.isdir(os.getenv("GUI_ROOT_DIR")):
gui_resources_dir = os.path.join(os.getenv("GUI_ROOT_DIR"),'share','salome','resources','gui')
if os.path.isdir(gui_resources_dir):
if cmd_opts.batch is not None:
args[batch_nam] = True
- if not os.getenv("GUI_ROOT_DIR") or not os.path.isdir(os.getenv("GUI_ROOT_DIR")):
+ if ( not os.getenv("GUI_ROOT_DIR") or not os.path.isdir(os.getenv("GUI_ROOT_DIR")) ) and not cmd_opts.on_demand:
args[gui_nam] = False
if args[gui_nam]:
# now modify SalomeAppConfig environment variable
# to take into account the SALOME modules
- if os.sys.platform == 'win32':
- dirs = re.split('[;]', os.environ[config_var] )
- else:
- dirs = re.split('[;|:]', os.environ[config_var] )
- for module in args[modules_nam]:
- if module not in ["KERNEL", "GUI", ""] and os.getenv("{0}_ROOT_DIR".format(module)):
- d1 = os.path.join(os.getenv("{0}_ROOT_DIR".format(module)),"share","salome","resources",module.lower())
- d2 = os.path.join(os.getenv("{0}_ROOT_DIR".format(module)),"share","salome","resources")
- #if os.path.exists( "%s/%s.xml"%(d1, appname) ):
- if os.path.exists( os.path.join(d1,"{0}.xml".format(salomeappname)) ):
- dirs.append( d1 )
- #elif os.path.exists( "%s/%s.xml"%(d2, appname) ):
- elif os.path.exists( os.path.join(d2,"{0}.xml".format(salomeappname)) ):
- dirs.append( d2 )
+ if not args[on_demand_nam]:
+ if os.sys.platform == 'win32':
+ dirs = re.split('[;]', os.environ[config_var] )
else:
- # print("* '"+m+"' should be deleted from ",args[modules_nam])
- pass
+ dirs = re.split('[;|:]', os.environ[config_var] )
+ for module in args[modules_nam]:
+ if module not in ["KERNEL", "GUI", ""] and os.getenv("{0}_ROOT_DIR".format(module)):
+ d1 = os.path.join(os.getenv("{0}_ROOT_DIR".format(module)),"share","salome","resources",module.lower())
+ d2 = os.path.join(os.getenv("{0}_ROOT_DIR".format(module)),"share","salome","resources")
+ #if os.path.exists( "%s/%s.xml"%(d1, appname) ):
+ if os.path.exists( os.path.join(d1,"{0}.xml".format(salomeappname)) ):
+ dirs.append( d1 )
+ #elif os.path.exists( "%s/%s.xml"%(d2, appname) ):
+ elif os.path.exists( os.path.join(d2,"{0}.xml".format(salomeappname)) ):
+ dirs.append( d2 )
+ else:
+ # print("* '"+m+"' should be deleted from ",args[modules_nam])
+ pass
# Test
if cmd_opts.test_script_file is not None:
#
import sys, os, string, glob, time, pickle, re
-import orbmodule
import setenv
from server import process_id, Server
import json
# Setup extension's env in salome on demand case
if args[on_demand_nam]:
runSalomeOnDemand.set_ext_env()
+ # Reset up module_list and modules_root_dir, if we dont want to define SalomeAppConfig on salome.py.
+ # We must remove the "else" on "if os.sys.platform == 'win32':" in launcheConfigureParser.py too.
+ args, _, __ = setenv.get_config(exeName=exeName, keepEnvironment=keep_env)
setenv.set_env(args, modules_list, modules_root_dir, keepEnvironment=keep_env)
ior_fakens_filename = useSalome(args, modules_list, modules_root_dir)
logger.warn("No file {} set to host IOR of the fake naming server does not exit !")
return
import CORBA
- import Engines
- import SALOME
+ #import Engines
+ #import SALOME
from time import sleep
orb = CORBA.ORB_init([''], CORBA.ORB_ID)
ior_fakens = None
args, ior_fakens_filename = main()
# --
test = args['gui'] and args['session_gui']
+ test = test and not args[on_demand_nam]
test = test or args['wake_up_session']
# --
# The next test covers the --pinter option or if var PYTHONINSPECT is set
"""Run SALOME app in the context of adding modules as extensions.
"""
-import sys
+import os,sys
import salomeContext
from SalomeOnDemandTK.extension_utilities import logger, \
- set_selext_env, get_app_root
+ set_selext_env, get_app_root, find_file
from SalomeOnDemandTK.extension_query import ext_by_dependants, dependency_tree
# Get the root directory
app_root = get_app_root()
+ # Set the root dir as env variable
+ context = salomeContext.SalomeContext(None)
+ context.setVariable('SALOME_APPLICATION_DIR', app_root, overwrite=True)
+
# Find and source all _env.py files for installed extensions
tree = dependency_tree(app_root)
installed_ext = ext_by_dependants(tree)
logger.debug('There are not any extensions in %s!', app_root)
return
- # Set the root dir as env variable
- context = salomeContext.SalomeContext(None)
- context.setVariable('SALOME_APPLICATION_DIR', app_root, overwrite=True)
-
# Execute env file as a module
for ext_name in installed_ext:
set_selext_env(app_root, ext_name, context)
-
+ for python_path in os.environ["PYTHONPATH"].split(':'):
+ sys.path[:0] = [python_path]
if __name__ == "__main__":
if len(sys.argv) == 3:
#
import sys, os, string, glob, time, pickle
-import orbmodule
from launchConfigureParser import verbose
# this file is extraction of set_env from runSalome.py