Accept relative file paths in CLI requirements (#1182)

## Summary

See: https://github.com/astral-sh/puffin/issues/1181.

## Test Plan

```
❯ cargo run -- pip install packse@../../zanieb/packse
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s
     Running `target/debug/puffin pip install 'packse@../../zanieb/packse'`
error: Distribution not found at: file:///Users/crmarsh/zanieb/packse
```
This commit is contained in:
Charlie Marsh 2024-01-29 19:31:24 -08:00 committed by GitHub
parent 61a3060383
commit bd934207e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 18 deletions

View file

@ -402,8 +402,8 @@ impl FromStr for Requirement {
impl Requirement {
/// Parse a [Dependency Specifier](https://packaging.python.org/en/latest/specifications/dependency-specifiers/)
pub fn parse(input: &str, working_dir: Option<&Path>) -> Result<Self, Pep508Error> {
parse(&mut Cursor::new(input), working_dir)
pub fn parse(input: &str, working_dir: impl AsRef<Path>) -> Result<Self, Pep508Error> {
parse(&mut Cursor::new(input), Some(working_dir.as_ref()))
}
}