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

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
---
M src/python/gem5/resources/downloader.py
1 file changed, 26 insertions(+), 7 deletions(-)



diff --git a/src/python/gem5/resources/downloader.py b/src/python/gem5/resources/downloader.py
index 13213bb..018bbd5 100644
--- a/src/python/gem5/resources/downloader.py
+++ b/src/python/gem5/resources/downloader.py
@@ -87,12 +87,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"]
                     )
                 )
@@ -107,7 +110,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)
                     )
                 )
@@ -178,16 +181,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: 1
Gerrit-Owner: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
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

Reply via email to