]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
fix bug when parsing duplicate files and/or items
authorCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 17 Mar 2014 17:06:28 +0000 (18:06 +0100)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Mon, 17 Mar 2014 17:06:28 +0000 (18:06 +0100)
bin/parseConfigFile.py
bin/salomeContextUtils.py.in

index 7d60b22095195aa1439ef8cc98385a3cd93fcbf4..0292629699043502a25bc1b7ee0beb92c1320a5c 100644 (file)
@@ -202,7 +202,14 @@ def __processConfigFile(config, reserved = [], filename="UNKNOWN FILENAME"):
       pass # end for key,val
     pass # end for section
 
-  return unsetVariables, outputVariables, reservedValues
+  # remove duplicate values
+  outVars = []
+  for (var, values) in outputVariables:
+    vals = values.split(',')
+    vals = list(set(vals))
+    outVars.append((var, ','.join(vals)))
+
+  return unsetVariables, outVars, reservedValues
 #
 
 def _trimColons(var):
index 6bd96b90d770a2dcf61d2262470826984c643993..696a99b4f28a19b626461c9255828cbd89f7ddf1 100644 (file)
@@ -35,8 +35,15 @@ class SalomeContextException(Exception):
 def __listDirectory(path):
   allFiles = []
   for root, dirs, files in os.walk(path):
-    configFileNames = glob.glob(os.path.join(root,'*.cfg')) + glob.glob(os.path.join(root,'*.sh'))
-    allFiles += configFileNames
+    cfgFiles = glob.glob(os.path.join(root,'*.cfg'))
+    allFiles += cfgFiles
+
+    shFiles = glob.glob(os.path.join(root,'*.sh'))
+    for f in shFiles:
+      no_ext = os.path.splitext(f)[0]
+      if not os.path.isfile(no_ext+".cfg"):
+        allFiles.append(f)
+
   return allFiles
 #