Move source distribution unpacking out of build (#2294)

## Summary

If a user provides a source distribution via a direct path, it can
either be an archive (like a `.tar.gz` or `.zip` file) or a directory.
If the former, we need to extract (e.g., unzip) the contents at some
point. Previously, this extraction was in `uv-build`; this PR lifts it
up to the distribution database.

The first benefit here is that various methods that take the
distribution are now simpler, as they can assume a directory.

The second benefit is that we no longer extract _multiple times_ when
working with a source distribution. (Previously, if we tried to get the
metadata, then fell back and built the wheel, we'd extract the wheel
_twice_.)
This commit is contained in:
Charlie Marsh 2024-03-07 19:40:11 -08:00 committed by GitHub
parent e321a2767d
commit 26f6919465
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 107 additions and 47 deletions

View file

@ -28,7 +28,7 @@ pub(crate) struct BuildArgs {
/// Directory to story the built wheel in
#[clap(short, long)]
wheels: Option<PathBuf>,
/// The source distribution to build, either a directory or a source archive.
/// The source distribution to build, as a directory.
sdist: PathBuf,
/// The subdirectory to build within the source distribution.
subdirectory: Option<PathBuf>,