From: aguerre Date: Fri, 4 Oct 2013 08:29:55 +0000 (+0000) Subject: Fix X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9b4e3fb7a66f98e695393fc5a522a95e275fd8be;p=modules%2Fyacs.git Fix --- diff --git a/bin/appliskel/salome b/bin/appliskel/salome index dd2342985..41e0883dc 100755 --- a/bin/appliskel/salome +++ b/bin/appliskel/salome @@ -30,6 +30,13 @@ def __initialize(): def main(args): # Identify application path then locate configuration files __initialize() + + if args == ['--help']: + from salomeRunner import usage + usage() + sys.exit(0) + + from salomeLauncherUtils import getConfigFileNames configFileNames, args = getConfigFileNames(args) diff --git a/bin/salomeRunner.py b/bin/salomeRunner.py index 875e914d8..512f40730 100644 --- a/bin/salomeRunner.py +++ b/bin/salomeRunner.py @@ -14,6 +14,28 @@ import platform from salomeLauncherUtils import SalomeRunnerException from salomeLauncherUtils import getScriptsAndArgs, formatScriptsAndArgs +def usage(): + #exeName = os.path.splitext(os.path.basename(__file__))[0] + + msg = '''\ +Usage: salome [command] [options] [--config=file1,...,filen] + +Commands: + start Launches SALOME virtual application [DEFAULT] + shell Executes a script under SALOME application environment + connect Connects a Python console to the active SALOME session + killall Kill all SALOME running sessions + info Display some information about SALOME + help Show this message + coffee Yes! SALOME can also make coffee!!" + +Use salome start --help or salome shell --help +to show help on start and shell commands. +''' + + print msg +# + """ The SalomeRunner class in an API to configure SALOME environment then start SALOME using a single python command. @@ -116,26 +138,6 @@ class SalomeRunner: # This begins the private section # ################################### - def _usage(self, unused=[]): - #exeName = os.path.splitext(os.path.basename(__file__))[0] - - msg = '''\ -Usage: salome [command] [options] [--config=file1,...,filen] - -Commands: - start Launches SALOME virtual application [DEFAULT] - shell Executes a script under SALOME application environment - connect Connects a Python console to the active SALOME session - killall Kill all SALOME running sessions - info Display some information about SALOME - help Show this message - coffee Yes! SALOME can also make coffee!!"\ - -''' - - print msg - # - def __parseArguments(self, args): if len(args) == 0 or args[0].startswith("-"): return None, args @@ -171,7 +173,7 @@ Commands: if command is None: if args and args[0] in ["-h","--help","help"]: - self._usage() + usage() sys.exit(0) # try to default to "start" command command = "_runAppli" @@ -294,6 +296,10 @@ Commands: self._runAppli(["--version"]) # + def _usage(self, unused=[]): + usage() + # + def _makeCoffee(self, args=[]): print " (" print " ) (" @@ -352,5 +358,5 @@ if __name__ == "__main__": if err: sys.stderr.write(err) else: - SalomeRunner()._usage() + usage() # diff --git a/salome_adm/unix/config_files/check_Kernel.m4 b/salome_adm/unix/config_files/check_Kernel.m4 index eb9c31743..e75a22db9 100644 --- a/salome_adm/unix/config_files/check_Kernel.m4 +++ b/salome_adm/unix/config_files/check_Kernel.m4 @@ -43,9 +43,9 @@ KERNEL_LDFLAGS="" KERNEL_CXXFLAGS="" AC_ARG_WITH(kernel, - [--with-kernel=DIR root directory path of KERNEL build or installation], - [KERNEL_DIR="$withval"], - [KERNEL_DIR=""]) + [--with-kernel=DIR root directory path of KERNEL build or installation], + [KERNEL_DIR="$withval"], + [KERNEL_DIR=""]) if test "x${KERNEL_DIR}" = "x" ; then AC_MSG_RESULT(for \${KERNEL_ROOT_DIR}: ${KERNEL_ROOT_DIR}) @@ -55,16 +55,16 @@ if test "x${KERNEL_DIR}" = "x" ; then KERNEL_DIR=${KERNEL_ROOT_DIR} else # search Kernel binaries in PATH variable - AC_PATH_PROG(TEMP,runSalome) + AC_PATH_PROG(TEMP,runSalome.py) if test "x${TEMP}" != "x" ; then - AC_MSG_RESULT(runSalome was found at : ${TEMP}) + AC_MSG_RESULT(runSalome.py was found at : ${TEMP}) KERNEL_BIN_DIR=`dirname ${TEMP}` KERNEL_DIR=`cd ${KERNEL_BIN_DIR}/../..; pwd` fi fi fi -if test -f ${KERNEL_DIR}/bin/salome/runSalome ; then +if test -f ${KERNEL_DIR}/bin/salome/runSalome.py ; then AC_MSG_RESULT(Using Kernel module distribution in ${KERNEL_DIR}) Kernel_ok=yes @@ -89,6 +89,6 @@ else fi AC_MSG_RESULT(for Kernel: $Kernel_ok) - + ])dnl - + diff --git a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx index 396887a28..80da81671 100644 --- a/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx +++ b/src/LifeCycleCORBA/SALOME_LifeCycleCORBA.cxx @@ -61,7 +61,7 @@ IncompatibleComponent::IncompatibleComponent( void ): } IncompatibleComponent::IncompatibleComponent(const IncompatibleComponent &ex): - SALOME_Exception( ex ) + SALOME_Exception( ex ) { } @@ -71,7 +71,7 @@ IncompatibleComponent::IncompatibleComponent(const IncompatibleComponent &ex): */ //============================================================================= -/*! +/*! * Constructor */ //============================================================================= @@ -93,7 +93,7 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns) } else _NS = ns; //add try catch - _NS->Change_Directory("/"); // mpv 250105: current directory may be not root + _NS->Change_Directory("/"); // mpv 250105: current directory may be not root // (in SALOMEDS for an example) // not enough: set a current directory in naming service is not thread safe // if naming service instance is shared among several threads... @@ -112,7 +112,7 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns) } //============================================================================= -/*! +/*! * Destructor */ //============================================================================= @@ -291,7 +291,7 @@ SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName, // containerName doesn't contain "/" => Local container params.container_name = CORBA::string_dup(stContainer); } - else + else { stContainer[rg]='\0'; params.container_name = CORBA::string_dup(stContainer+rg+1); @@ -316,12 +316,12 @@ bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName) try { CORBA::Object_var obj = _NS->Resolve("/Kernel/ModulCatalog"); - SALOME_ModuleCatalog::ModuleCatalog_var Catalog = + SALOME_ModuleCatalog::ModuleCatalog_var Catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ; ASSERT(! CORBA::is_nil(Catalog)); - SALOME_ModuleCatalog::Acomponent_var compoInfo = + SALOME_ModuleCatalog::Acomponent_var compoInfo = Catalog->GetComponent(componentName); - if (CORBA::is_nil (compoInfo)) + if (CORBA::is_nil (compoInfo)) { MESSAGE("Catalog Error: Component not found in the catalog " << componentName); return false; @@ -344,7 +344,7 @@ bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName) */ //============================================================================= -void +void SALOME_LifeCycleCORBA::preSet(Engines::ResourceParameters& params) { params.name = ""; @@ -377,7 +377,7 @@ void SALOME_LifeCycleCORBA::preSet( Engines::ContainerParameters& params) } //============================================================================= -/*! +/*! * \return a number of processors not 0, only for MPI containers */ //============================================================================= @@ -429,7 +429,7 @@ void SALOME_LifeCycleCORBA::shutdownServers() { // get each Container from NamingService => shutdown it // (the order is inverse to the order of servers initialization) - + SALOME::Session_var session = SALOME::Session::_nil(); CORBA::Long pid = 0; CORBA::Object_var objS = _NS->Resolve("/Kernel/Session"); @@ -444,7 +444,7 @@ void SALOME_LifeCycleCORBA::shutdownServers() } std::string hostname = Kernel_Utils::GetHostname(); - + // 1) ConnectionManager try { @@ -515,7 +515,7 @@ void SALOME_LifeCycleCORBA::shutdownServers() { // ignore and continue } - + //Wait some time so that launcher be completely shutdown #ifndef WIN32 nanosleep(&ts_req,0); @@ -562,8 +562,8 @@ void SALOME_LifeCycleCORBA::shutdownServers() name.length(1); name[0].id = CORBA::string_dup(stdname.c_str()); try - { - if(!CORBA::is_nil(orb)) + { + if(!CORBA::is_nil(orb)) theObj = orb->resolve_initial_references("NameService"); if (!CORBA::is_nil(theObj)) inc = CosNaming::NamingContext::_narrow(theObj); @@ -571,7 +571,7 @@ void SALOME_LifeCycleCORBA::shutdownServers() catch(...) { } - if(!CORBA::is_nil(inc)) + if(!CORBA::is_nil(inc)) { try { @@ -594,7 +594,7 @@ void SALOME_LifeCycleCORBA::shutdownServers() void SALOME_LifeCycleCORBA::killOmniNames() { std::string portNumber (::getenv ("NSPORT") ); - if ( !portNumber.empty() ) + if ( !portNumber.empty() ) { #ifdef WNT #else @@ -610,9 +610,9 @@ void SALOME_LifeCycleCORBA::killOmniNames() } #endif } - + // NPAL 18309 (Kill Notifd) - if ( !portNumber.empty() ) + if ( !portNumber.empty() ) { std::string cmd = ("from killSalomeWithPort import killNotifdAndClean; "); cmd += std::string("killNotifdAndClean(") + portNumber + "); "; @@ -620,6 +620,16 @@ void SALOME_LifeCycleCORBA::killOmniNames() MESSAGE(cmd); system( cmd.c_str() ); } + + // shutdown portmanager + if ( !portNumber.empty() ) + { + std::string cmd = ("from PortManager import releasePort; "); + cmd += std::string("releasePort(") + portNumber + "); "; + cmd = std::string("python -c \"") + cmd +"\" > /dev/null 2> /dev/null"; + MESSAGE(cmd); + system( cmd.c_str() ); + } } //============================================================================= @@ -696,9 +706,9 @@ _FindComponent(const Engines::ContainerParameters& params, */ //============================================================================= -Engines::EngineComponent_ptr +Engines::EngineComponent_ptr SALOME_LifeCycleCORBA:: -_LoadComponent(const Engines::ContainerParameters& params, +_LoadComponent(const Engines::ContainerParameters& params, const char *componentName, int studyId) { @@ -712,7 +722,7 @@ _LoadComponent(const Engines::ContainerParameters& params, char* reason; bool isLoadable = cont->load_component_Library(componentName,reason); - if (!isLoadable) + if (!isLoadable) { //std::cerr << reason << std::endl; CORBA::string_free(reason);