3 # Copyright (C) 2005 OPEN CASCADE, CEA, EDF R&D, LEG
4 # PRINCIPIA R&D, EADS CCR, Lip6, BV, CEDRAT
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 def getNSparams(info=""):
27 check environment for omniORB configuration file.
28 parse the file to find the line defining naming service host and port,
29 set environment variables NSPORT and NSHOST,
31 if info==host print host
32 elif info==port print host
33 else print 2 strings on stdout on one line: host port
37 if os.environ.has_key("OMNIORB_CONFIG"):
38 file = open(os.environ["OMNIORB_CONFIG"], "r")
41 l = string.split(s, ":")
42 if string.split(l[0], " ")[0] == "ORBInitRef" or \
43 string.split(l[0], " ")[0] == "InitRef" :
45 if my_port[-1] == '\n':
46 my_port = my_port[:-1]
55 # keep print, stdout used in shell
57 os.environ['NSHOST']=my_host
61 # keep print, stdout used in shell
63 os.environ['NSPORT']=my_port
67 # keep print, stdout used in shell
68 print my_host, my_port
69 return my_host, my_port
72 # ------------------------------------------------------------------------
74 if __name__ == "__main__":
76 if sys.argv[1]=='host':
79 elif sys.argv[1]=='port':