X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=bin%2Fnameserver.py;h=e20cd2f9c9ed4807a688ce7a34678fa977becaed;hb=44d76ca4d8b7d52192167790d1c0416d26629702;hp=726e1d4c9084fac1f8499c5493a6d445c5f1f5c1;hpb=e429ce02076e083051c6520e0d7113022bd67b18;p=modules%2Fkernel.git diff --git a/bin/nameserver.py b/bin/nameserver.py old mode 100755 new mode 100644 index 726e1d4c9..e20cd2f9c --- a/bin/nameserver.py +++ b/bin/nameserver.py @@ -1,6 +1,5 @@ -#!/usr/bin/env python # -*- coding: iso-8859-1 -*- -# Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +# Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE # # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -25,7 +24,7 @@ import os, sys, re, socket #import commands from server import Server -from Utils_Identity import getShortHostName +from salome_utils import getHostName from launchConfigureParser import verbose # ----------------------------------------------------------------------------- @@ -42,21 +41,16 @@ class NamingServer(Server): from salome_utils import getLogDir upath = getLogDir() try: - os.makedirs(upath, mode=0777) + os.makedirs(upath, mode=0o777) except: pass - if verbose(): print "Name Service... ", - #hname=os.environ["HOST"] #commands.getoutput("hostname") - if sys.platform == "win32": - hname = getShortHostName(); - else: - hname = socket.gethostname(); - #print "hname=",hname + if verbose(): print("Name Service... ", end =' ') + hname = getHostName() with open(os.environ["OMNIORB_CONFIG"]) as f: ss = re.findall("NameService=corbaname::" + hname + ":\d+", f.read()) - if verbose(): print "ss = ", ss, + if verbose(): print("ss = ", ss, end=' ') sl = ss[0] ll = sl.split(':') aPort = ll[-1] @@ -73,7 +67,7 @@ class NamingServer(Server): try: os.mkdir(upath) except: - #print "Can't create " + upath + # print("Can't create " + upath) pass #os.system("touch " + upath + "/dummy") @@ -85,11 +79,11 @@ class NamingServer(Server): #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/" - #print "sed command = ", aSedCommand + # print("sed command = ", aSedCommand) #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"]) - #print "port=", aPort + # print("port=", aPort) if sys.platform == "win32": - #print "start omniNames -start " + aPort + " -logdir " + upath + # print("start omniNames -start " + aPort + " -logdir " + upath) self.CMD = ['omniNames', '-start' , aPort , '-nohostname', '-logdir' , os.path.realpath(upath), '-errlog', os.path.realpath(os.path.join(upath,'omniNameErrors.log'))] #os.system("start omniNames -start " + aPort + " -logdir " + upath) else: @@ -97,14 +91,16 @@ class NamingServer(Server): self.CMD = ['omniNames','-start' , aPort, '-logdir' , upath, '-errlog', upath+'/omniNameErrors.log'] #os.system("omniNames -start " + aPort + " -logdir " + upath + " &") - if verbose(): print "... ok" - if verbose(): print "to list contexts and objects bound into the context with the specified name : showNS " + if verbose(): print("... ok") + if verbose(): print("to list contexts and objects bound into the context with the specified name : showNS ") def initArgs(self): Server.initArgs(self) if sys.platform == "win32": env_ld_library_path = ['env', 'LD_LIBRARY_PATH=' + os.getenv("PATH")] + elif sys.platform == "darwin": + env_ld_library_path = ['env', 'DYLD_LIBRARY_PATH=' + os.getenv("DYLD_LIBRARY_PATH"), 'DYLD_FALLBACK_LIBRARY_PATH=' + os.getenv("DYLD_FALLBACK_LIBRARY_PATH")] else: env_ld_library_path = ['env', 'LD_LIBRARY_PATH=' + os.getenv("LD_LIBRARY_PATH")] self.CMD = ['xterm', '-e']+ env_ld_library_path + ['python']