Bobby R. Bruce has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/51329 )

Change subject: python: Update the gem5 lib downloader 'is_zipped' checker
......................................................................

python: Update the gem5 lib downloader 'is_zipped' checker

Previously, gem5 resources' resources.json file set the 'is_zipped'
field to a string, either "True" or "False". As JSON supports booleans,
this was updated in an upcoming patch to use boolean values instead:
https://gem5-review.googlesource.com/c/public/gem5-resources/+/51168.

This patch updates the gem5 library downloader to use the new true/false
values but remains backwards compataible with the old string-based way
of declaring the value of this field.

Change-Id: I804ce66e8ca1989955b09041b7d1c894de74dac0
---
M src/python/gem5/resources/downloader.py
1 file changed, 28 insertions(+), 1 deletion(-)



diff --git a/src/python/gem5/resources/downloader.py b/src/python/gem5/resources/downloader.py
index 018bbd5..e8161bb 100644
--- a/src/python/gem5/resources/downloader.py
+++ b/src/python/gem5/resources/downloader.py
@@ -250,7 +250,16 @@
                 )

         download_dest = to_path
-        run_unzip = unzip and resource_json["is_zipped"].lower() == "true"
+
+        # This if-statement is remain backwards compatable with the older,
+        # string-based way of doing things. It can be refactored away over
+        # time:
+ # https://gem5-review.googlesource.com/c/public/gem5-resources/+/51168
+        if isinstance(resource_json["is_zipped"], str):
+ run_unzip = unzip and resource_json["is_zipped"].lower() == "true"
+        elif isinstance(resource_json["is_zipped"], bool):
+            run_unzip = unzip and resource_json["is_zipped"]
+
         if run_unzip:
             download_dest += ".gz"


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/51329
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I804ce66e8ca1989955b09041b7d1c894de74dac0
Gerrit-Change-Number: 51329
Gerrit-PatchSet: 1
Gerrit-Owner: Bobby R. Bruce <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to