diff options
-rw-r--r-- | mdbp/build_schema.json | 2 | ||||
-rw-r--r-- | mdbp/common.py | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/mdbp/build_schema.json b/mdbp/build_schema.json index b8d905d..baa38ef 100644 --- a/mdbp/build_schema.json +++ b/mdbp/build_schema.json @@ -121,7 +121,7 @@ "properties": { "directory": { "type": "string", - "description": "target directory to place output artifacts" + "description": "target directory to place output artifacts, can be specified relative to the location of this json file" } } } diff --git a/mdbp/common.py b/mdbp/common.py index d0d2f2d..77cbd33 100644 --- a/mdbp/common.py +++ b/mdbp/common.py @@ -37,6 +37,19 @@ def buildjson(filename: str) -> JsonObject: buildobj, json_load( importlib.resources.open_text("mdbp", "build_schema.json"))) + for attrs in (("input", "dscpath"), ("output", "directory")): + obj = buildobj + for attr in attrs[:-1]: + try: + obj = obj[attr] + except KeyError: + break + else: + try: + obj[attrs[-1]] = str(pathlib.Path(filename).parent / + pathlib.Path(obj[attrs[-1]])) + except KeyError: + pass assert isinstance(buildobj, dict) return buildobj |