Support relative path wheels (#5969)

Surprisingly, this is a lockfile schema change: We can't store relative
paths in urls, so we have to store a `filename` entry instead of the
whole url.

Fixes #4355
This commit is contained in:
konsti 2024-08-09 23:57:16 +02:00 committed by GitHub
parent dd32087842
commit fcbee9ce25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 221 additions and 50 deletions

View file

@ -216,8 +216,12 @@ pub struct DirectUrlBuiltDist {
#[derive(Debug, Clone, Hash)]
pub struct PathBuiltDist {
pub filename: WheelFilename,
/// The path to the wheel.
pub path: PathBuf,
/// The resolved, absolute path to the wheel which we use for installing.
pub install_path: PathBuf,
/// The absolute path or path relative to the workspace root pointing to the wheel
/// which we use for locking. Unlike `given` on the verbatim URL all environment variables
/// are resolved, and unlike the install path, we did not yet join it on the base directory.
pub lock_path: PathBuf,
/// The URL as it was provided by the user.
pub url: VerbatimUrl,
}
@ -372,7 +376,8 @@ impl Dist {
}
Ok(Self::Built(BuiltDist::Path(PathBuiltDist {
filename,
path: canonicalized_path,
install_path: canonicalized_path.clone(),
lock_path: lock_path.to_path_buf(),
url,
})))
}

View file

@ -160,8 +160,8 @@ impl From<&ResolvedDist> for Requirement {
}
}
Dist::Built(BuiltDist::Path(wheel)) => RequirementSource::Path {
install_path: wheel.path.clone(),
lock_path: wheel.path.clone(),
install_path: wheel.install_path.clone(),
lock_path: wheel.lock_path.clone(),
url: wheel.url.clone(),
ext: DistExtension::Wheel,
},