From: SPN Salome - CEA Date: Tue, 11 Apr 2017 11:54:52 +0000 (+0200) Subject: V8_ X-Git-Tag: V8_3_0~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8d4fd17cd6799f964001754988d1f5a2a9e58c4d;p=tools%2FSALOME.git V8_ --- diff --git a/CMakeLists.txt b/CMakeLists.txt index fa0262d..93640a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,7 +17,7 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) -PROJECT(Salome_[Name_of_Application]_Profile C CXX) +PROJECT(Salome_SALOME_Profile C CXX) # Ensure a proper linker behavior: CMAKE_POLICY(SET CMP0003 NEW) @@ -33,8 +33,8 @@ SET(${PROJECT_NAME_UC}_PATCH_VERSION 0) SET(${PROJECT_NAME_UC}_VERSION ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION}) + # Common CMake macros -# =================== SET(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files") IF(EXISTS ${CONFIGURATION_ROOT_DIR}) LIST(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake") @@ -48,7 +48,6 @@ ENDIF() SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL") IF(EXISTS ${KERNEL_ROOT_DIR}) LIST(APPEND CMAKE_MODULE_PATH "${KERNEL_ROOT_DIR}/salome_adm/cmake_files") - INCLUDE(SalomeMacros) FIND_PACKAGE(SalomeKERNEL REQUIRED) KERNEL_WITH_CORBA() # check whether KERNEL builded with CORBA ELSE(EXISTS ${KERNEL_ROOT_DIR}) @@ -58,8 +57,7 @@ ENDIF(EXISTS ${KERNEL_ROOT_DIR}) # User options # ============ OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON) -OPTION(SALOME_BUILD_DOC "Generate SALOME [Name_of_Application] documentation" ON) -OPTION(SALOME_BUILD_WITH_QT5 "Build SALOME with Qt 5" OFF) +OPTION(SALOME_BUILD_DOC "Generate SALOME SALOME documentation" ON) IF(SALOME_BUILD_TESTS) ENABLE_TESTING() @@ -67,7 +65,8 @@ ENDIF() # KERNEL optionals: IF(SALOME_BUILD_DOC) - FIND_PACKAGE(SalomePython) + FIND_PACKAGE(SalomePythonInterp REQUIRED) + FIND_PACKAGE(SalomePythonLibs REQUIRED) FIND_PACKAGE(SalomeSphinx) SALOME_LOG_OPTIONAL_PACKAGE(Sphinx SALOME_BUILD_DOC) ENDIF() @@ -93,24 +92,21 @@ ELSE(EXISTS ${GUI_ROOT_DIR}) ENDIF(EXISTS ${GUI_ROOT_DIR}) # Qt -IF(NOT SALOME_BUILD_WITH_QT5) +IF(NOT SALOME_GUI_BUILD_WITH_QT5) FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui) ELSE() FIND_PACKAGE(SalomeQt5 REQUIRED) ENDIF() -#FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui) -#INCLUDE(${QT_USE_FILE}) - # Directories # (default values taken from KERNEL) # =========== SET(SALOME_INSTALL_SCRIPT_PYTHON "${SALOME_INSTALL_SCRIPT_PYTHON}" CACHE PATH "Install path: SALOME Python scripts") -# Specific to [NAME_OF_APPLICATION]: -SET(SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/(name_of_application)_profile" CACHE PATH "Install path: SALOME [NAME_OF_APPLICATION] specific data") -SET(SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_DOC_GUI "${SALOME_INSTALL_DOC}/gui/${PROJECT_NAME_UC}" CACHE PATH "Install path: SALOME [NAME_OF_APPLICATION] gui documentation") -SET(SALOME_[NAME_OF_APPLICATION]_PROFILE_HTML_STATIC_PATH "${SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_DOC_GUI}/_static" CACHE PATH "Install path: SALOME [NAME_OF_APPLICATION] html static data") +# Specific to SALOME: +SET(SALOME_SALOME_PROFILE_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/salome_profile" CACHE PATH "Install path: SALOME SALOME specific data") +SET(SALOME_SALOME_PROFILE_INSTALL_DOC_GUI "${SALOME_INSTALL_DOC}/gui/${PROJECT_NAME_UC}" CACHE PATH "Install path: SALOME SALOME gui documentation") +SET(SALOME_SALOME_PROFILE_HTML_STATIC_PATH "${SALOME_SALOME_PROFILE_INSTALL_DOC_GUI}/_static" CACHE PATH "Install path: SALOME SALOME html static data") MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_PYTHON) @@ -133,5 +129,5 @@ SALOME_INSTALL_SCRIPTS("${_salome_context_API_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_ SET(_salome_context_BASHRC ${KERNEL_ROOT_DIR}/bin/salome/appliskel/.bashrc ) -FILE(TO_CMAKE_PATH $ENV{[NAME_OF_APPLICATION]_PROFILE_ROOT_DIR} _[NAME_OF_APPLICATION]_PROFILE_ROOT_DIR) -SALOME_INSTALL_SCRIPTS("${_salome_context_BASHRC}" ${_[NAME_OF_APPLICATION]_PROFILE_ROOT_DIR}) +FILE(TO_CMAKE_PATH ${CMAKE_INSTALL_PREFIX} _SALOME_PROFILE_ROOT_DIR) +SALOME_INSTALL_SCRIPTS("${_salome_context_BASHRC}" ${_SALOME_PROFILE_ROOT_DIR}) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 471a289..8327061 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -25,7 +25,7 @@ SALOME_GENERATE_ENVIRONMENT_SCRIPT(_cmd env_script "${SPHINX_EXECUTABLE}" "${_cm ADD_CUSTOM_TARGET(html_docs COMMAND ${_cmd}) INSTALL(CODE "EXECUTE_PROCESS(COMMAND \"${CMAKE_COMMAND}\" --build ${PROJECT_BINARY_DIR} --target html_docs)") -INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ DESTINATION ${SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_DOC_GUI}) +INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ DESTINATION ${SALOME_SALOME_PROFILE_INSTALL_DOC_GUI}) SET(make_clean_files html doctrees) SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${make_clean_files}") diff --git a/doc/README b/doc/README index 843a1fa..141459c 100644 --- a/doc/README +++ b/doc/README @@ -1 +1 @@ -This directory contains the sources of [Name_of_Application]'s documentation +This directory contains the sources of SALOME's documentation diff --git a/doc/conf.py.in b/doc/conf.py.in index 580bdac..be88a54 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -35,17 +35,17 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = '(name_of_application)' -copyright = '2010-2015 CEA/DEN, EDF R&D, OPEN CASCADE, ASTEK INDUSTRIE' +project = 'salome' +copyright = '2010-2016 CEA/DEN, EDF R&D, OPEN CASCADE, ASTEK INDUSTRIE' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '@SALOME[NAME_OF_APPLICATION]_MAJOR_VERSION@.@SALOME[NAME_OF_APPLICATION]_MINOR_VERSION@' +version = '@SALOMESALOME_MAJOR_VERSION@.@SALOMESALOME_MINOR_VERSION@' # The full version, including alpha/beta/rc tags. -release = '@SALOME[NAME_OF_APPLICATION]_VERSION@' +release = '@SALOMESALOME_VERSION@' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -92,7 +92,7 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. -html_theme = 'default' +html_theme = '@SPHINX_THEME@' # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". @@ -113,7 +113,7 @@ html_theme = 'default' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['@SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_DOC_GUI@/_static'] +html_static_path = ['@SALOME_SALOME_PROFILE_INSTALL_DOC_GUI@/_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. @@ -151,7 +151,7 @@ html_use_modindex = False #html_file_suffix = '' # Output file base name for HTML help builder. -htmlhelp_basename = '(name_of_application)doc' +htmlhelp_basename = 'salomedoc' # Options for LaTeX output @@ -166,7 +166,7 @@ latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, document class [howto/manual]). latex_documents = [ - ('index', '(name_of_application).tex', '[Name_of_Application] User Documentation', 'A. Ribes', 'manual') + ('index', 'salome.tex', 'SALOME User Documentation', 'A. Ribes', 'manual') ] # The name of an image file (relative to this directory) to place at the top of diff --git a/doc/index.rst b/doc/index.rst index 05713b9..30c0efa 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,6 +1,6 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -[Name_of_Application]'s documentation +SALOME's documentation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Outline diff --git a/doc/intro.rst b/doc/intro.rst index 35461a6..2b0692e 100644 --- a/doc/intro.rst +++ b/doc/intro.rst @@ -1,4 +1,4 @@ Introduction ========================================== -Welcome to [Name_of_Application]'s documentation! +Welcome to SALOME's documentation! diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 60582e1..91e0358 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -18,7 +18,7 @@ # # --- resources --- -SET([NAME_OF_APPLICATION]_PROFILE_RESOURCES_FILES +SET(SALOME_PROFILE_RESOURCES_FILES app_icon.png splash.png about.png @@ -27,10 +27,10 @@ SET([NAME_OF_APPLICATION]_PROFILE_RESOURCES_FILES ) # --- rules --- -INSTALL(FILES ${[NAME_OF_APPLICATION]_PROFILE_RESOURCES_FILES} DESTINATION ${SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_RES_DATA}) +INSTALL(FILES ${SALOME_PROFILE_RESOURCES_FILES} DESTINATION ${SALOME_SALOME_PROFILE_INSTALL_RES_DATA}) # --- config --- -SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml INSTALL ${SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_RES_DATA}) +SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml INSTALL ${SALOME_SALOME_PROFILE_INSTALL_RES_DATA}) # --- sub-directories --- ADD_SUBDIRECTORY( doc ) diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index fdf7325..e3831b6 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -11,13 +11,12 @@ -
- + @@ -25,6 +24,6 @@
- +
diff --git a/resources/about.png b/resources/about.png index dfdc7e6..61b9676 100644 Binary files a/resources/about.png and b/resources/about.png differ diff --git a/resources/app_logo.png b/resources/app_logo.png index 362c018..c0781fc 100644 Binary files a/resources/app_logo.png and b/resources/app_logo.png differ diff --git a/resources/doc/CMakeLists.txt b/resources/doc/CMakeLists.txt index 941222a..660f621 100644 --- a/resources/doc/CMakeLists.txt +++ b/resources/doc/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -24,4 +24,4 @@ SET(_bin_DOCUMENTS sample.pdf ) -INSTALL(FILES ${_bin_DOCUMENTS} DESTINATION ${SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_DOC_GUI}) +INSTALL(FILES ${_bin_DOCUMENTS} DESTINATION ${SALOME_SALOME_PROFILE_INSTALL_DOC_GUI}) diff --git a/resources/doc/README b/resources/doc/README index 4a8ab2b..babce17 100644 --- a/resources/doc/README +++ b/resources/doc/README @@ -1 +1 @@ -This directory contains binaries of [Name_of_Application]'s documentation +This directory contains binaries of SALOME's documentation diff --git a/resources/splash.png b/resources/splash.png index dfdc7e6..61b9676 100644 Binary files a/resources/splash.png and b/resources/splash.png differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5dc593a..847da55 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/src/parseConfigFile.py b/src/parseConfigFile.py index e6c2bde..77e6350 100755 --- a/src/parseConfigFile.py +++ b/src/parseConfigFile.py @@ -1,4 +1,4 @@ -# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -243,157 +243,3 @@ def _trimColons(var): v = pattern.sub(r':', v) # remove matching patterns return v # - -# This class is used to parse .sh environment file -# It deals with specific treatments: -# - virtually add a section to configuration file -# - process shell keywords (if, then...) -class EnvFileConverter(object): - def __init__(self, fp, section_name, reserved = None, outputFile=None): - if reserved is None: - reserved = [] - self.fp = fp - self.sechead = '[' + section_name + ']\n' - self.reserved = reserved - self.outputFile = outputFile - self.allParsedVariableNames = [] - # exclude line that begin with: - self.exclude = [ 'if', 'then', 'else', 'fi', '#', 'echo', 'exit' ] - self.exclude.append('$gconfTool') # QUICK FIX :TODO: provide method to extend this variable - # discard the following keywords if at the beginning of line: - self.discard = [ 'export' ] - # the following keywords imply a special processing if at the beginning of line: - self.special = [ 'unset' ] - - def readline(self): - if self.sechead: - try: - if self.outputFile is not None: - self.outputFile.write(self.sechead) - return self.sechead - finally: - self.sechead = None - else: - line = self.fp.readline() - # trim whitespaces - line = line.strip(' \t\n\r') - # line of interest? (not beginning by a keyword of self.exclude) - for k in self.exclude: - if line.startswith(k): - return '\n' - # look for substrinsg beginning with sharp charcter ('#') - line = re.sub(r'#.*$', r'', line) - # line to be pre-processed? (beginning by a keyword of self.special) - for k in self.special: - if k == "unset" and line.startswith(k): - line = line[len(k):] - line = line.strip(' \t\n\r') - line = UNSET_KEYWORD + ": " + line - # line to be pre-processed? (beginning by a keyword of self.discard) - for k in self.discard: - if line.startswith(k): - line = line[len(k):] - line = line.strip(' \t\n\r') - # process reserved keywords - for k in self.reserved: - if line.startswith(k) and "=" in line: - variable, value = line.split('=') - value = self._purgeValue(value, k) - line = ADD_TO_PREFIX + k + ": " + value - # Update list of variable names - # :TODO: define excludeBlock variable (similar to exclude) and provide method to extend it - if "cleandup()" in line: - print "WARNING: parseConfigFile.py: skip cleandup and look for '# PRODUCT environment'" - while True: - line = self.fp.readline() - if "# PRODUCT environment" in line: - print "WARNING: parseConfigFile.py: '# PRODUCT environment' found" - break - while "clean " in line[0:6]: #skip clean calls with ending ";" crash - line = self.fp.readline() - # Extract variable=value - if "=" in line: - try: - variable, value = line.split('=') - except: #avoid error for complicated sh line xx=`...=...`, but warning - print "WARNING: parseConfigFile.py: line with multiples '=' character are hazardous: '"+line+"'" - variable, value = line.split('=',1) - pass - - # Self-extending variables that are not in reserved keywords - # Example: FOO=something:${FOO} - # In this case, remove the ${FOO} in value - if variable in value: - value = self._purgeValue(value, variable) - line = "%s=%s"%(variable,value) - - self.allParsedVariableNames.append(variable) - # End of extraction - - if not line: - return line - - # - # replace "${FOO}" and "$FOO" and ${FOO} and $FOO by %(FOO)s if FOO is - # defined in current file (i.e. it is not an external environment variable) - for k in self.allParsedVariableNames: - key = r'\$\{?'+k+'\}?' - pattern = re.compile(key, re.VERBOSE) - line = pattern.sub(r'%('+k+')s', line) - # Remove quotes (if line does not contain whitespaces) - try: - variable, value = line.split('=', 1) - except ValueError: - variable, value = line.split(':', 1) - if not ' ' in value.strip(): - pattern = re.compile(r'\"', re.VERBOSE) - line = pattern.sub(r'', line) - # - - # Replace `shell_command` by its result - def myrep(obj): - obj = re.sub('`', r'', obj.group(0)) # remove quotes - obj = obj.split() - res = subprocess.Popen(obj, stdout=subprocess.PIPE).communicate()[0] - res = res.strip(' \t\n\r') # trim whitespaces - return res - # - line = re.sub('`[^`]+`', myrep, line) - # - if self.outputFile is not None: - self.outputFile.write(line+'\n') - return line - - def _purgeValue(self, value, name): - # Replace foo:${PATTERN}:bar or foo:$PATTERN:bar by foo:bar - key = r'\$\{?'+name+'\}?' - pattern = re.compile(key, re.VERBOSE) - value = pattern.sub(r'', value) - - # trim colons - value = _trimColons(value) - - return value - # - -# Convert .sh environment file to configuration file format -def convertEnvFileToConfigFile(envFilename, configFilename, reserved=None): - if reserved is None: - reserved = [] - logConfigParser.debug('convert env file %s to %s'%(envFilename, configFilename)) - fileContents = open(envFilename, 'r').read() - - pattern = re.compile('\n[\n]+', re.VERBOSE) # multiple '\n' - fileContents = pattern.sub(r'\n', fileContents) # replace by a single '\n' - - finput = StringIO(unicode(fileContents)) - foutput = open(configFilename, 'w') - - config = MultiOptSafeConfigParser() - config.optionxform = str # case sensitive - config.readfp(EnvFileConverter(finput, 'SALOME Configuration', reserved, outputFile=foutput)) - - foutput.close() - - logConfigParser.info('Configuration file generated: %s'%configFilename) -# diff --git a/src/resources/CMakeLists.txt b/src/resources/CMakeLists.txt index 057638a..7867996 100644 --- a/src/resources/CMakeLists.txt +++ b/src/resources/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -31,4 +31,4 @@ SET(_ts_RESOURCES # --- rules --- -QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_[NAME_OF_APPLICATION]_PROFILE_INSTALL_RES_DATA}") +QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_SALOME_PROFILE_INSTALL_RES_DATA}") diff --git a/src/resources/LightApp_msg_en.ts b/src/resources/LightApp_msg_en.ts index 4f92531..d7c4327 100644 --- a/src/resources/LightApp_msg_en.ts +++ b/src/resources/LightApp_msg_en.ts @@ -9,15 +9,15 @@ ABOUT_CAPTION - About [Name_of_Application] + About SALOME APP_NAME - [Name_of_Application] [SLOGAN] + SALOME APP_VERSION - V[VERSION] + V8.3.0 ABOUT_LICENSE @@ -25,11 +25,11 @@ ABOUT_VERSION - Version [VERSION] + Version 8.3.0 ABOUT_TITLE - [Name_of_Application] + SALOME diff --git a/src/resources/LightApp_msg_fr.ts b/src/resources/LightApp_msg_fr.ts index 2e12751..567ccbd 100644 --- a/src/resources/LightApp_msg_fr.ts +++ b/src/resources/LightApp_msg_fr.ts @@ -9,15 +9,15 @@ ABOUT_CAPTION - A propos de [Name_of_Application] + A propos de SALOME APP_NAME - [Name_of_Application] [SLOGAN] + SALOME APP_VERSION - V[VERSION] + V8.3.0 ABOUT_LICENSE @@ -25,11 +25,11 @@ ABOUT_VERSION - Version [VERSION] + Version 8.3.0 ABOUT_TITLE - [Name_of_Application] + SALOME diff --git a/src/resources/LightApp_msg_ja.ts b/src/resources/LightApp_msg_ja.ts index f20e44c..2bf65a0 100644 --- a/src/resources/LightApp_msg_ja.ts +++ b/src/resources/LightApp_msg_ja.ts @@ -9,15 +9,15 @@ ABOUT_CAPTION - About [Name_of_Application] + About SALOME APP_NAME - [Name_of_Application] [SLOGAN] + SALOME APP_VERSION - V[VERSION] + V8.3.0 ABOUT_LICENSE @@ -25,11 +25,11 @@ ABOUT_VERSION - Version [VERSION] + Version 8.3.0 ABOUT_TITLE - [Name_of_Application] + SALOME diff --git a/src/salomeContext.py b/src/salomeContext.py index 545e929..2b7ffad 100755 --- a/src/salomeContext.py +++ b/src/salomeContext.py @@ -1,4 +1,4 @@ -# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2013-2017 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -23,7 +23,6 @@ import logging import ConfigParser from parseConfigFile import parseConfigFile -from parseConfigFile import convertEnvFileToConfigFile import tempfile import pickle @@ -38,24 +37,29 @@ Usage: salome [command] [options] [--config=] Commands: ========= - start Starts a SALOME session (through virtual application) - context Initializes SALOME context. - shell Initializes SALOME context, and executes scripts passed - as command arguments - connect Connects a Python console to the active SALOME session - kill Terminate SALOME session running on given ports for current user - Port numbers must be separated by blank characters - killall Kill *all* SALOME running sessions for current user + start Start a new SALOME instance. + context Initialize SALOME context. Current environment is extended. + shell Initialize SALOME context, attached to the last created SALOME + instance if any, and executes scripts passed as command arguments. + User works in a Shell terminal. SALOME environment is set but + application is not started. + connect Connect a Python console to the active SALOME instance. + kill Terminate SALOME instances running on given ports for current user. + Port numbers must be separated by blank characters. + killall Terminate *all* SALOME running instances for current user. + Do not start a new one. test Run SALOME tests. - info Display some information about SALOME - help Show this message + info Display some information about SALOME. + doc Show online module documentation (if available). + Module names must be separated by blank characters. + help Show this message. -If no command is given, default to start. +If no command is given, default is start. Command options: ================ - Use salome --help to show help on command ; available for commands: - start, shell, connect, test, info. + Use salome --help to show help on command. Available for the + following commands: start, shell, connect, test, info. --config= ========================== @@ -76,12 +80,10 @@ class SalomeContext: """ Initialize context from a list of configuration files identified by their names. - These files should be in appropriate (new .cfg) format. - However you can give old .sh environment files; in this case, - the SalomeContext class will try to automatically convert them - to .cfg format before setting the context. + These files should be in appropriate .cfg format. """ def __init__(self, configFileNames=0): + self.getLogger().setLevel(logging.INFO) #it could be None explicitely (if user use multiples setVariable...for standalone) if configFileNames is None: return @@ -89,25 +91,13 @@ class SalomeContext: if len(configFileNames) == 0: raise SalomeContextException("No configuration files given") - reserved=['PATH', 'DYLD_LIBRARY_PATH', 'LD_LIBRARY_PATH', 'PYTHONPATH', 'MANPATH', 'PV_PLUGIN_PATH', 'INCLUDE', 'LIBPATH', 'SALOME_PLUGINS_PATH'] + reserved=['PATH', 'DYLD_FALLBACK_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'LD_LIBRARY_PATH', 'PYTHONPATH', 'MANPATH', 'PV_PLUGIN_PATH', 'INCLUDE', 'LIBPATH', 'SALOME_PLUGINS_PATH', 'LIBRARY_PATH'] for filename in configFileNames: basename, extension = os.path.splitext(filename) if extension == ".cfg": self.__setContextFromConfigFile(filename, reserved) - elif extension == ".sh": - #new convert procedures, temporary could be use not to be automatically deleted - #temp = tempfile.NamedTemporaryFile(suffix='.cfg', delete=False) - temp = tempfile.NamedTemporaryFile(suffix='.cfg') - try: - convertEnvFileToConfigFile(filename, temp.name, reserved) - self.__setContextFromConfigFile(temp.name, reserved) - temp.close() - except (ConfigParser.ParsingError, ValueError) as e: - self.getLogger().error("Invalid token found when parsing file: %s\n"%(filename)) - temp.close() - sys.exit(1) else: - self.getLogger().warning("Unrecognized extension for configuration file: %s", filename) + self.getLogger().error("Unrecognized extension for configuration file: %s", filename) # def __loadMPI(self, module_name): @@ -139,8 +129,8 @@ class SalomeContext: absoluteAppliPath = os.getenv('ABSOLUTE_APPLI_PATH','') env_copy = os.environ.copy() proc = subprocess.Popen(['python', os.path.join(absoluteAppliPath,"bin","salome","salomeContext.py"), pickle.dumps(self), pickle.dumps(args)], shell=False, close_fds=True, env=env_copy) - msg = proc.communicate() - return msg, proc.returncode + out, err = proc.communicate() + return out, err, proc.returncode # """Append value to PATH environment variable""" @@ -150,7 +140,15 @@ class SalomeContext: """Append value to LD_LIBRARY_PATH environment variable""" def addToLdLibraryPath(self, value): - self.addToVariable('LD_LIBRARY_PATH', value) + if platform.system() == 'Windows': + self.addToVariable('PATH', value) + elif platform.system() == 'Darwin': + if "LAPACK" in value: + self.addToVariable('DYLD_FALLBACK_LIBRARY_PATH', value) + else: + self.addToVariable('DYLD_LIBRARY_PATH', value) + else: + self.addToVariable('LD_LIBRARY_PATH', value) # """Append value to DYLD_LIBRARY_PATH environment variable""" @@ -167,11 +165,11 @@ class SalomeContext: def setVariable(self, name, value, overwrite=False): env = os.getenv(name, '') if env and not overwrite: - self.getLogger().warning("Environment variable already existing (and not overwritten): %s=%s", name, value) + self.getLogger().error("Environment variable already existing (and not overwritten): %s=%s", name, value) return if env: - self.getLogger().warning("Overwriting environment variable: %s=%s", name, value) + self.getLogger().debug("Overwriting environment variable: %s=%s", name, value) value = os.path.expandvars(value) # expand environment variables self.getLogger().debug("Set environment variable: %s=%s", name, value) @@ -218,6 +216,7 @@ class SalomeContext: 'killall' : '_killAll', 'test' : '_runTests', 'info' : '_showInfo', + 'doc' : '_showDoc', 'help' : '_usage', 'coffee' : '_makeCoffee', 'car' : '_getCar', @@ -264,7 +263,7 @@ class SalomeContext: return res or (None, None) except SystemExit, returncode: if returncode != 0: - self.getLogger().warning("SystemExit %s in method %s.", returncode, command) + self.getLogger().error("SystemExit %s in method %s.", returncode, command) sys.exit(returncode) except StandardError: self.getLogger().error("Unexpected error:") @@ -283,28 +282,8 @@ class SalomeContext: unsetVars, configVars, reservedDict = parseConfigFile(filename, reserved) except SalomeContextException, e: msg = "%s"%e - file_dir = os.path.dirname(filename) - file_base = os.path.basename(filename) - base_no_ext, ext = os.path.splitext(file_base) - sh_file = os.path.join(file_dir, base_no_ext+'.sh') - if ext == ".cfg" and os.path.isfile(sh_file): - msg += "Found similar %s file; trying to parse this one instead..."%(base_no_ext+'.sh') - temp = tempfile.NamedTemporaryFile(suffix='.cfg') - try: - convertEnvFileToConfigFile(sh_file, temp.name, reserved) - self.__setContextFromConfigFile(temp.name, reserved) - msg += "OK\n" - self.getLogger().warning(msg) - temp.close() - return - except (ConfigParser.ParsingError, ValueError) as e: - msg += "Invalid token found when parsing file: %s\n"%(sh_file) - self.getLogger().error(msg) - temp.close() - sys.exit(1) - else: - self.getLogger().error(msg) - sys.exit(1) + self.getLogger().error(msg) + sys.exit(1) # unset variables for var in unsetVars: @@ -336,7 +315,7 @@ class SalomeContext: # Initialize SALOME environment sys.argv = ['runSalome'] + args import setenv - setenv.main(True) + setenv.main(True, exeName="salome start") import runSalome runSalome.runSalome() @@ -412,7 +391,7 @@ class SalomeContext: import PortManager # mandatory from multiprocessing import Process from killSalomeWithPort import killMyPort - ports = PortManager.getBusyPorts() + ports = PortManager.getBusyPorts()['this'] if ports: import tempfile @@ -422,6 +401,7 @@ class SalomeContext: p.start() p.join() except ImportError: + # :TODO: should be declared obsolete from killSalome import killAllPorts killAllPorts() pass @@ -438,6 +418,34 @@ class SalomeContext: return runTests.runTests(args, exe="salome test") # + def _showSoftwareVersions(self, softwares=None): + config = ConfigParser.SafeConfigParser() + absoluteAppliPath = os.getenv('ABSOLUTE_APPLI_PATH') + filename = os.path.join(absoluteAppliPath, "sha1_collections.txt") + versions = {} + max_len = 0 + with open(filename) as f: + for line in f: + try: + software, version, sha1 = line.split() + versions[software.upper()] = version + if len(software) > max_len: + max_len = len(software) + except: + pass + pass + pass + if softwares: + for soft in softwares: + if versions.has_key(soft.upper()): + print soft.upper().rjust(max_len), versions[soft.upper()] + else: + import collections + od = collections.OrderedDict(sorted(versions.items())) + for name, version in od.iteritems(): + print name.rjust(max_len), versions[name] + pass + def _showInfo(self, args=None): if args is None: args = [] @@ -446,9 +454,12 @@ class SalomeContext: epilog = """\n Display some information about SALOME.\n Available options are: - -p,--ports Show list of busy ports (running SALOME instances). - -v,--version Show running SALOME version. - -h,--help Show this message. + -p,--ports Show the list of busy ports (running SALOME instances). + -s,--softwares [software(s)] Show the list and versions of SALOME softwares. + Software names must be separated by blank characters. + If no software is given, show version of all softwares. + -v,--version Show running SALOME version. + -h,--help Show this message. """ if not args: args = ["--version"] @@ -460,15 +471,60 @@ Available options are: if "-p" in args or "--ports" in args: import PortManager ports = PortManager.getBusyPorts() - print "SALOME instances are running on ports:", ports - if ports: - print "Last started instance on port %s"%ports[-1] + this_ports = ports['this'] + other_ports = ports['other'] + if this_ports or other_ports: + print "SALOME instances are running on the following ports:" + if this_ports: + print " This application:", this_ports + else: + print " No SALOME instances of this application" + if other_ports: + print " Other applications:", other_ports + else: + print " No SALOME instances of other applications" + else: + print "No SALOME instances are running" + + if "-s" in args or "--softwares" in args: + if "-s" in args: + index = args.index("-s") + else: + index = args.index("--softwares") + indexEnd=index+1 + while indexEnd < len(args) and args[indexEnd][0] != "-": + indexEnd = indexEnd + 1 + self._showSoftwareVersions(softwares=args[index+1:indexEnd]) if "-v" in args or "--version" in args: print "Running with python", platform.python_version() self._runAppli(["--version"]) # + def _showDoc(self, args=None): + if args is None: + args = [] + + modules = args + if not modules: + print "Module(s) not provided to command: salome doc " + return + + appliPath = os.getenv("ABSOLUTE_APPLI_PATH") + if not appliPath: + raise SalomeContextException("Unable to find application path. Please check that the variable ABSOLUTE_APPLI_PATH is set.") + baseDir = os.path.join(appliPath, "share", "doc", "salome") + for module in modules: + docfile = os.path.join(baseDir, "gui", module.upper(), "index.html") + if not os.path.isfile(docfile): + docfile = os.path.join(baseDir, "tui", module.upper(), "index.html") + if not os.path.isfile(docfile): + docfile = os.path.join(baseDir, "dev", module.upper(), "index.html") + if os.path.isfile(docfile): + out, err = subprocess.Popen(["xdg-open", docfile]).communicate() + else: + print "Online documentation is not accessible for module:", module + def _usage(self, unused=None): usage() # diff --git a/src/salomeContextUtils.py b/src/salomeContextUtils.py index de561cf..5fdf502 100755 --- a/src/salomeContextUtils.py +++ b/src/salomeContextUtils.py @@ -1,6 +1,6 @@ #! /usr/bin/env python -# Copyright (C) 2013-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -40,12 +40,6 @@ def __listDirectory(path): cfgFiles = glob.glob(os.path.join(root,'*.cfg')) allFiles += cfgFiles - shFiles = glob.glob(os.path.join(root,'*.sh')) - for f in shFiles: - no_ext = os.path.splitext(f)[0] - if not os.path.isfile(no_ext+".cfg"): - allFiles.append(f) - return allFiles # @@ -87,103 +81,16 @@ def __getEnvironmentFileNames(args, optionPrefix, checkExistence): return configFileNames, args, unexisting # -def __validate_pair(ob): - try: - if not (len(ob) == 2): - #print "Unexpected result:", ob - raise ValueError - except: - return False - return True -# -def __get_environment_from_batch_command(env_cmd, initial=None): - """ - Take a command (either a single command or list of arguments) - and return the environment created after running that command. - Note that if the command must be a batch file or .cmd file, or the - changes to the environment will not be captured. - - If initial is supplied, it is used as the initial environment passed - to the child process. - """ - #if not isinstance(env_cmd, (list, tuple)): - # env_cmd = [env_cmd] - # construct the command that will alter the environment - #env_cmd = subprocess.list2cmdline(env_cmd) - # create a tag so we can tell in the output when the proc is done - tag = 'Done running command' - # construct a command to do accomplish this - cmd = '{env_cmd} && echo "{tag}"'.format(**vars()) - - # launch the process - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=initial, shell=True) - # parse the output sent to stdout - lines = proc.stdout - # consume whatever output occurs until the tag is reached - #consume(itertools.takewhile(lambda l: tag not in l, lines)) - # define a way to handle each KEY=VALUE line - handle_line = lambda l: l.rstrip().split('=',1) - # parse key/values into pairs - #pairs = map(handle_line, lines) - pairs = [] - cpt = 0 - while True: - line = lines.readline() - cpt = cpt+1 - if tag in line or cpt > 1000: - break - if line: - pairs.append(line.rstrip().split('=',1)) - # make sure the pairs are valid - valid_pairs = filter(__validate_pair, pairs) - # construct a dictionary of the pairs - result = dict(valid_pairs) - # let the process finish - proc.communicate() - return result -# -def __subtract(ref, dic): - result = {} - for key,val in ref.items(): - if not dic.has_key(key): - result[key] = val - else: - # compare values types - if (type(dic[key]) != type(val)): - result[key] = val - else: - # compare values - if isinstance(val, basestring): - tolist1 = dic[key].split(os.pathsep) - tolist2 = val.split(os.pathsep) - diff = list(set(tolist2)-set(tolist1)) - if diff: - result[key] = os.pathsep.join(diff) - else: - result[key] = val - - return result -# - def getConfigFileNames(args, checkExistence=False): configOptionPrefix = "--config=" configArgs = [ str(x) for x in args if str(x).startswith(configOptionPrefix) ] if len(configArgs) == 0: - configFileNames, unexist1 = __getConfigFileNamesDefault(), [] + configFileNames, unexist = __getConfigFileNamesDefault(), [] else: # get configuration filenames - configFileNames, args, unexist1 = __getEnvironmentFileNames(args, configOptionPrefix, checkExistence) - - # get extra environment - extraEnvFileNames, args, unexist2 = __getEnvironmentFileNames(args, "--extra_env=", checkExistence) - before = __get_environment_from_batch_command("env") - after = {} - for filename in extraEnvFileNames: - after.update(__get_environment_from_batch_command(filename)) - pass + configFileNames, args, unexist = __getEnvironmentFileNames(args, configOptionPrefix, checkExistence) - extraEnv = __subtract(after,before) - return configFileNames, extraEnv, args, unexist1+unexist2 + return configFileNames, args, unexist # def __getScriptPath(scriptName, searchPathList): @@ -270,7 +177,35 @@ def getScriptsAndArgs(args=None, searchPathList=None): if not currentKey or callPython: raise SalomeContextException("args list must follow corresponding script file in command line.") elt = elt.replace(argsPrefix, '') - scriptArgs[len(scriptArgs)-1].args = [os.path.expanduser(x) for x in elt.split(",")] + # Special process if some items of 'args:' list are themselves lists + # Note that an item can be a list, but not a list of lists... + # So we can have something like this: + # myscript.py args:['file1','file2'],val1,"done",[1,2,3],[True,False],"ok" + # With such a call, an elt variable contains the string representing ['file1','file2'],val1,"done",[1,2,3],[True,False],"ok" that is '[file1,file2],val1,done,[1,2,3],[True,False],ok' + # We have to split elt to obtain: ['[file1,file2]','val1','done','[1,2,3]','[True,False]','ok'] + contains_list = re.findall('(\[[^\]]*\])', elt) + if contains_list: + extracted_args = [] + x = elt.split(",") + # x is ['[file1', 'file2]', 'val1', 'done', '[1', '2', '3]', '[True', 'False]', 'ok'] + list_begin_indices = [i for i in xrange(len(x)) if x[i].startswith('[')] # [0, 4, 7] + list_end_indices = [i for i in xrange(len(x)) if x[i].endswith(']')] # [1, 6, 8] + start = 0 + for lbeg, lend in zip(list_begin_indices,list_end_indices): # [(0, 1), (4, 6), (7, 8)] + if lbeg > start: + extracted_args += x[start:lbeg] + pass + extracted_args += [','.join(x[lbeg:lend+1])] + start = lend+1 + pass + if start < len(x): + extracted_args += x[start:len(x)] + pass + scriptArgs[len(scriptArgs)-1].args = extracted_args + pass + else: # a single split is enough + scriptArgs[len(scriptArgs)-1].args = [os.path.expanduser(x) for x in elt.split(",")] + pass currentKey = None callPython = False afterArgs = True diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index b0e95da..1895f45 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2012-2015 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2012-2016 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/src/tests/README b/src/tests/README index eae0f58..4976f7e 100644 --- a/src/tests/README +++ b/src/tests/README @@ -1 +1 @@ -This directory contains the tests of [Name_of_Application] +This directory contains the tests of SALOME