Support editable in pip-sync and pip-compile (#587)

Support `-e path/do/dir` in pip-sync and and pip-compile.
This commit is contained in:
konsti 2023-12-16 23:37:34 +01:00 committed by GitHub
parent f62458f600
commit f059c6e6a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 1016 additions and 250 deletions

View file

@ -1,5 +1,6 @@
use std::borrow::Cow;
use std::ops::Deref;
use std::path::Path;
use once_cell::sync::Lazy;
use regex::Regex;
@ -27,6 +28,15 @@ impl VerbatimUrl {
})
}
/// Parse a URL from a path.
#[allow(clippy::result_unit_err)]
pub fn from_path(path: impl AsRef<Path>, given: String) -> Result<Self, ()> {
Ok(Self {
url: Url::from_directory_path(path)?,
given: Some(given),
})
}
/// Return the underlying [`Url`].
pub fn raw(&self) -> &Url {
&self.url