Move Source abstraction into puffin-distribution (#321)

No code changes, but this will allow it to be shared between the
installer and the resolver.
This commit is contained in:
Charlie Marsh 2023-11-05 18:31:15 -08:00 committed by GitHub
parent 4b83d8e949
commit d785ffdbff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 5 deletions

1
Cargo.lock generated
View file

@ -2241,6 +2241,7 @@ dependencies = [
"anyhow",
"pep440_rs 0.3.12",
"puffin-cache",
"puffin-git",
"puffin-normalize",
"puffin-package",
"url",

View file

@ -12,6 +12,7 @@ license = { workspace = true }
[dependencies]
pep440_rs = { path = "../pep440-rs" }
puffin-cache = { path = "../puffin-cache" }
puffin-git = { path = "../puffin-git" }
puffin-normalize = { path = "../puffin-normalize" }
puffin-package = { path = "../puffin-package" }

View file

@ -10,6 +10,8 @@ use puffin_cache::CanonicalUrl;
use puffin_normalize::PackageName;
use puffin_package::pypi_types::File;
pub mod source;
/// A built distribution (wheel), which either exists remotely or locally.
#[derive(Debug, Clone)]
pub enum Distribution {

View file

@ -1,15 +1,15 @@
use std::path::PathBuf;
use anyhow::{Error, Result};
use url::Url;
use puffin_distribution::RemoteDistributionRef;
use puffin_git::Git;
use crate::RemoteDistributionRef;
/// The source of a distribution.
#[derive(Debug)]
pub(crate) enum Source<'a> {
pub enum Source<'a> {
/// The distribution is available at a URL in a registry, like PyPI.
RegistryUrl(Url),
/// The distribution is available at an arbitrary remote URL, like a GitHub Release.

View file

@ -2,6 +2,5 @@ pub(crate) use source_distribution::SourceDistributionFetcher;
pub(crate) use wheel::WheelFetcher;
mod cached_wheel;
mod source;
mod source_distribution;
mod wheel;

View file

@ -10,13 +10,13 @@ use url::Url;
use distribution_filename::WheelFilename;
use platform_tags::Tags;
use puffin_client::RegistryClient;
use puffin_distribution::source::Source;
use puffin_distribution::RemoteDistributionRef;
use puffin_git::{Git, GitSource};
use puffin_package::pypi_types::Metadata21;
use puffin_traits::BuildContext;
use crate::distribution::cached_wheel::CachedWheel;
use crate::distribution::source::Source;
const BUILT_WHEELS_CACHE: &str = "built-wheels-v0";