2586f655bb
First, replace all usages in files in-place. I used my editor for this. If someone wants to add a one-liner that'd be fun. Then, update directory and file names: ``` # Run twice for nested directories find . -type d -print0 | xargs -0 rename s/puffin/uv/g find . -type d -print0 | xargs -0 rename s/puffin/uv/g # Update files find . -type f -print0 | xargs -0 rename s/puffin/uv/g ``` Then add all the files again ``` # Add all the files again git add crates git add python/uv # This one needs a force-add git add -f crates/uv-trampoline ```
66 lines
1.8 KiB
Rust
66 lines
1.8 KiB
Rust
use distribution_types::{
|
|
CachedDist, InstalledDist, InstalledMetadata, InstalledVersion, LocalEditable, Name,
|
|
};
|
|
use pypi_types::Metadata21;
|
|
use uv_normalize::PackageName;
|
|
|
|
/// An editable distribution that has been built.
|
|
#[derive(Debug, Clone)]
|
|
pub struct BuiltEditable {
|
|
pub editable: LocalEditable,
|
|
pub wheel: CachedDist,
|
|
pub metadata: Metadata21,
|
|
}
|
|
|
|
/// An editable distribution that has been resolved to a concrete distribution.
|
|
#[derive(Debug, Clone)]
|
|
#[allow(clippy::large_enum_variant)]
|
|
pub enum ResolvedEditable {
|
|
/// The editable is already installed in the environment.
|
|
Installed(InstalledDist),
|
|
/// The editable has been built and is ready to be installed.
|
|
Built(BuiltEditable),
|
|
}
|
|
|
|
impl Name for BuiltEditable {
|
|
fn name(&self) -> &PackageName {
|
|
&self.metadata.name
|
|
}
|
|
}
|
|
|
|
impl Name for ResolvedEditable {
|
|
fn name(&self) -> &PackageName {
|
|
match self {
|
|
Self::Installed(dist) => dist.name(),
|
|
Self::Built(dist) => dist.name(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl InstalledMetadata for BuiltEditable {
|
|
fn installed_version(&self) -> InstalledVersion {
|
|
self.wheel.installed_version()
|
|
}
|
|
}
|
|
|
|
impl InstalledMetadata for ResolvedEditable {
|
|
fn installed_version(&self) -> InstalledVersion {
|
|
match self {
|
|
Self::Installed(dist) => dist.installed_version(),
|
|
Self::Built(dist) => dist.installed_version(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::fmt::Display for BuiltEditable {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "{}{}", self.name(), self.installed_version())
|
|
}
|
|
}
|
|
|
|
impl std::fmt::Display for ResolvedEditable {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "{}{}", self.name(), self.installed_version())
|
|
}
|
|
}
|