From 461199b903238b0c75eede2aca417f034cb1f67c Mon Sep 17 00:00:00 2001 From: Astro Date: Wed, 10 Feb 2021 00:52:23 +0100 Subject: [PATCH] kasli_generic: warn if min_artiq_version is not met --- RELEASE_NOTES.rst | 3 ++- artiq/gateware/targets/kasli_generic.py | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 154b69f54..f57f6a9cf 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -49,7 +49,8 @@ Highlights: with reproducible builds. * Python 3.7 support in Conda packages. * `kasli_generic` JSON descriptions are now validated against a - schema. Description defaults have moved from Python to the schema. + schema. Description defaults have moved from Python to the + schema. Warns if ARTIQ version is too old. Breaking changes: diff --git a/artiq/gateware/targets/kasli_generic.py b/artiq/gateware/targets/kasli_generic.py index 38acc2ef0..d5004605a 100755 --- a/artiq/gateware/targets/kasli_generic.py +++ b/artiq/gateware/targets/kasli_generic.py @@ -1,16 +1,20 @@ #!/usr/bin/env python3 import argparse +import logging +from distutils.version import LooseVersion from misoc.integration.builder import builder_args, builder_argdict from misoc.targets.kasli import soc_kasli_args, soc_kasli_argdict +from artiq import __version__ as artiq_version from artiq.coredevice import jsondesc from artiq.gateware import rtio, eem_7series from artiq.gateware.rtio.phy import ttl_simple from artiq.gateware.targets.kasli import StandaloneBase, MasterBase, SatelliteBase from artiq.build_soc import * +logger = logging.getLogger(__name__) class GenericStandalone(StandaloneBase): def __init__(self, description, hw_rev=None,**kwargs): @@ -139,6 +143,11 @@ def main(): args = parser.parse_args() description = jsondesc.load(args.description) + min_artiq_version = description.get("min_artiq_version", "0") + if LooseVersion(artiq_version) < LooseVersion(min_artiq_version): + logger.warning("ARTIQ version mismatch: current %s < %s minimum", + artiq_version, min_artiq_version) + if description["target"] != "kasli": raise ValueError("Description is for a different target")