From 750edf41493370c549f0f92029ddf68fbff3ec4a Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Aguerre?= Date: Mon, 17 Mar 2014 18:06:28 +0100 Subject: [PATCH] fix bug when parsing duplicate files and/or items --- bin/parseConfigFile.py | 9 ++++++++- bin/salomeContextUtils.py.in | 11 +++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) 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 # -- 2.39.2