[openwrt/openwrt] scripts: JSON merge don't crash if no JSON found

LEDE Commits lede-commits at lists.infradead.org
Tue Jun 30 16:14:43 EDT 2020


adrian pushed a commit to openwrt/openwrt.git, branch openwrt-19.07:
https://git.openwrt.org/938839a56586c13defe3e824c2445310ca50c7dc

commit 938839a56586c13defe3e824c2445310ca50c7dc
Author: Paul Spooren <mail at aparcar.org>
AuthorDate: Wed Apr 8 10:17:01 2020 -1000

    scripts: JSON merge don't crash if no JSON found
    
    The JSON `WORK_DIR` ($(KDIR)/json_info_files) is only created if the new
    image generation methods from `image.mk` are used. However some targets
    like `armvirt` do not use it yet, so the folder is never created.
    
    The `json_overview_image_info.py` script used to raise an error if the
    given `WORK_DIR` isn't a folder, however it should just notify about
    missing JSON files.
    
    This patch removes the Python assert and exists with code 0 even if no
    JSON files were found, as this is not necessarily an error but simply
    not yet implemented. Using `glob` on an not existing `Path` results in
    an empty list, therefore the for loop won't run.
    
    Signed-off-by: Paul Spooren <mail at aparcar.org>
    CC: Petr Štetiar <ynezz at true.cz>
    (cherry picked from commit 14cbd8fb2dd8c81bad06d3c3bb45213685c19c98)
---
 scripts/json_overview_image_info.py | 2 --
 1 file changed, 2 deletions(-)

diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py
index 5ed829249b..a1418e366d 100755
--- a/scripts/json_overview_image_info.py
+++ b/scripts/json_overview_image_info.py
@@ -15,8 +15,6 @@ assert getenv("WORK_DIR"), "$WORK_DIR required"
 
 work_dir = Path(getenv("WORK_DIR"))
 
-assert work_dir.is_dir(), "$WORK_DIR not a directory"
-
 output = {}
 
 for json_file in work_dir.glob("*.json"):



More information about the lede-commits mailing list