From 88f7f66b04702d293a21da81d4a2a23d9e737bf3 Mon Sep 17 00:00:00 2001 From: nggieber Date: Fri, 22 Oct 2021 17:19:54 -0700 Subject: [PATCH] Removed fullPathGiven and instead check if path is a file when getting gem json data Signed-off-by: nggieber --- Code/Tools/ProjectManager/Source/PythonBindings.cpp | 12 +++++------- Code/Tools/ProjectManager/Source/PythonBindings.h | 2 +- scripts/o3de/o3de/manifest.py | 8 ++++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.cpp b/Code/Tools/ProjectManager/Source/PythonBindings.cpp index 5ec2980660..003e3dbd3c 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.cpp +++ b/Code/Tools/ProjectManager/Source/PythonBindings.cpp @@ -688,13 +688,13 @@ namespace O3DE::ProjectManager } } - GemInfo PythonBindings::GemInfoFromPath(pybind11::handle path, pybind11::handle pyProjectPath, bool fullPathGiven) + GemInfo PythonBindings::GemInfoFromPath(pybind11::handle path, pybind11::handle pyProjectPath) { GemInfo gemInfo; gemInfo.m_path = Py_To_String(path); gemInfo.m_directoryLink = gemInfo.m_path; - auto data = m_manifest.attr("get_gem_json_data")(pybind11::none(), path, pyProjectPath, fullPathGiven); + auto data = m_manifest.attr("get_gem_json_data")(pybind11::none(), path, pyProjectPath); if (pybind11::isinstance(data)) { try @@ -728,10 +728,6 @@ namespace O3DE::ProjectManager { gemInfo.m_downloadStatus = GemInfo::DownloadStatus::Downloaded; } - if (fullPathGiven) - { - gemInfo.m_downloadStatus = GemInfo::DownloadStatus::NotDownloaded; - } if (data.contains("user_tags")) { @@ -1178,7 +1174,9 @@ namespace O3DE::ProjectManager { for (auto path : gemPaths) { - gemInfos.push_back(GemInfoFromPath(path, pybind11::none(), true)); + GemInfo gemInfo = GemInfoFromPath(path, pybind11::none()); + gemInfo.m_downloadStatus = GemInfo::DownloadStatus::NotDownloaded; + gemInfos.push_back(gemInfo); } } }); diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.h b/Code/Tools/ProjectManager/Source/PythonBindings.h index 7eeb4f560e..fdc692d3f4 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.h +++ b/Code/Tools/ProjectManager/Source/PythonBindings.h @@ -71,7 +71,7 @@ namespace O3DE::ProjectManager AZ::Outcome ExecuteWithLockErrorHandling(AZStd::function executionCallback); bool ExecuteWithLock(AZStd::function executionCallback); - GemInfo GemInfoFromPath(pybind11::handle path, pybind11::handle pyProjectPath, bool fullPathGiven = false); + GemInfo GemInfoFromPath(pybind11::handle path, pybind11::handle pyProjectPath); GemRepoInfo GetGemRepoInfo(pybind11::handle repoUri); ProjectInfo ProjectInfoFromPath(pybind11::handle path); ProjectTemplateInfo ProjectTemplateInfoFromPath(pybind11::handle path, pybind11::handle pyProjectPath); diff --git a/scripts/o3de/o3de/manifest.py b/scripts/o3de/o3de/manifest.py index 0caa0a0062..6e449c19a3 100644 --- a/scripts/o3de/o3de/manifest.py +++ b/scripts/o3de/o3de/manifest.py @@ -494,7 +494,7 @@ def get_project_json_data(project_name: str = None, def get_gem_json_data(gem_name: str = None, gem_path: str or pathlib.Path = None, - project_path: pathlib.Path = None, full_path_given: bool = False) -> dict or None: + project_path: pathlib.Path = None) -> dict or None: if not gem_name and not gem_path: logger.error('Must specify either a Gem name or Gem Path.') return None @@ -502,10 +502,10 @@ def get_gem_json_data(gem_name: str = None, gem_path: str or pathlib.Path = None if gem_name and not gem_path: gem_path = get_registered(gem_name=gem_name, project_path=project_path) - if not full_path_given: - return get_json_data('gem', gem_path, validation.valid_o3de_gem_json) - else: + if isinstance(gem_path, pathlib.Path) and gem_path.is_file(): return get_json_data_file(gem_path, 'gem', validation.valid_o3de_gem_json) + else: + return get_json_data('gem', gem_path, validation.valid_o3de_gem_json) def get_template_json_data(template_name: str = None, template_path: str or pathlib.Path = None,