From 86cd706c4b12a456fd9535a870c1aa74fc23e122 Mon Sep 17 00:00:00 2001 From: Christophe Dufaza Date: Mon, 15 Jul 2024 15:48:13 +0200 Subject: [PATCH] west: blobs: prefer constants to literals for blob status Replace blob status literals with the corresponding constants defined in zephyr_module. Signed-off-by: Christophe Dufaza (cherry picked from commit ae9326c920179c131617a31e95c2b9c2a9e242f0) --- scripts/west_commands/blobs.py | 4 ++-- scripts/zephyr_module.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/west_commands/blobs.py b/scripts/west_commands/blobs.py index d23729c9d90fc5..2c841efac5f7ca 100644 --- a/scripts/west_commands/blobs.py +++ b/scripts/west_commands/blobs.py @@ -122,7 +122,7 @@ def fetch_blob(self, url, path): def fetch(self, args): blobs = self.get_blobs(args) for blob in blobs: - if blob['status'] == 'A': + if blob['status'] == zephyr_module.BLOB_PRESENT: log.dbg('Blob {module}: {abspath} is up to date'.format(**blob)) continue log.inf('Fetching blob {module}: {abspath}'.format(**blob)) @@ -131,7 +131,7 @@ def fetch(self, args): def clean(self, args): blobs = self.get_blobs(args) for blob in blobs: - if blob['status'] == 'D': + if blob['status'] == zephyr_module.BLOB_NOT_PRESENT: log.dbg('Blob {module}: {abspath} not in filesystem'.format(**blob)) continue log.inf('Deleting blob {module}: {status} {abspath}'.format(**blob)) diff --git a/scripts/zephyr_module.py b/scripts/zephyr_module.py index 20955cd1c83d29..93928f65a1b829 100755 --- a/scripts/zephyr_module.py +++ b/scripts/zephyr_module.py @@ -345,7 +345,7 @@ def kconfig_snippet(meta, path, kconfig_file=None, blobs=False, sysbuild=False): def process_kconfig(module, meta): blobs = process_blobs(module, meta) - taint_blobs = len(tuple(filter(lambda b: b['status'] != 'D', blobs))) != 0 + taint_blobs = any(b['status'] != BLOB_NOT_PRESENT for b in blobs) section = meta.get('build', dict()) module_path = PurePath(module) module_yml = module_path.joinpath('zephyr/module.yml')