diff --git a/packages/brpm b/packages/brpm index 7a1cf3d1d96..e24db2b7a92 100755 --- a/packages/brpm +++ b/packages/brpm @@ -29,7 +29,7 @@ def find_root(): if "avoid-pep8-E402-import-not-top-of-file": # Use the util functions from cloudinit sys.path.insert(0, find_root()) - from cloudinit import subp, templater, util + from cloudinit import subp, templater, temp_utils, util # Subdirectories of the ~/rpmbuild dir @@ -83,7 +83,7 @@ def read_version_from_meson(): [ "meson", "setup", - "builddir", + builddir, "-Dinit_system=systemd", "-Ddisable_sshd_keygen=true", ] diff --git a/pyproject.toml b/pyproject.toml index b9e25e083c4..4657424c946 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -211,6 +211,7 @@ lint.ignore = [ "D403", # docstring: capitalized first line "E731", # Do not assign a `lambda` expression, use a `def` ] +extend-include = ["*read-dependencies", "*bddeb", "*brpm"] [tool.ruff.lint.pydocstyle] convention = "pep257" diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py index e4acf61b23a..63aeae955b1 100644 --- a/tests/unittests/helpers.py +++ b/tests/unittests/helpers.py @@ -283,6 +283,15 @@ def skipUnlessJsonSchema(): ) +def skipUnlessJinjaVersionGreaterThan(version=(0, 0, 0)): + import jinja2 + + return pytest.mark.skipif( + tuple(map(int, jinja2.__version__.split("."))) < version, + reason=f"jinj2 version is less than {version}", + ) + + @contextmanager def does_not_raise(): """Context manager to parametrize tests raising and not raising exceptions diff --git a/tests/unittests/test_render_template.py b/tests/unittests/test_render_template.py index 793786fa95d..7f8fc944429 100644 --- a/tests/unittests/test_render_template.py +++ b/tests/unittests/test_render_template.py @@ -6,6 +6,7 @@ from cloudinit import subp, templater, util from tests.helpers import cloud_init_project_dir +from tests.unittests.helpers import skipUnlessJinjaVersionGreaterThan # TODO(Look to align with tools.render-template or cloudinit.distos.OSFAMILIES) DISTRO_VARIANTS = [ @@ -203,6 +204,7 @@ class TestRenderSourcesList: ), ], ) + @skipUnlessJinjaVersionGreaterThan((3, 0, 0)) def test_render_sources_list_templates( self, tmpdir, template_path, expected ): diff --git a/tools/read-dependencies b/tools/read-dependencies index f0e21124c63..bed826f3b79 100755 --- a/tools/read-dependencies +++ b/tools/read-dependencies @@ -140,8 +140,22 @@ CI_SYSTEM_BASE_PKGS = { "freebsd": [f"{FREEBSD_PKG_PREFIX}tox"], "redhat": ["python3-tox"], "centos": ["python3-tox"], - "ubuntu": ["make", "devscripts", "python3-dev", "libssl-dev", "tox", "sbuild"], - "debian": ["make", "devscripts", "python3-dev", "libssl-dev", "tox", "sbuild"], + "ubuntu": [ + "make", + "devscripts", + "python3-dev", + "libssl-dev", + "tox", + "sbuild", + ], + "debian": [ + "make", + "devscripts", + "python3-dev", + "libssl-dev", + "tox", + "sbuild", + ], } @@ -363,7 +377,7 @@ def pkg_install(pkg_list, distro, test_distro=False, dry_run=False): if test_distro: pkg_list = list(pkg_list) + CI_SYSTEM_BASE_PKGS["common"] if distro not in ("freebsd",): - pkg_list += CI_SYSTEM_BASE_PKGS["linux_common"] + pkg_list += CI_SYSTEM_BASE_PKGS["linux_common"] distro_base_pkgs = CI_SYSTEM_BASE_PKGS.get(distro, []) pkg_list += distro_base_pkgs print(