@@ -87,21 +87,26 @@ namespace mamba
87
87
find_python_version (const solver::Solution& solution, const solver::DatabaseVariant& database)
88
88
-> std::pair<std::string, std::string>
89
89
{
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
+ }
92
102
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
+ }
103
108
104
- return { new_python. value_or ( " " ), old_python. value_or ( " " ) };
109
+ return { std::move (new_py_ver ), std::move (installed_py_ver ) };
105
110
}
106
111
107
112
auto explicit_spec (const specs::PackageInfo& pkg) -> specs::MatchSpec
0 commit comments