From: Cédric Aguerre Date: Mon, 17 Mar 2014 17:06:28 +0000 (+0100) Subject: fix bug when parsing duplicate files and/or items X-Git-Tag: V7_4_0b1~4^2~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=750edf41493370c549f0f92029ddf68fbff3ec4a;p=modules%2Fkernel.git fix bug when parsing duplicate files and/or items --- diff --git a/bin/parseConfigFile.py b/bin/parseConfigFile.py index 7d60b2209..029262969 100644 --- a/bin/parseConfigFile.py +++ b/bin/parseConfigFile.py @@ -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): diff --git a/bin/salomeContextUtils.py.in b/bin/salomeContextUtils.py.in index 6bd96b90d..696a99b4f 100644 --- a/bin/salomeContextUtils.py.in +++ b/bin/salomeContextUtils.py.in @@ -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 #