|
@@ -295,28 +295,44 @@ def search_repo(manifest_json_data: dict,
|
|
gem_name: str = None,
|
|
gem_name: str = None,
|
|
template_name: str = None,
|
|
template_name: str = None,
|
|
restricted_name: str = None) -> dict or None:
|
|
restricted_name: str = None) -> dict or None:
|
|
|
|
+ o3de_object_uris = []
|
|
if isinstance(engine_name, str) or isinstance(engine_name, pathlib.PurePath):
|
|
if isinstance(engine_name, str) or isinstance(engine_name, pathlib.PurePath):
|
|
- o3de_object_uris = manifest_json_data['engines']
|
|
|
|
|
|
+ try:
|
|
|
|
+ o3de_object_uris = manifest_json_data['engines']
|
|
|
|
+ except KeyError:
|
|
|
|
+ pass
|
|
manifest_json = 'engine.json'
|
|
manifest_json = 'engine.json'
|
|
json_key = 'engine_name'
|
|
json_key = 'engine_name'
|
|
search_func = lambda manifest_json_data: manifest_json_data if manifest_json_data.get(json_key, '') == engine_name else None
|
|
search_func = lambda manifest_json_data: manifest_json_data if manifest_json_data.get(json_key, '') == engine_name else None
|
|
elif isinstance(project_name, str) or isinstance(project_name, pathlib.PurePath):
|
|
elif isinstance(project_name, str) or isinstance(project_name, pathlib.PurePath):
|
|
- o3de_object_uris = manifest_json_data['projects']
|
|
|
|
|
|
+ try:
|
|
|
|
+ o3de_object_uris = manifest_json_data['projects']
|
|
|
|
+ except KeyError:
|
|
|
|
+ pass
|
|
manifest_json = 'project.json'
|
|
manifest_json = 'project.json'
|
|
json_key = 'project_name'
|
|
json_key = 'project_name'
|
|
search_func = lambda manifest_json_data: manifest_json_data if manifest_json_data.get(json_key, '') == project_name else None
|
|
search_func = lambda manifest_json_data: manifest_json_data if manifest_json_data.get(json_key, '') == project_name else None
|
|
elif isinstance(gem_name, str) or isinstance(gem_name, pathlib.PurePath):
|
|
elif isinstance(gem_name, str) or isinstance(gem_name, pathlib.PurePath):
|
|
- o3de_object_uris = manifest_json_data['gems']
|
|
|
|
|
|
+ try:
|
|
|
|
+ o3de_object_uris = manifest_json_data['gems']
|
|
|
|
+ except KeyError:
|
|
|
|
+ pass
|
|
manifest_json = 'gem.json'
|
|
manifest_json = 'gem.json'
|
|
json_key = 'gem_name'
|
|
json_key = 'gem_name'
|
|
search_func = lambda manifest_json_data: manifest_json_data if manifest_json_data.get(json_key, '') == gem_name else None
|
|
search_func = lambda manifest_json_data: manifest_json_data if manifest_json_data.get(json_key, '') == gem_name else None
|
|
elif isinstance(template_name, str) or isinstance(template_name, pathlib.PurePath):
|
|
elif isinstance(template_name, str) or isinstance(template_name, pathlib.PurePath):
|
|
- o3de_object_uris = manifest_json_data['templates']
|
|
|
|
|
|
+ try:
|
|
|
|
+ o3de_object_uris = manifest_json_data['templates']
|
|
|
|
+ except KeyError:
|
|
|
|
+ pass
|
|
manifest_json = 'template.json'
|
|
manifest_json = 'template.json'
|
|
json_key = 'template_name'
|
|
json_key = 'template_name'
|
|
search_func = lambda manifest_json_data: manifest_json_data if manifest_json_data.get(json_key, '') == template_name else None
|
|
search_func = lambda manifest_json_data: manifest_json_data if manifest_json_data.get(json_key, '') == template_name else None
|
|
elif isinstance(restricted_name, str) or isinstance(restricted_name, pathlib.PurePath):
|
|
elif isinstance(restricted_name, str) or isinstance(restricted_name, pathlib.PurePath):
|
|
- o3de_object_uris = manifest_json_data['restricted']
|
|
|
|
|
|
+ try:
|
|
|
|
+ o3de_object_uris = manifest_json_data['restricted']
|
|
|
|
+ except KeyError:
|
|
|
|
+ pass
|
|
manifest_json = 'restricted.json'
|
|
manifest_json = 'restricted.json'
|
|
json_key = 'restricted_name'
|
|
json_key = 'restricted_name'
|
|
search_func = lambda manifest_json_data: manifest_json_data if manifest_json_data.get(json_key, '') == restricted_name else None
|
|
search_func = lambda manifest_json_data: manifest_json_data if manifest_json_data.get(json_key, '') == restricted_name else None
|
|
@@ -345,7 +361,7 @@ def search_o3de_object(manifest_json, o3de_object_uris, search_func):
|
|
for o3de_object_uri in o3de_object_uris:
|
|
for o3de_object_uri in o3de_object_uris:
|
|
manifest_uri = f'{o3de_object_uri}/{manifest_json}'
|
|
manifest_uri = f'{o3de_object_uri}/{manifest_json}'
|
|
cache_file, _ = get_cache_file_uri(manifest_uri)
|
|
cache_file, _ = get_cache_file_uri(manifest_uri)
|
|
-
|
|
|
|
|
|
+
|
|
if cache_file.is_file():
|
|
if cache_file.is_file():
|
|
with cache_file.open('r') as f:
|
|
with cache_file.open('r') as f:
|
|
try:
|
|
try:
|