Bobby R. Bruce has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/51328 )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
)Change subject: python: Rename 'artifact' to 'resources' in downloader
......................................................................
python: Rename 'artifact' to 'resources' in downloader
As part of an upcoming change in the gem5 resources resources.json file,
https://gem5-review.googlesource.com/c/public/gem5-resources/+/51169,
the terminology 'artifact' will be replaced with 'resources'. This is
in-keeping with the terminology we use elsewhere in the project. This
patch is designed to work with both 'artifact' and 'resource' type name
while the resources.json schema is changed.
Change-Id: Ia1facc86000b9abf1e426b9b0eb0c7e0245bdcfa
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51328
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
---
M src/python/gem5/resources/downloader.py
1 file changed, 30 insertions(+), 7 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/python/gem5/resources/downloader.py
b/src/python/gem5/resources/downloader.py
index faeddb0..a097f24 100644
--- a/src/python/gem5/resources/downloader.py
+++ b/src/python/gem5/resources/downloader.py
@@ -88,12 +88,15 @@
to_return = {}
for resource in resources_group:
- if resource["type"] == "artifact":
- # If the type is "artifact" then we add it directly to the map
+ # 'artifact' is the old naming, we keep it here for
+ # backwards compatibility, but it can be removed with time:
+ #
https://gem5-review.googlesource.com/c/public/gem5-resources/+/51169.
+ if resource["type"] == "artifact" or resource["type"]
== "resource":
+ # If the type is "resource" then we add it directly to the map
# after a check that the name is unique.
if resource["name"] in to_return.keys():
raise Exception(
- "Error: Duplicate artifact with name '{}'.".format(
+ "Error: Duplicate resource with name '{}'.".format(
resource["name"]
)
)
@@ -108,7 +111,7 @@
# the resources.json file. The resources names need to be
# unique keyes.
raise Exception(
- "Error: Duplicate artifacts with names: {}.".format(
+ "Error: Duplicate resources with names: {}.".format(
str(intersection)
)
)
@@ -179,16 +182,16 @@
:raises Exception: An exception is raised if the specified resources
does
not exist.
"""
- artifact_map = _get_resources(_get_resources_json()["resources"])
+ resource_map = _get_resources(_get_resources_json()["resources"])
- if resource_name not in artifact_map:
+ if resource_name not in resource_map:
raise Exception(
"Error: Resource with name '{}' does not exist".format(
resource_name
)
)
- return artifact_map[resource_name]
+ return resource_map[resource_name]
def get_resource(
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/51328
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: Ia1facc86000b9abf1e426b9b0eb0c7e0245bdcfa
Gerrit-Change-Number: 51328
Gerrit-PatchSet: 3
Gerrit-Owner: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s