stdlib, resources: Fixed keyerror: 'is_zipped' bug

Change-Id: I68fffd880983ebc225ec6fc8c7f8d509759b581d
This commit is contained in:
Harshil Patel
2023-08-03 10:59:11 -07:00
parent dceabe5fda
commit a25ca04851

View File

@@ -280,17 +280,21 @@ def get_resource(
# 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"]
else:
raise Exception(
"The resource.json entry for '{}' has a value for the "
"'is_zipped' field which is neither a string or a boolean.".format(
resource_name
run_unzip = False
if "is_zipped" in resource_json:
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"]
else:
raise Exception(
"The resource.json entry for '{}' has a value for the "
"'is_zipped' field which is neither a string or a boolean.".format(
resource_name
)
)
)
run_tar_extract = (
untar