mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Always include package names for Git and HTTPS dependencies (#3821)
## Summary Related to https://github.com/astral-sh/uv/issues/3818. We should _always_ include the package name if we know it's not a file path, even if it starts with an environment variable.
This commit is contained in:
parent
73f67089e1
commit
999d072ae9
5 changed files with 73 additions and 35 deletions
|
@ -284,6 +284,16 @@ impl InstalledDist {
|
|||
Self::LegacyEditable(dist) => Some(&dist.target_url),
|
||||
}
|
||||
}
|
||||
|
||||
/// Return true if the distribution refers to a local file or directory.
|
||||
pub fn is_local(&self) -> bool {
|
||||
match self {
|
||||
Self::Registry(_) => false,
|
||||
Self::Url(dist) => matches!(&*dist.direct_url, DirectUrl::LocalDirectory { .. }),
|
||||
Self::EggInfo(_) => false,
|
||||
Self::LegacyEditable(_) => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DistributionMetadata for InstalledDist {
|
||||
|
|
|
@ -427,6 +427,14 @@ impl Dist {
|
|||
}
|
||||
}
|
||||
|
||||
/// Return true if the distribution refers to a local file or directory.
|
||||
pub fn is_local(&self) -> bool {
|
||||
match self {
|
||||
Self::Source(dist) => dist.is_local(),
|
||||
Self::Built(dist) => dist.is_local(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the [`IndexUrl`], if the distribution is from a registry.
|
||||
pub fn index(&self) -> Option<&IndexUrl> {
|
||||
match self {
|
||||
|
@ -452,6 +460,11 @@ impl Dist {
|
|||
}
|
||||
|
||||
impl BuiltDist {
|
||||
/// Return true if the distribution refers to a local file or directory.
|
||||
pub fn is_local(&self) -> bool {
|
||||
matches!(self, Self::Path(_))
|
||||
}
|
||||
|
||||
/// Returns the [`IndexUrl`], if the distribution is from a registry.
|
||||
pub fn index(&self) -> Option<&IndexUrl> {
|
||||
match self {
|
||||
|
@ -510,6 +523,11 @@ impl SourceDist {
|
|||
}
|
||||
}
|
||||
|
||||
/// Return true if the distribution refers to a local file or directory.
|
||||
pub fn is_local(&self) -> bool {
|
||||
matches!(self, Self::Directory(_) | Self::Path(_))
|
||||
}
|
||||
|
||||
/// Returns the path to the source distribution, if it's a local distribution.
|
||||
pub fn as_path(&self) -> Option<&Path> {
|
||||
match self {
|
||||
|
|
|
@ -45,6 +45,14 @@ impl ResolvedDist {
|
|||
}
|
||||
}
|
||||
|
||||
/// Return true if the distribution refers to a local file or directory.
|
||||
pub fn is_local(&self) -> bool {
|
||||
match self {
|
||||
Self::Installable(dist) => dist.is_local(),
|
||||
Self::Installed(dist) => dist.is_local(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the [`IndexUrl`], if the distribution is from a registry.
|
||||
pub fn index(&self) -> Option<&IndexUrl> {
|
||||
match self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue