json: factor handling of deprecated 'base'

This commit is contained in:
Sebastien Bourdeauducq 2023-06-16 16:32:42 +08:00
parent 20d4712815
commit a792bc5456
3 changed files with 3 additions and 6 deletions

View File

@ -32,4 +32,7 @@ def load(description_path):
global validator
validator.validate(result)
if result["base"] != "use_drtio_role":
result["drtio_role"] = result["base"]
return result

View File

@ -687,14 +687,10 @@ def main():
args = parser.parse_args()
primary_description = jsondesc.load(args.primary_description)
if primary_description["base"] != "use_drtio_role":
primary_description["drtio_role"] = primary_description["base"]
satellites = []
for destination, description_path in args.satellite:
satellite_description = jsondesc.load(description_path)
if satellite_description["base"] != "use_drtio_role":
satellite_description["drtio_role"] = satellite_description["base"]
satellites.append((int(destination, 0), satellite_description))
if args.output is not None:

View File

@ -150,8 +150,6 @@ def main():
help="Override ROM identifier")
args = parser.parse_args()
description = jsondesc.load(args.description)
if description["base"] != "use_drtio_role":
description["drtio_role"] = description["base"]
min_artiq_version = description.get("min_artiq_version", "0")
if Version(artiq_version) < Version(min_artiq_version):