1515
1616#include < reproc++/run.hpp>
1717
18- #include " mamba/core/context.hpp"
1918#include " mamba/core/output.hpp"
2019#include " mamba/core/util.hpp"
21- #include " mamba/core/util_os.hpp"
2220#include " mamba/core/virtual_packages.hpp"
2321#include " mamba/util/build.hpp"
2422#include " mamba/util/environment.hpp"
@@ -373,49 +371,39 @@ namespace mamba
373371
374372 if (os == " win" )
375373 {
376- overridable_windows_version ()
377- .transform (
378- [&](std::string&& version)
379- {
380- res.push_back (make_virtual_package (" __win" , platform, std::move (version)));
381- }
382- )
383- .or_else (
384- [&](util::OSError err)
385- {
386- res.push_back (make_virtual_package (" __win" , platform, " 0" ));
387- LOG_WARNING
388- << " Windows version not found, defaulting virtual package version to 0."
374+ auto result = overridable_windows_version ();
375+ if (result)
376+ {
377+ res.push_back (make_virtual_package (" __win" , platform, std::move (result).value ()));
378+ }
379+ else
380+ {
381+ res.push_back (make_virtual_package (" __win" , platform, " 0" ));
382+ LOG_WARNING << " Windows version not found, defaulting virtual package version to 0."
389383 " Try setting CONDA_OVERRIDE_WIN environment variable to the"
390384 " desired version." ;
391- LOG_DEBUG << err.message ;
392- }
393- );
385+ LOG_DEBUG << std::move (result).error ().message ;
386+ }
394387 }
388+
395389 if (os == " linux" )
396390 {
397391 res.push_back (make_virtual_package (" __unix" , platform));
398392
399- overridable_linux_version ()
400- .transform (
401- [&](std::string&& version)
402- {
403- res.push_back (
404- make_virtual_package (" __linux" , platform, std::move (version))
405- );
406- }
407- )
408- .or_else (
409- [&](util::OSError err)
410- {
411- res.push_back (make_virtual_package (" __linux" , platform, " 0" ));
412- LOG_WARNING
413- << " Linux version not found, defaulting virtual package version to 0."
393+ auto result = overridable_linux_version ();
394+ if (result)
395+ {
396+ res.push_back (make_virtual_package (" __linux" , platform, std::move (result).value ())
397+ );
398+ }
399+ else
400+ {
401+ res.push_back (make_virtual_package (" __linux" , platform, " 0" ));
402+ LOG_WARNING << " Linux version not found, defaulting virtual package version to 0."
414403 " Try setting CONDA_OVERRIDE_LINUX environment variable to the"
415404 " desired version." ;
416- LOG_DEBUG << err.message ;
417- }
418- );
405+ LOG_DEBUG << std::move (result).error ().message ;
406+ }
419407
420408 std::string libc_ver = detail::glibc_version ();
421409 if (!libc_ver.empty ())
@@ -427,28 +415,24 @@ namespace mamba
427415 LOG_WARNING << " glibc version not found (virtual package skipped)" ;
428416 }
429417 }
418+
430419 if (os == " osx" )
431420 {
432421 res.push_back (make_virtual_package (" __unix" , platform));
433422
434- overridable_osx_version ()
435- .transform (
436- [&](std::string&& version)
437- {
438- res.push_back (make_virtual_package (" __osx" , platform, std::move (version)));
439- }
440- )
441- .or_else (
442- [&](util::OSError err)
443- {
444- res.push_back (make_virtual_package (" __osx" , platform, " 0" ));
445- LOG_WARNING
446- << " OSX version not found, defaulting virtual package version to 0."
423+ auto result = overridable_osx_version ();
424+ if (result)
425+ {
426+ res.push_back (make_virtual_package (" __osx" , platform, std::move (result).value ()));
427+ }
428+ else
429+ {
430+ res.push_back (make_virtual_package (" __osx" , platform, " 0" ));
431+ LOG_WARNING << " OSX version not found, defaulting virtual package version to 0."
447432 " Try setting CONDA_OVERRIDE_OSX environment variable to the"
448433 " desired version." ;
449- LOG_DEBUG << err.message ;
450- }
451- );
434+ LOG_DEBUG << std::move (result).error ().message ;
435+ }
452436 }
453437
454438 res.push_back (make_virtual_package (" __archspec" , platform, " 1" , get_archspec (arch)));
0 commit comments