Skip to contentSkip to conversation

convert-overrides.py: also convert comments without a leading whitespace

PATCH New Chen Qi 1 participant 1 message Aug 6, 2021

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH v2 1/1 convert-overrides.py: also convert comments without a leading whitespace

Currently lines like below are converted.
e.g.
# IMAGE_INSTALL_append = " A"

But lines without a leading whitespace are not converted.
e.g.
#IMAGE_INSTALL_append = " A"

We should be converting both.

Also bump the script's version.

---
 scripts/contrib/convert-overrides.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/contrib/convert-overrides.py +4 -4
index 4647f29cab..7085f239db 100755
@@ -70,15 +70,15 @@ packagevars = packagevars + imagevars
 
 vars_re = {}
 for exp in vars:
-    vars_re[exp] = (re.compile('((^|[\'"\s\-\+])[A-Za-z0-9_\-:${}\.]+)_' + exp), r"\1:" + exp)
+    vars_re[exp] = (re.compile('((^|[#\'"\s\-\+])[A-Za-z0-9_\-:${}\.]+)_' + exp), r"\1:" + exp)
 
 shortvars_re = {}
 for exp in shortvars:
-    shortvars_re[exp] = (re.compile('((^|[\'"\s\-\+])[A-Za-z0-9_\-:${}\.]+)_' + exp + '([\(\'"\s:])'), r"\1:" + exp + r"\3")
+    shortvars_re[exp] = (re.compile('((^|[#\'"\s\-\+])[A-Za-z0-9_\-:${}\.]+)_' + exp + '([\(\'"\s:])'), r"\1:" + exp + r"\3")
 
 package_re = {}
 for exp in packagevars:
-    package_re[exp] = (re.compile('(^|[\'"\s\-\+]+)' + exp + '_' + '([$a-z"\'\s%\[<{\\\*].)'), r"\1" + exp + r":\2")
+    package_re[exp] = (re.compile('(^|[#\'"\s\-\+]+)' + exp + '_' + '([$a-z"\'\s%\[<{\\\*].)'), r"\1" + exp + r":\2")
 
 # Other substitutions to make
 subs = {
@@ -123,7 +123,7 @@ def processfile(fn):
         pass
 
 ourname = os.path.basename(sys.argv[0])
-ourversion = "0.9.3"
+ourversion = "0.9.4"
 
 if os.path.isfile(sys.argv[1]):
     processfile(sys.argv[1])
Signature · 1 line
2.30.2