Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup relative and absolute path handling #1329

Closed
wants to merge 34 commits into from

Commits on Jun 16, 2022

  1. Add optional param from_dir to format_requirement

    If passed, it will attempt to relative-ize the resulting URL (if possible).
    
    Add helper: fragment_string
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    399f1ea View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c9c00fb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    afea149 View commit details
    Browse the repository at this point in the history
  4. Add abs_ireq for normalizing ireqs, and related tests

    - abs_ireq_preserves_source_ireqs
    - format_requirement_impossible_relative_path_becomes_absolute (Windows-only)
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    8168ad2 View commit details
    Browse the repository at this point in the history
  5. Update test to expect and accept more Windows file URIs

    Specifically ones which start like file:///C:/
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    df6f78b View commit details
    Browse the repository at this point in the history
  6. Add writer test for annotation accuracy regarding source ireqs

    Ensure source ireqs' comes_from attr is credited in annotations
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    09003f6 View commit details
    Browse the repository at this point in the history
  7. Add optional param from_dir to _comes_from_as_string

    This brings with it more involved string manipulation
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    6398866 View commit details
    Browse the repository at this point in the history
  8. Add optional from_dir param to parse_requirements

    If passed, from_dir will be used instead of CWD to interpret relative paths.
    
    Special care is taken to guarantee _was_relative in the yielded ireqs,
    if originally relative.
    
    When calling format_requirement,
    _was_relative's presence now determines what's passed as from_dir:
    either CWD or None (None leads to an absolute path output)
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    d68ea31 View commit details
    Browse the repository at this point in the history
  9. Add flag for compile: --write-relative-to-output

    With test, and needed changes:
    
    - Use this flag to decide what to pass as from_dir to parse_requirements
    - Add init param to OutputWriter: write_relative_to_output
    - Add corresponding from_dir logic and use to OutputWriter._format_requirement
    - Add test_write_relative_to_output which runs with the new flag both on and off
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    8f7f633 View commit details
    Browse the repository at this point in the history
  10. Add test_local_editable_vcs_package

    This ensures absolute intact paths for git+file: reqs
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    97fe407 View commit details
    Browse the repository at this point in the history
  11. Add flag to sync: --read-relative-to-input

    With test_sync_relative_path
    
    If the reqs in the output were written relative to that output file
    (pip-compile --write-relative-to-output), then it's wise for pip-sync
    to interpret reqs it finds in there from the location of the output file.
    
    This is now possible with pip-sync --read-relative-to-input.
    
    To be clear: pip-sync's "input" is pip-compile's "output."
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    76186c4 View commit details
    Browse the repository at this point in the history
  12. Absolute-ize src_file paths and more safely determine output file paths

    This fixes at least two problems, for which tests are added.
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    dedfa56 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    e74f317 View commit details
    Browse the repository at this point in the history
  14. Add flag for compile: --read-relative-to-input

    And add tests via parameterization
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    e182c21 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    e496d34 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    b631521 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    fd7e470 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    1141ae7 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    0d4f957 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    6710a45 View commit details
    Browse the repository at this point in the history
  21. Replicate pip's install_req_from_link_and_ireq in utils

    For compatibility with pip<21.1
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    03a51cc View commit details
    Browse the repository at this point in the history
  22. Avoid choking on a relative path without scheme prefix, with fragment

    e.g. ../../rawr#egg=rawr-cli
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    9501a9d View commit details
    Browse the repository at this point in the history
  23. Improve our version of install_req_from_link_and_ireq (diverge)

    ... to properly set .extras
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    af758d5 View commit details
    Browse the repository at this point in the history
  24. Improve consistency of output regarding fragments and extras

    This fixes false-positive _was_relative assignments
    for some direct references like:
    
    ptrender[yaml] @ file:///home/andy/Code/ptrender
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    c239939 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    6306971 View commit details
    Browse the repository at this point in the history
  26. Remove fragment_string parameter omit_extras

    As we always want to set that True
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    6a5d208 View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    cbf604d View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    b10ae67 View commit details
    Browse the repository at this point in the history
  29. Further diverge from pip's install_req_from_link_and_ireq

    Preserve ireq.constraint and _source_ireqs
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    bfe7d07 View commit details
    Browse the repository at this point in the history
  30. More thorough install_req_from_link_and_ireq

    At this code point we currently expect the original ireq.extras to
    be an empty set every time, so this does not change any current behavior.
    
    But if in the future ireqs with already parsed extras are passed,
    it should now preserve those.
    AndydeCleyre committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    50484ec View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    e124089 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    4893794 View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    0a4ef9a View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    90a7097 View commit details
    Browse the repository at this point in the history