diff --git a/.ruff.toml b/.ruff.toml index 93de212f..7b8950db 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -1,5 +1,10 @@ line-length = 120 +extend-exclude = [ + "*.json", +] +force-exclude = true + [lint] # enabled the `isort` and `pylint` additional linters, see `ruff linter` output # or: https://docs.astral.sh/ruff/rules/ @@ -25,10 +30,5 @@ ignore = [ "PLW2901", # pylint: redefined loop variable ] -extend-exclude = [ - "*.json", -] -force-exclude = true - [format] quote-style = "preserve" diff --git a/osbuild/meta.py b/osbuild/meta.py index ea4ee1b6..bef0bc65 100644 --- a/osbuild/meta.py +++ b/osbuild/meta.py @@ -423,8 +423,7 @@ class ModuleInfo: @classmethod def _load_from_json(cls, path, klass, name) -> Optional["ModuleInfo"]: - # ideas welcome for a better filename/suffix :) - meta_json_suffix = "-meta.json" + meta_json_suffix = ".meta.json" with open(path + meta_json_suffix, encoding="utf-8") as fp: meta = json.load(fp) @@ -618,7 +617,7 @@ class Index: raise ValueError(f"Unsupported nodule class: {klass}") path = os.path.join(self.path, module_path) - modules = filter(lambda f: os.path.isfile(f"{path}/{f}") and not path.endswith("-meta.json"), + modules = filter(lambda f: os.path.isfile(f"{path}/{f}") and not path.endswith(".meta.json"), os.listdir(path)) return list(modules) diff --git a/stages/org.osbuild.noop b/stages/org.osbuild.noop index 460bea24..85f04570 100755 --- a/stages/org.osbuild.noop +++ b/stages/org.osbuild.noop @@ -2,7 +2,7 @@ """ Do Nothing -See "org.osbuild.noop-meta.json" for more details. +See "org.osbuild.noop.meta.json" for more details. """ diff --git a/stages/org.osbuild.noop-meta.json b/stages/org.osbuild.noop.meta.json similarity index 100% rename from stages/org.osbuild.noop-meta.json rename to stages/org.osbuild.noop.meta.json diff --git a/test/mod/test_meta.py b/test/mod/test_meta.py index 73254af7..1741e9d7 100644 --- a/test/mod/test_meta.py +++ b/test/mod/test_meta.py @@ -173,7 +173,7 @@ def test_schema(): def make_fake_meta_json(tmp_path, name): - meta_json_path = pathlib.Path(f"{tmp_path}/stages/{name}-meta.json") + meta_json_path = pathlib.Path(f"{tmp_path}/stages/{name}.meta.json") meta_json_path.parent.mkdir(exist_ok=True) meta_json_path.write_text(""" {