From bd3dbd1420d762ddc17c78b231a984d7b7c5edf3 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 15 Mar 2013 13:33:33 +0000 Subject: [PATCH] Merge from V6_main 15/03/2013 --- bin/launchConfigureParser.py | 24 ++++++++++++++++- bin/runSalome.py | 2 +- bin/searchFreePort.py | 40 ++++++++++++++++++++-------- doc/salome/gui/static/header.html.in | 2 ++ doc/salome/main.dox | 30 ++++++++++----------- doc/salome/tui/static/header.html.in | 2 ++ 6 files changed, 72 insertions(+), 28 deletions(-) diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index 92b5e9aea..487e25103 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -74,6 +74,7 @@ plugins_nam = "plugins" # values passed as arguments, NOT read from XML config file, but set from within this script appname_nam = "appname" port_nam = "port" +useport_nam = "useport" salomecfgname = "salome" salomeappname = "SalomeApp" script_nam = "pyscript" @@ -773,6 +774,17 @@ def CreateOptionParser (theAdditionalOptions=[]): dest="server_launch_mode", help=help_str) + # use port + help_str = "Preferable port SALOME to be started on. " + help_str += "If specified port is not busy, SALOME session will start on it; " + help_str += "otherwise, any available port will be searched and used." + o_port = optparse.Option("--port", + metavar="", + type="int", + action="store", + dest="use_port", + help=help_str) + # All options opt_list = [o_t,o_g, # GUI/Terminal o_d,o_o, # Desktop @@ -802,6 +814,7 @@ def CreateOptionParser (theAdditionalOptions=[]): o_foreground, o_wake_up, o_slm, # Server launch mode + o_port, # Use port ] #std_options = ["gui", "desktop", "log_file", "py_scripts", "resources", @@ -1152,7 +1165,16 @@ def get_env(theAdditionalOptions=[], appname=salomeappname, cfgname=salomecfgnam # Server launch command if cmd_opts.server_launch_mode is not None: - args["server_launch_mode"] = cmd_opts.server_launch_mode + args["server_launch_mode"] = cmd_opts.server_launch_mode + + # Server launch command + if cmd_opts.use_port is not None: + min_port = 2810 + max_port = min_port + 100 + if cmd_opts.use_port not in xrange(min_port, max_port+1): + print "Error: port number should be in range [%d, %d])" % (min_port, max_port) + sys.exit(1) + args[useport_nam] = cmd_opts.use_port # return arguments os.environ[config_var] = separator.join(dirs) diff --git a/bin/runSalome.py b/bin/runSalome.py index f6e76652f..dd60df335 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -843,7 +843,7 @@ def main(): pass if test: from searchFreePort import searchFreePort - searchFreePort(args, save_config) + searchFreePort(args, save_config, args.get('useport')) pass # -- #setenv.main() diff --git a/bin/searchFreePort.py b/bin/searchFreePort.py index 32d858f31..392b8adcf 100644 --- a/bin/searchFreePort.py +++ b/bin/searchFreePort.py @@ -22,13 +22,12 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -def searchFreePort(args={}, save_config=1): +def searchFreePort(args={}, save_config=1, use_port=None): """ Search free port for SALOME session. Returns first found free port number. """ import sys, os, re, shutil - print "Searching for a free port for naming service:", # :NOTE: Under windows: # netstat options -l and -t are unavailable @@ -53,13 +52,8 @@ def searchFreePort(args={}, save_config=1): pass return False # - NSPORT=2810 - limit=NSPORT+100 - # - while 1: - if not portIsUsed(NSPORT, ports): - print "%s - OK"%(NSPORT) + def setup_config(nsport): # from salome_utils import generateFileName, getHostName hostname = getHostName() @@ -68,12 +62,11 @@ def searchFreePort(args={}, save_config=1): appli = os.getenv("APPLI") kwargs={} if appli is not None: - home = os.path.join(os.path.realpath(home), appli,"USERS") + home = os.path.join(os.path.realpath(home), appli, "USERS") kwargs["with_username"]=True # from ORBConfigFile import writeORBConfigFile - omniorb_config, giopsize = writeORBConfigFile(home, hostname, NSPORT, kwargs) - + omniorb_config, giopsize = writeORBConfigFile(home, hostname, nsport, kwargs) args['port'] = os.environ['NSPORT'] # if save_config: @@ -99,6 +92,29 @@ def searchFreePort(args={}, save_config=1): except: pass # + + if use_port: + print "Check if port can be used: %d" % use_port, + if not portIsUsed(use_port, ports): + print "- OK" + setup_config(use_port) + return + else: + print "- KO: port is busy" + pass + # + + print "Searching for a free port for naming service:", + # + + NSPORT=2810 + limit=NSPORT+100 + # + + while 1: + if not portIsUsed(NSPORT, ports): + print "%s - OK"%(NSPORT) + setup_config(NSPORT) break print "%s"%(NSPORT), if NSPORT == limit: @@ -108,4 +124,6 @@ def searchFreePort(args={}, save_config=1): raise RuntimeError, msg NSPORT=NSPORT+1 pass + # + return diff --git a/doc/salome/gui/static/header.html.in b/doc/salome/gui/static/header.html.in index 4571b4363..d434d830d 100755 --- a/doc/salome/gui/static/header.html.in +++ b/doc/salome/gui/static/header.html.in @@ -5,6 +5,8 @@ $title + + $treeview $search $mathjax diff --git a/doc/salome/main.dox b/doc/salome/main.dox index eea5b33e9..850784f5a 100644 --- a/doc/salome/main.dox +++ b/doc/salome/main.dox @@ -27,9 +27,9 @@ introductory documentation, listed below. \section S3_main Application Integrator - Applications integrators are in charge of configuration and installation of - specific %SALOME applications over a local network. Application Integrators - built %SALOME modules binaries from sources tarballs. +Applications integrators are in charge of configuration and installation of +specific %SALOME applications over a local network. Application Integrators +built %SALOME modules binaries from sources tarballs. -# How to install %SALOME\n See \subpage INSTALL for general information on required configuration and @@ -40,10 +40,10 @@ introductory documentation, listed below. \section S4_main Module maintainer - Module maintainers are in charge of the development and debug of the %SALOME - modules. Each %SALOME module is stored in a CVS base. CVS bases are organised - in separate branches for developments and debug. All official or development - releases are identified by a CVS tag. +Module maintainers are in charge of the development and debug of the %SALOME +modules. Each %SALOME module is stored in a CVS base. CVS bases are organised +in separate branches for developments and debug. All official or development +releases are identified by a CVS tag. -# Source code structuration and Unit Tests\n See \subpage UnitTests for general information on code directories structure, @@ -55,15 +55,15 @@ introductory documentation, listed below. \section S5_main SALOME programming model - You will find in the next pages informations about - specific points of %SALOME Kernel : +You will find in the next pages informations about +specific points of %SALOME Kernel : - - \subpage kernel_salome - - \subpage dsc_page : DSC documentation page. - - \subpage salome_file_page : Salome_file documentation page. - - - Documentation of the KERNEL python package : The package salome.kernel provides - logging tools, high-level functions to handle items in Salome study, and other utilities. +- \subpage kernel_salome +- \subpage dsc_page : DSC documentation page. +- \subpage salome_file_page : Salome_file documentation page. +- + Documentation of the KERNEL python package : The package salome.kernel provides + logging tools, high-level functions to handle items in Salome study, and other utilities. */ diff --git a/doc/salome/tui/static/header.html.in b/doc/salome/tui/static/header.html.in index 4571b4363..d434d830d 100755 --- a/doc/salome/tui/static/header.html.in +++ b/doc/salome/tui/static/header.html.in @@ -5,6 +5,8 @@ $title + + $treeview $search $mathjax -- 2.39.2