Skip to content

platform_system not correctly respected #1793

@amin-nejad

Description

@amin-nejad

pip-compile does not respect platform_system correctly when it is specified multiple times for the same package. This is useful in cases where you need to have different versions of the same package on different OSs.

Environment Versions

  1. Mac M1
  2. Python version: 3.9.12
  3. pip version: 22.3.1
  4. pip-tools version: 6.12.1

Steps to replicate

Run pip-compile on the following requirements.in file:

grpcio-tools~=1.48.0 ; platform_system=="Darwin" 
grpcio-tools>=1.48.0 ; platform_system!="Darwin" 

Expected result

grpcio-tools should occur twice in the requirements.txt in a similar way to how it was specified

Actual result

Instead you get something like this where the dependency we specified only occurs once with the first platform_system.

grpcio==1.51.1
    # via grpcio-tools
grpcio-tools==1.48.2 ; platform_system == "Darwin"
    # via -r requirements/test.in
protobuf==3.20.3
    # via grpcio-tools

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions