Merge pull request #40 from outis1one/clDemoe/seasonal-sunrise-montage-nn268
Fix Python config parser swallowing inline comments as part of values
This commit is contained in:
+3
-1
@@ -18,7 +18,9 @@ def _read_conf(path):
|
|||||||
continue
|
continue
|
||||||
k, v = line.split('=', 1)
|
k, v = line.split('=', 1)
|
||||||
k = k.strip()
|
k = k.strip()
|
||||||
v = v.strip().strip('"').strip("'")
|
v = v.strip()
|
||||||
|
v = re.sub(r'\s+#.*$', '', v) # strip inline comments
|
||||||
|
v = v.strip('"').strip("'")
|
||||||
# Extract default from bash ${VAR:-default} pattern
|
# Extract default from bash ${VAR:-default} pattern
|
||||||
m = re.match(r'^\$\{[^}]+:-([^}]*)\}$', v)
|
m = re.match(r'^\$\{[^}]+:-([^}]*)\}$', v)
|
||||||
if m:
|
if m:
|
||||||
|
|||||||
+3
-1
@@ -20,7 +20,9 @@ def read_config(path):
|
|||||||
continue
|
continue
|
||||||
k, v = line.split('=', 1)
|
k, v = line.split('=', 1)
|
||||||
k = k.strip()
|
k = k.strip()
|
||||||
v = v.strip().strip('"').strip("'")
|
v = v.strip()
|
||||||
|
v = re.sub(r'\s+#.*$', '', v) # strip inline comments
|
||||||
|
v = v.strip('"').strip("'")
|
||||||
m = re.match(r'^\$\{[^}]+:-([^}]*)\}$', v)
|
m = re.match(r'^\$\{[^}]+:-([^}]*)\}$', v)
|
||||||
if m:
|
if m:
|
||||||
v = m.group(1).strip('"').strip("'")
|
v = m.group(1).strip('"').strip("'")
|
||||||
|
|||||||
Reference in New Issue
Block a user