Merge pull request #4911 from aws-lumberyard-dev/Prism/RefreshGemRepos
Gem Repos can be Refreshed through Project Manager
This commit is contained in:
@@ -303,6 +303,7 @@ namespace O3DE::ProjectManager
|
||||
m_disableGemProject = pybind11::module::import("o3de.disable_gem");
|
||||
m_editProjectProperties = pybind11::module::import("o3de.project_properties");
|
||||
m_download = pybind11::module::import("o3de.download");
|
||||
m_repo = pybind11::module::import("o3de.repo");
|
||||
m_pathlib = pybind11::module::import("pathlib");
|
||||
|
||||
// make sure the engine is registered
|
||||
@@ -982,6 +983,46 @@ namespace O3DE::ProjectManager
|
||||
}
|
||||
}
|
||||
|
||||
AZ::Outcome<void, AZStd::string> PythonBindings::RefreshGemRepo(const QString& repoUri)
|
||||
{
|
||||
bool refreshResult = false;
|
||||
AZ::Outcome<void, AZStd::string> result = ExecuteWithLockErrorHandling(
|
||||
[&]
|
||||
{
|
||||
auto pyUri = QString_To_Py_String(repoUri);
|
||||
auto pythonRefreshResult = m_repo.attr("refresh_repo")(pyUri);
|
||||
|
||||
// Returns an exit code so boolify it then invert result
|
||||
refreshResult = !pythonRefreshResult.cast<bool>();
|
||||
});
|
||||
|
||||
if (!result.IsSuccess())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
else if (!refreshResult)
|
||||
{
|
||||
return AZ::Failure<AZStd::string>("Failed to refresh repo.");
|
||||
}
|
||||
|
||||
return AZ::Success();
|
||||
}
|
||||
|
||||
bool PythonBindings::RefreshAllGemRepos()
|
||||
{
|
||||
bool refreshResult = false;
|
||||
bool result = ExecuteWithLock(
|
||||
[&]
|
||||
{
|
||||
auto pythonRefreshResult = m_repo.attr("refresh_repos")();
|
||||
|
||||
// Returns an exit code so boolify it then invert result
|
||||
refreshResult = !pythonRefreshResult.cast<bool>();
|
||||
});
|
||||
|
||||
return result && refreshResult;
|
||||
}
|
||||
|
||||
bool PythonBindings::AddGemRepo(const QString& repoUri)
|
||||
{
|
||||
bool registrationResult = false;
|
||||
|
||||
Reference in New Issue
Block a user