mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
Remove ResolutionGraph#requirements
(#903)
This commit is contained in:
parent
d3f65c317d
commit
477186dcb3
2 changed files with 6 additions and 17 deletions
|
@ -9,7 +9,7 @@ use fs_err::File;
|
|||
use itertools::Itertools;
|
||||
use petgraph::dot::{Config as DotConfig, Dot};
|
||||
|
||||
use distribution_types::IndexUrls;
|
||||
use distribution_types::{IndexUrls, Resolution};
|
||||
use pep508_rs::Requirement;
|
||||
use platform_host::Platform;
|
||||
use puffin_cache::{Cache, CacheArgs};
|
||||
|
@ -97,16 +97,15 @@ pub(crate) async fn resolve_cli(args: ResolveCliArgs) -> Result<()> {
|
|||
write!(&mut writer, "{graphviz:?}")?;
|
||||
}
|
||||
|
||||
let mut resolution = resolution_graph.requirements();
|
||||
resolution.sort_unstable_by(|a, b| a.name.cmp(&b.name));
|
||||
let requirements = Resolution::from(resolution_graph).requirements();
|
||||
|
||||
#[allow(clippy::print_stderr, clippy::ignored_unit_patterns)]
|
||||
#[allow(clippy::print_stderr)]
|
||||
match args.format {
|
||||
ResolveCliFormat::Compact => {
|
||||
println!("{}", resolution.iter().map(ToString::to_string).join(" "));
|
||||
println!("{}", requirements.iter().map(ToString::to_string).join(" "));
|
||||
}
|
||||
ResolveCliFormat::Expanded => {
|
||||
for package in resolution {
|
||||
for package in requirements {
|
||||
println!("{}", package);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ use url::Url;
|
|||
|
||||
use distribution_types::{Dist, DistributionMetadata, LocalEditable, Name, PackageId, Verbatim};
|
||||
use pep440_rs::Version;
|
||||
use pep508_rs::{Requirement, VerbatimUrl};
|
||||
use pep508_rs::VerbatimUrl;
|
||||
use puffin_normalize::{ExtraName, PackageName};
|
||||
use puffin_traits::OnceMap;
|
||||
use pypi_types::{Hashes, Metadata21};
|
||||
|
@ -201,16 +201,6 @@ impl ResolutionGraph {
|
|||
self.petgraph.node_count() == 0
|
||||
}
|
||||
|
||||
/// Return the set of [`Requirement`]s that this graph represents.
|
||||
pub fn requirements(&self) -> Vec<Requirement> {
|
||||
self.petgraph
|
||||
.node_indices()
|
||||
.map(|node| &self.petgraph[node])
|
||||
.cloned()
|
||||
.map(Requirement::from)
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Return the [`Diagnostic`]s that were encountered while building the graph.
|
||||
pub fn diagnostics(&self) -> &[Diagnostic] {
|
||||
&self.diagnostics
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue