Rename PartitionedRequirements to InstallPlan (#340)

@konstin named this file at some point and I like it, it feels
appropriate for the struct itself too.
This commit is contained in:
Charlie Marsh 2023-11-06 09:44:35 -08:00 committed by GitHub
parent d9bcfafa16
commit 1f447892f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View file

@ -14,7 +14,7 @@ use platform_tags::Tags;
use puffin_client::RegistryClientBuilder; use puffin_client::RegistryClientBuilder;
use puffin_dispatch::BuildDispatch; use puffin_dispatch::BuildDispatch;
use puffin_distribution::Distribution; use puffin_distribution::Distribution;
use puffin_installer::{Builder, PartitionedRequirements}; use puffin_installer::{Builder, InstallPlan};
use puffin_interpreter::Virtualenv; use puffin_interpreter::Virtualenv;
use crate::commands::reporters::{ use crate::commands::reporters::{
@ -69,11 +69,11 @@ pub(crate) async fn sync_requirements(
// Partition into those that should be linked from the cache (`local`), those that need to be // Partition into those that should be linked from the cache (`local`), those that need to be
// downloaded (`remote`), and those that should be removed (`extraneous`). // downloaded (`remote`), and those that should be removed (`extraneous`).
let PartitionedRequirements { let InstallPlan {
local, local,
remote, remote,
extraneous, extraneous,
} = PartitionedRequirements::try_from_requirements(requirements, cache, &venv)?; } = InstallPlan::try_from_requirements(requirements, cache, &venv)?;
// Nothing to do. // Nothing to do.
if remote.is_empty() && local.is_empty() && extraneous.is_empty() { if remote.is_empty() && local.is_empty() && extraneous.is_empty() {

View file

@ -15,7 +15,7 @@ use pep508_rs::Requirement;
use platform_tags::Tags; use platform_tags::Tags;
use puffin_build::{SourceDistributionBuild, SourceDistributionBuildContext}; use puffin_build::{SourceDistributionBuild, SourceDistributionBuildContext};
use puffin_client::RegistryClient; use puffin_client::RegistryClient;
use puffin_installer::{Builder, Downloader, Installer, PartitionedRequirements, Unzipper}; use puffin_installer::{Builder, Downloader, InstallPlan, Installer, Unzipper};
use puffin_interpreter::{InterpreterInfo, Virtualenv}; use puffin_interpreter::{InterpreterInfo, Virtualenv};
use puffin_resolver::{DistributionFinder, Manifest, PreReleaseMode, ResolutionMode, Resolver}; use puffin_resolver::{DistributionFinder, Manifest, PreReleaseMode, ResolutionMode, Resolver};
use puffin_traits::BuildContext; use puffin_traits::BuildContext;
@ -104,11 +104,11 @@ impl BuildContext for BuildDispatch {
venv.root().display(), venv.root().display(),
); );
let PartitionedRequirements { let InstallPlan {
local, local,
remote, remote,
extraneous, extraneous,
} = PartitionedRequirements::try_from_requirements(requirements, &self.cache, venv)?; } = InstallPlan::try_from_requirements(requirements, &self.cache, venv)?;
let tags = Tags::from_env( let tags = Tags::from_env(
self.interpreter_info.platform(), self.interpreter_info.platform(),

View file

@ -1,7 +1,7 @@
pub use builder::{Builder, Reporter as BuildReporter}; pub use builder::{Builder, Reporter as BuildReporter};
pub use downloader::{Download, Downloader, Reporter as DownloadReporter}; pub use downloader::{Download, Downloader, Reporter as DownloadReporter};
pub use installer::{Installer, Reporter as InstallReporter}; pub use installer::{Installer, Reporter as InstallReporter};
pub use plan::PartitionedRequirements; pub use plan::InstallPlan;
pub use registry_index::RegistryIndex; pub use registry_index::RegistryIndex;
pub use site_packages::SitePackages; pub use site_packages::SitePackages;
pub use uninstall::uninstall; pub use uninstall::uninstall;

View file

@ -11,7 +11,7 @@ use crate::url_index::UrlIndex;
use crate::{RegistryIndex, SitePackages}; use crate::{RegistryIndex, SitePackages};
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub struct PartitionedRequirements { pub struct InstallPlan {
/// The distributions that are not already installed in the current environment, but are /// The distributions that are not already installed in the current environment, but are
/// available in the local cache. /// available in the local cache.
pub local: Vec<CachedDistribution>, pub local: Vec<CachedDistribution>,
@ -25,7 +25,7 @@ pub struct PartitionedRequirements {
pub extraneous: Vec<InstalledDistribution>, pub extraneous: Vec<InstalledDistribution>,
} }
impl PartitionedRequirements { impl InstallPlan {
/// Partition a set of requirements into those that should be linked from the cache, those that /// Partition a set of requirements into those that should be linked from the cache, those that
/// need to be downloaded, and those that should be removed. /// need to be downloaded, and those that should be removed.
pub fn try_from_requirements( pub fn try_from_requirements(
@ -93,7 +93,7 @@ impl PartitionedRequirements {
extraneous.push(dist_info); extraneous.push(dist_info);
} }
Ok(PartitionedRequirements { Ok(InstallPlan {
local, local,
remote, remote,
extraneous, extraneous,