Salome HOME
Remove special process for PARAVIS
[modules/yacs.git] / bin / ORBConfigFile.py
index 0f7e16881d9e136c2db04295eaa594a9e52cbca5..9fbe3b8e2aac730127099b5599bd5c6fd67ed1af 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2016  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
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+def readORBConfigFile(filename):
+  """ Extract information (host, port) from ORB configuration file. """
+  with open(filename) as f:
+    contents = f.readlines()
+
+  import re
+  host, port = None, None
+  for line in contents:
+    m = re.match("(ORB)?InitRef = NameService=corbaname::([\D\d]+):(\d*)", line)
+    if m:
+      host = m.group(2)
+      port = m.group(3)
+      break
+    pass
+  return host, port
+#
+
 # IMPORTANT NOTE: do not add any print call (cf. note at the bottom of the file)
 def writeORBConfigFile(path, host, port, kwargs={}):