Let RequirementSource::Path.editable be bool, not Option<bool> (#3693)

Small refactoring of the internal representation. This does not change
`tool.uv.sources`.
This commit is contained in:
konsti
2024-05-21 16:34:43 +02:00
committed by GitHub
parent f396c6c33e
commit 95af1db0bb
6 changed files with 12 additions and 13 deletions
+2 -2
View File
@@ -174,7 +174,7 @@ pub enum RequirementSource {
Path {
path: PathBuf,
/// For a source tree (a directory), whether to install as an editable.
editable: Option<bool>,
editable: bool,
/// The PEP 508 style URL in the format
/// `file:///<path>#subdirectory=<subdirectory>`.
url: VerbatimUrl,
@@ -189,7 +189,7 @@ impl RequirementSource {
ParsedUrl::Path(local_file) => RequirementSource::Path {
path: local_file.path,
url,
editable: None,
editable: false,
},
ParsedUrl::Git(git) => RequirementSource::Git {
url,
+3 -3
View File
@@ -94,7 +94,7 @@ impl From<&ResolvedDist> for Requirement {
Dist::Built(BuiltDist::Path(wheel)) => RequirementSource::Path {
path: wheel.path.clone(),
url: wheel.url.clone(),
editable: None,
editable: false,
},
Dist::Source(SourceDist::Registry(sdist)) => RequirementSource::Registry {
specifier: pep440_rs::VersionSpecifiers::from(
@@ -121,12 +121,12 @@ impl From<&ResolvedDist> for Requirement {
Dist::Source(SourceDist::Path(sdist)) => RequirementSource::Path {
path: sdist.path.clone(),
url: sdist.url.clone(),
editable: None,
editable: false,
},
Dist::Source(SourceDist::Directory(sdist)) => RequirementSource::Path {
path: sdist.path.clone(),
url: sdist.url.clone(),
editable: Some(sdist.editable),
editable: sdist.editable,
},
},
ResolvedDist::Installed(dist) => RequirementSource::Registry {