From 221c8d24d707b904806270337dff0e51cb7b4d0c Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Fri, 19 Jan 2018 14:26:42 +0100 Subject: [PATCH] Improve handling of comments in .sby files --- sbysrc/sby_core.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sbysrc/sby_core.py b/sbysrc/sby_core.py index 9808485..10b45fd 100644 --- a/sbysrc/sby_core.py +++ b/sbysrc/sby_core.py @@ -188,12 +188,14 @@ class SbyJob: with open("%s/config.sby" % workdir, "r") as f: for line in f: raw_line = line - line = line.strip() + if mode in ["options", "engines", "files"]: + line = re.sub(r"\s*(\s#.*)?$", "", line) + if line == "" or line[0] == "#": + continue + else: + line = line.rstrip() # print(line) - if line == "" or line[0] == "#": - continue - match = re.match(r"^\s*\[(.*)\]\s*$", line) if match: entries = match.group(1).split() -- 2.30.2