Skip to content

Commit 107188f

Browse files
committed
Post rebase adaptations
Signed-off-by: Julien Jerphanion <[email protected]>
1 parent d9c2e01 commit 107188f

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

libmamba/src/core/transaction.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,26 @@ namespace mamba
8787
find_python_version(const solver::Solution& solution, const solver::DatabaseVariant& database)
8888
-> std::pair<std::string, std::string>
8989
{
90-
auto old_python = installed_python(database);
91-
auto new_python = std::optional<std::string>();
90+
// We need to find the python version that will be there after this
91+
// Transaction is finished in order to compile the noarch packages correctly,
92+
93+
// We need to look into installed packages in case we are not installing a new python
94+
// version but keeping the current one.
95+
// Could also be written in term of PrefixData.
96+
std::string installed_py_ver = {};
97+
if (auto python_version = installed_python(database))
98+
{
99+
installed_py_ver = python_version.value();
100+
LOG_INFO << "Found python in installed packages " << installed_py_ver;
101+
}
92102

93-
for_each_to_install(
94-
solution.actions,
95-
[&](const auto& pkg)
96-
{
97-
if (pkg.name == "python")
98-
{
99-
new_python = pkg.version;
100-
}
101-
}
102-
);
103+
std::string new_py_ver = installed_py_ver;
104+
if (auto py = solver::find_new_python_in_solution(solution))
105+
{
106+
new_py_ver = py->get().version;
107+
}
103108

104-
return { new_python.value_or(""), old_python.value_or("") };
109+
return { std::move(new_py_ver), std::move(installed_py_ver) };
105110
}
106111

107112
auto explicit_spec(const specs::PackageInfo& pkg) -> specs::MatchSpec

0 commit comments

Comments
 (0)