@@ -1506,22 +1506,56 @@ pub(crate) async fn verify_package_platform_satisfiability(
15061506 } )
15071507 . collect :: < Result < indexmap:: IndexMap < _ , _ > , _ > > ( ) ?;
15081508
1509+ // Find the python interpreter from the list of conda packages. Note that this
1510+ // refers to the locked python interpreter, it might not match the specs
1511+ // from the environment. That is ok because we will find that out when we
1512+ // check all the records.
1513+ let python_interpreter_record = locked_pixi_records. python_interpreter_record ( ) ;
1514+
1515+ // Determine the marker environment from the python interpreter package.
1516+ let marker_environment = python_interpreter_record
1517+ . map ( |interpreter| determine_marker_environment ( platform, & interpreter. package_record ) )
1518+ . transpose ( )
1519+ . map_err ( |err| {
1520+ Box :: new ( PlatformUnsat :: FailedToDetermineMarkerEnvironment (
1521+ err. into ( ) ,
1522+ ) )
1523+ } ) ;
1524+
1525+ let pypi_dependencies = environment. pypi_dependencies ( Some ( platform) ) ;
1526+
1527+ // We cannot determine the marker environment, for example if installing
1528+ // `wasm32` dependencies. However, it also doesn't really matter if we don't
1529+ // have any pypi requirements.
1530+ let marker_environment = match marker_environment {
1531+ Err ( err) => {
1532+ if !pypi_dependencies. is_empty ( ) {
1533+ return Err ( err) ;
1534+ } else {
1535+ None
1536+ }
1537+ }
1538+ Ok ( marker_environment) => marker_environment,
1539+ } ;
1540+
15091541 // Transform from PyPiPackage name into UV Requirement type
1510- let pypi_requirements = environment
1511- . pypi_dependencies ( Some ( platform) )
1542+ let pypi_requirements = pypi_dependencies
15121543 . iter ( )
15131544 . flat_map ( |( name, reqs) | {
1514- reqs. iter ( ) . map ( move |req| {
1515- Ok :: < Dependency , Box < PlatformUnsat > > ( Dependency :: PyPi (
1516- as_uv_req ( req, name. as_source ( ) , project_root) . map_err ( |e| {
1517- Box :: new ( PlatformUnsat :: AsPep508Error (
1518- name. as_normalized ( ) . clone ( ) ,
1519- e,
1520- ) )
1521- } ) ?,
1522- "<environment>" . into ( ) ,
1523- ) )
1524- } )
1545+ reqs. iter ( )
1546+ . map ( |req| as_uv_req ( req, name. as_source ( ) , project_root) )
1547+ . filter_ok ( |req| req. evaluate_markers ( marker_environment. as_ref ( ) , & req. extras ) )
1548+ . map ( move |req| {
1549+ Ok :: < Dependency , Box < PlatformUnsat > > ( Dependency :: PyPi (
1550+ req. map_err ( |e| {
1551+ Box :: new ( PlatformUnsat :: AsPep508Error (
1552+ name. as_normalized ( ) . clone ( ) ,
1553+ e,
1554+ ) )
1555+ } ) ?,
1556+ "<environment>" . into ( ) ,
1557+ ) )
1558+ } )
15251559 } )
15261560 . collect :: < Result < Vec < _ > , _ > > ( ) ?;
15271561
@@ -1605,36 +1639,6 @@ pub(crate) async fn verify_package_platform_satisfiability(
16051639 return Err ( Box :: new ( PlatformUnsat :: TooManyCondaPackages ( Vec :: new ( ) ) ) ) ;
16061640 }
16071641
1608- // Find the python interpreter from the list of conda packages. Note that this
1609- // refers to the locked python interpreter, it might not match the specs
1610- // from the environment. That is ok because we will find that out when we
1611- // check all the records.
1612- let python_interpreter_record = locked_pixi_records. python_interpreter_record ( ) ;
1613-
1614- // Determine the marker environment from the python interpreter package.
1615- let marker_environment = python_interpreter_record
1616- . map ( |interpreter| determine_marker_environment ( platform, & interpreter. package_record ) )
1617- . transpose ( )
1618- . map_err ( |err| {
1619- Box :: new ( PlatformUnsat :: FailedToDetermineMarkerEnvironment (
1620- err. into ( ) ,
1621- ) )
1622- } ) ;
1623-
1624- // We cannot determine the marker environment, for example if installing
1625- // `wasm32` dependencies. However, it also doesn't really matter if we don't
1626- // have any pypi requirements.
1627- let marker_environment = match marker_environment {
1628- Err ( err) => {
1629- if !pypi_requirements. is_empty ( ) {
1630- return Err ( err) ;
1631- } else {
1632- None
1633- }
1634- }
1635- Ok ( marker_environment) => marker_environment,
1636- } ;
1637-
16381642 // Determine the pypi packages provided by the locked conda packages.
16391643 let locked_conda_pypi_packages = locked_pixi_records
16401644 . by_pypi_name ( )
0 commit comments