Skip to content

Commit

Permalink
Reverts
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Aug 17, 2024
1 parent 67e8817 commit 262abc8
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 22 deletions.
5 changes: 1 addition & 4 deletions crates/pypi-types/src/requirement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::str::FromStr;

use distribution_filename::DistExtension;
use thiserror::Error;
use tracing::debug;
use url::Url;

use pep440_rs::VersionSpecifiers;
Expand Down Expand Up @@ -62,9 +61,7 @@ impl Requirement {
/// expressions based on the environment to `true`. That is, this provides
/// environment independent marker evaluation.
pub fn evaluate_markers(&self, env: Option<&MarkerEnvironment>, extras: &[ExtraName]) -> bool {
let x = self.marker.evaluate_optional_environment(env, extras);
debug!("Marker evaluation for {:?} with env {:?}: {}", self, env, x);
return x;
self.marker.evaluate_optional_environment(env, extras)
}

/// Returns `true` if the requirement is editable.
Expand Down
1 change: 0 additions & 1 deletion crates/uv-dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ impl<'a> BuildContext for BuildDispatch<'a> {
.index_strategy(self.index_strategy)
.build(),
&python_requirement,
// STOPSHIP(charlie): This is slightly problematic, doesn't go through `resolution_environment`.
ResolverMarkers::specific_environment(markers.clone()),
Some(tags),
self.flat_index,
Expand Down
14 changes: 7 additions & 7 deletions crates/uv-resolver/src/resolver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
);

if marker.is_false() {
debug!("skipping {requirement} because of Requires-Python: {requires_python}");
trace!("skipping {requirement} because of Requires-Python: {requires_python}");
return None;
}

Expand All @@ -1527,7 +1527,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
// this fork (but will be part of another fork).
if let ResolverMarkers::Fork(markers) = markers {
if markers.is_disjoint(&requirement.marker) {
debug!("skipping {requirement} because of context resolver markers {markers:?}");
trace!("skipping {requirement} because of context resolver markers {markers:?}");
return None;
}
}
Expand Down Expand Up @@ -1574,7 +1574,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
// and the constraint is `requests ; python_version == '3.6'`, the
// constraint should only apply when _both_ markers are true.
if marker.is_false() {
debug!("skipping {constraint} because of Requires-Python: {requires_python}");
trace!("skipping {constraint} because of Requires-Python: {requires_python}");
return None;
}

Expand Down Expand Up @@ -1613,7 +1613,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
// this fork (but will be part of another fork).
if let ResolverMarkers::Fork(markers) = markers {
if markers.is_disjoint(&constraint.marker) {
debug!("skipping {constraint} because of context resolver markers {markers:?}");
trace!("skipping {constraint} because of context resolver markers {markers:?}");
return None;
}
}
Expand Down Expand Up @@ -1657,13 +1657,13 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
while let Some(response) = response_stream.next().await {
match response? {
Some(Response::Package(package_name, version_map)) => {
debug!("Received package metadata for: {package_name}");
trace!("Received package metadata for: {package_name}");
self.index
.packages()
.done(package_name, Arc::new(version_map));
}
Some(Response::Installed { dist, metadata }) => {
debug!("Received installed distribution metadata for: {dist}");
trace!("Received installed distribution metadata for: {dist}");
self.index.distributions().done(
dist.version_id(),
Arc::new(MetadataResponse::Found(ArchiveMetadata::from_metadata23(
Expand All @@ -1675,7 +1675,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
dist: Dist::Built(dist),
metadata,
}) => {
debug!("Received built distribution metadata for: {dist}");
trace!("Received built distribution metadata for: {dist}");
match &metadata {
MetadataResponse::InvalidMetadata(err) => {
warn!("Unable to extract metadata for {dist}: {err}");
Expand Down
15 changes: 10 additions & 5 deletions crates/uv-resolver/src/resolver/resolver_markers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use std::fmt::{Display, Formatter};

use tracing::debug;
use pep508_rs::{MarkerEnvironment, MarkerTree, StringVersion};

use pep508_rs::{MarkerEnvironment, MarkerTree};

#[derive(Debug, Clone)]
/// Whether we're solving for a specific environment, universally or for a specific fork.
Expand All @@ -23,11 +25,14 @@ impl ResolverMarkers {
// The resolver operates with release-only semantics for Python versions. So if the user's
// environment specifies a pre-release version, we need to strip it.
let python_full_version = markers.python_full_version().only_release();
let markers = if python_full_version != markers.python_full_version().version {
debug!("Stripping pre-release from `python_full_version`: {}", markers.python_full_version());
markers.with_python_full_version(python_full_version)
} else {
let markers = if python_full_version == markers.python_full_version().version {
markers
} else {
debug!(
"Stripping pre-release from `python_full_version`: {}",
markers.python_full_version()
);
markers.with_python_full_version(python_full_version)
};

Self::SpecificEnvironment(markers)
Expand Down
1 change: 0 additions & 1 deletion crates/uv/src/commands/pip/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ pub(crate) async fn pip_install(
&reinstall,
&upgrade,
Some(&tags),
// STOPSHIP(charlie): This is slightly problematic, doesn't go through `resolution_environment`.
ResolverMarkers::specific_environment((*markers).clone()),
python_requirement,
&client,
Expand Down
1 change: 0 additions & 1 deletion crates/uv/src/commands/pip/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ pub(crate) async fn pip_sync(
&reinstall,
&upgrade,
Some(&tags),
// STOPSHIP(charlie): This is slightly problematic, doesn't go through `resolution_environment`.
ResolverMarkers::specific_environment((*markers).clone()),
python_requirement,
&client,
Expand Down
2 changes: 0 additions & 2 deletions crates/uv/src/commands/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ pub(crate) async fn resolve_environment<'a>(
&reinstall,
&upgrade,
Some(tags),
// STOPSHIP(charlie): This is slightly problematic, doesn't go through `resolution_environment`.
ResolverMarkers::specific_environment(markers.clone()),
python_requirement,
&client,
Expand Down Expand Up @@ -950,7 +949,6 @@ pub(crate) async fn update_environment(
reinstall,
upgrade,
Some(tags),
// STOPSHIP(charlie): This is slightly problematic, doesn't go through `resolution_environment`.
ResolverMarkers::specific_environment(markers.clone()),
python_requirement,
&client,
Expand Down
1 change: 0 additions & 1 deletion req.in

This file was deleted.

0 comments on commit 262abc8

Please sign in to comment.