import itertools
import operator
from pathlib import Path
-import textwrap
from typing import Optional
import pytest
with chdir(tmp_path):
parent = Path("mkosi.conf")
parent.write_text(
- textwrap.dedent(
- f"""\
- [Distribution]
- Distribution={dist1}
- """
- )
+ f"""\
+ [Distribution]
+ Distribution={dist1}
+ """
)
Path("mkosi.conf.d").mkdir()
child1 = Path("mkosi.conf.d/child1.conf")
child1.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- Distribution={dist1}
-
- [Content]
- Packages=testpkg1
- """
- )
+ f"""\
+ [Match]
+ Distribution={dist1}
+
+ [Content]
+ Packages=testpkg1
+ """
)
child2 = Path("mkosi.conf.d/child2.conf")
child2.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- Distribution={dist2}
-
- [Content]
- Packages=testpkg2
- """
- )
+ f"""\
+ [Match]
+ Distribution={dist2}
+
+ [Content]
+ Packages=testpkg2
+ """
)
child3 = Path("mkosi.conf.d/child3.conf")
child3.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- Distribution=|{dist1}
- Distribution=|{dist2}
-
- [Content]
- Packages=testpkg3
- """
- )
+ f"""\
+ [Match]
+ Distribution=|{dist1}
+ Distribution=|{dist2}
+
+ [Content]
+ Packages=testpkg3
+ """
)
conf = parse_config([])[1][0]
with chdir(tmp_path):
parent = Path("mkosi.conf")
parent.write_text(
- textwrap.dedent(
- f"""\
- [Distribution]
- Distribution=fedora
- Release={release1}
- """
- )
+ f"""\
+ [Distribution]
+ Distribution=fedora
+ Release={release1}
+ """
)
Path("mkosi.conf.d").mkdir()
child1 = Path("mkosi.conf.d/child1.conf")
child1.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- Release={release1}
-
- [Content]
- Packages=testpkg1
- """
- )
+ f"""\
+ [Match]
+ Release={release1}
+
+ [Content]
+ Packages=testpkg1
+ """
)
child2 = Path("mkosi.conf.d/child2.conf")
child2.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- Release={release2}
-
- [Content]
- Packages=testpkg2
- """
- )
+ f"""\
+ [Match]
+ Release={release2}
+
+ [Content]
+ Packages=testpkg2
+ """
)
child3 = Path("mkosi.conf.d/child3.conf")
child3.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- Release=|{release1}
- Release=|{release2}
-
- [Content]
- Packages=testpkg3
- """
- )
+ f"""\
+ [Match]
+ Release=|{release1}
+ Release=|{release2}
+
+ [Content]
+ Packages=testpkg3
+ """
)
conf = parse_config([])[1][0]
with chdir(tmp_path):
parent = Path("mkosi.conf")
parent.write_text(
- textwrap.dedent(
- f"""\
- [Distribution]
- Distribution=fedora
- ImageId={image1}
- """
- )
+ f"""\
+ [Distribution]
+ Distribution=fedora
+ ImageId={image1}
+ """
)
Path("mkosi.conf.d").mkdir()
child1 = Path("mkosi.conf.d/child1.conf")
child1.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- ImageId={image1}
-
- [Content]
- Packages=testpkg1
- """
- )
+ f"""\
+ [Match]
+ ImageId={image1}
+
+ [Content]
+ Packages=testpkg1
+ """
)
child2 = Path("mkosi.conf.d/child2.conf")
child2.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- ImageId={image2}
-
- [Content]
- Packages=testpkg2
- """
- )
+ f"""\
+ [Match]
+ ImageId={image2}
+
+ [Content]
+ Packages=testpkg2
+ """
)
child3 = Path("mkosi.conf.d/child3.conf")
child3.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- ImageId=|{image1}
- ImageId=|{image2}
-
- [Content]
- Packages=testpkg3
- """
- )
+ f"""\
+ [Match]
+ ImageId=|{image1}
+ ImageId=|{image2}
+
+ [Content]
+ Packages=testpkg3
+ """
)
child4 = Path("mkosi.conf.d/child4.conf")
child4.write_text(
- textwrap.dedent(
- """\
- [Match]
- ImageId=image*
-
- [Content]
- Packages=testpkg4
- """
- )
+ """\
+ [Match]
+ ImageId=image*
+
+ [Content]
+ Packages=testpkg4
+ """
)
conf = parse_config([])[1][0]
with chdir(tmp_path):
parent = Path("mkosi.conf")
parent.write_text(
- textwrap.dedent(
- """\
- [Distribution]
- ImageId=testimage
- ImageVersion=123
- """
- )
+ """\
+ [Distribution]
+ ImageId=testimage
+ ImageVersion=123
+ """
)
Path("mkosi.conf.d").mkdir()
child1 = Path("mkosi.conf.d/child1.conf")
child1.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- ImageVersion={op}{version}
-
- [Content]
- Packages=testpkg1
- """
- )
+ f"""\
+ [Match]
+ ImageVersion={op}{version}
+
+ [Content]
+ Packages=testpkg1
+ """
)
child2 = Path("mkosi.conf.d/child2.conf")
child2.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- ImageVersion=<200
- ImageVersion={op}{version}
-
- [Content]
- Packages=testpkg2
- """
- )
+ f"""\
+ [Match]
+ ImageVersion=<200
+ ImageVersion={op}{version}
+
+ [Content]
+ Packages=testpkg2
+ """
)
child3 = Path("mkosi.conf.d/child3.conf")
child3.write_text(
- textwrap.dedent(
- f"""\
- [Match]
- ImageVersion=>9000
- ImageVersion={op}{version}
-
- [Content]
- Packages=testpkg3
- """
- )
+ f"""\
+ [Match]
+ ImageVersion=>9000
+ ImageVersion={op}{version}
+
+ [Content]
+ Packages=testpkg3
+ """
)
conf = parse_config([])[1][0]