From a60754cf4b24442c33a32c5c849a333c637020a2 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Wed, 5 Aug 2015 12:01:41 +0200 Subject: [PATCH] dance around issue with get_config_dict triggering a (re)parse, which may be a problem for format v2 easyconfigs --- easybuild/framework/easyconfig/parser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/easybuild/framework/easyconfig/parser.py b/easybuild/framework/easyconfig/parser.py index f78ba3a0e0..6e49a59232 100644 --- a/easybuild/framework/easyconfig/parser.py +++ b/easybuild/framework/easyconfig/parser.py @@ -155,8 +155,7 @@ def _extract_comments(self): while rawlines[0].startswith('#'): self.comments['header'].append(rawlines.pop(0)) - parsed_ec = self.get_config_dict() - + parsed_ec = None while rawlines: rawline = rawlines.pop(0) if rawline.startswith('#'): @@ -171,6 +170,11 @@ def _extract_comments(self): self.comments['above'][key] = comment elif '#' in rawline: # inline comment + if parsed_ec is None: + # obtain parsed easyconfig as a dict, if it wasn't already + # note: this currently trigger a reparse + parsed_ec = self.get_config_dict() + key = rawline.split('=', 1)[0].strip() comment = rawline.rsplit('#', 1)[1].strip()