]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Drop support for ; comments
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 17 Sep 2024 18:45:25 +0000 (20:45 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 17 Sep 2024 18:49:55 +0000 (20:49 +0200)
Can be part of a pkcs11 URI so let's drop support for ';' for comments.
I've never seen anyone use this so it shouldn't be a problem to drop
this.

mkosi/config.py
tests/test_config.py

index 0fc3067faecbcc8d03fb77a03f1ff8b38ee71e1b..e61d5a5455890b2387dbc9c901c0735dbf54a6b5 100644 (file)
@@ -1823,11 +1823,9 @@ def parse_ini(path: Path, only_sections: Collection[str] = ()) -> Iterator[tuple
     value: Optional[str] = None
 
     for line in textwrap.dedent(path.read_text()).splitlines():
-        # Systemd unit files allow both '#' and ';' to indicate comments so we do the same.
-        for c in ("#", ";"):
-            comment = line.find(c)
-            if comment >= 0:
-                line = line[:comment]
+        comment = line.find("#")
+        if comment >= 0:
+            line = line[:comment]
 
         if not line.strip():
             continue
index 433510883956c8030b5c13ffc14aba5c05b4eb64..8546ac719e07cf888e46818829b2ee9d40d4d6af 100644 (file)
@@ -68,7 +68,6 @@ def test_parse_ini(tmp_path: Path) -> None:
         ALLCAPS=txt
 
         # Comment
-        ; Another comment
         [EmptySection]
         [AnotherSection]
         EmptyValue=