Skip to content

Commit

Permalink
Reverts
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jan 12, 2025
1 parent 27a318c commit ba1ebdc
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 80 deletions.
4 changes: 1 addition & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/uv-distribution-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ uv-pep440 = { workspace = true }
uv-pep508 = { workspace = true }
uv-platform-tags = { workspace = true }
uv-pypi-types = { workspace = true }
uv-small-str = { workspace = true }

anyhow = { workspace = true }
arcstr = { workspace = true }
bitflags = { workspace = true }
fs-err = { workspace = true }
itertools = { workspace = true }
Expand Down
22 changes: 11 additions & 11 deletions crates/uv-distribution-types/src/prioritized_distribution.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::fmt::{Display, Formatter};

use arcstr::ArcStr;
use tracing::debug;

use uv_distribution_filename::{BuildTag, WheelFilename};
use uv_pep440::VersionSpecifiers;
use uv_pep508::{MarkerExpression, MarkerOperator, MarkerTree, MarkerValueString};
use uv_platform_tags::{IncompatibleTag, TagPriority};
use uv_pypi_types::{HashDigest, Yanked};
use uv_small_str::SmallString;

use crate::{
InstalledDist, RegistryBuiltDist, RegistryBuiltWheel, RegistrySourceDist, ResolvedDistRef,
Expand Down Expand Up @@ -663,38 +663,38 @@ pub fn implied_markers(filename: &WheelFilename) -> MarkerTree {
let mut tag_marker = MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::SysPlatform,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("win32"),
value: arcstr::literal!("win32"),
});
tag_marker.and(MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::PlatformMachine,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("x86"),
value: arcstr::literal!("x86"),
}));
marker.or(tag_marker);
}
"win_amd64" => {
let mut tag_marker = MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::SysPlatform,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("win32"),
value: arcstr::literal!("win32"),
});
tag_marker.and(MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::PlatformMachine,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("x86_64"),
value: arcstr::literal!("x86_64"),
}));
marker.or(tag_marker);
}
"win_arm64" => {
let mut tag_marker = MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::SysPlatform,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("win32"),
value: arcstr::literal!("win32"),
});
tag_marker.and(MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::PlatformMachine,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("arm64"),
value: arcstr::literal!("arm64"),
}));
marker.or(tag_marker);
}
Expand All @@ -704,7 +704,7 @@ pub fn implied_markers(filename: &WheelFilename) -> MarkerTree {
let mut tag_marker = MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::SysPlatform,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("darwin"),
value: arcstr::literal!("darwin"),
});

// Parse the macOS version from the tag.
Expand Down Expand Up @@ -788,7 +788,7 @@ pub fn implied_markers(filename: &WheelFilename) -> MarkerTree {
arch_marker.or(MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::PlatformMachine,
operator: MarkerOperator::Equal,
value: SmallString::from(*arch),
value: ArcStr::from(*arch),
}));
}
tag_marker.and(arch_marker);
Expand All @@ -801,7 +801,7 @@ pub fn implied_markers(filename: &WheelFilename) -> MarkerTree {
let mut tag_marker = MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::SysPlatform,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("linux"),
value: arcstr::literal!("linux"),
});

// Parse the architecture from the tag.
Expand Down Expand Up @@ -867,7 +867,7 @@ pub fn implied_markers(filename: &WheelFilename) -> MarkerTree {
tag_marker.and(MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::PlatformMachine,
operator: MarkerOperator::Equal,
value: SmallString::from(arch),
value: ArcStr::from(arch),
}));

marker.or(tag_marker);
Expand Down
1 change: 0 additions & 1 deletion crates/uv-normalize/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mod extra_name;
mod group_name;
mod package_name;


/// Validate and normalize an owned package or extra name.
pub(crate) fn validate_and_normalize_owned(name: String) -> Result<SmallString, InvalidNameError> {
if is_normalized(&name)? {
Expand Down
1 change: 0 additions & 1 deletion crates/uv-pep508/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ workspace = true
uv-fs = { workspace = true }
uv-normalize = { workspace = true }
uv-pep440 = { workspace = true }
uv-small-str = { workspace = true }

arcstr = { workspace = true}
boxcar = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions crates/uv-pep508/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1334,17 +1334,17 @@ mod tests {
let mut b = MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::SysPlatform,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("win32"),
value: arcstr::literal!("win32"),
});
let mut c = MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::OsName,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("linux"),
value: arcstr::literal!("linux"),
});
let d = MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::ImplementationName,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("cpython"),
value: arcstr::literal!("cpython"),
});

c.and(d);
Expand Down
46 changes: 23 additions & 23 deletions crates/uv-pep508/src/marker/algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ use std::ops::Bound;
use std::sync::Mutex;
use std::sync::MutexGuard;

use arcstr::ArcStr;
use itertools::{Either, Itertools};
use rustc_hash::FxHashMap;
use std::sync::LazyLock;
use uv_pep440::{release_specifier_to_range, Operator, Version, VersionSpecifier};
use version_ranges::Ranges;

use uv_pep440::{release_specifier_to_range, Operator, Version, VersionSpecifier};
use uv_small_str::SmallString;
use crate::marker::lowering::{
CanonicalMarkerValueExtra, CanonicalMarkerValueString, CanonicalMarkerValueVersion,
};
Expand Down Expand Up @@ -291,28 +291,28 @@ impl InternerGuard<'_> {
let (key, value) = match (key, value.as_ref()) {
(MarkerValueString::PlatformSystem, "Windows") => (
CanonicalMarkerValueString::SysPlatform,
uv_small_str::literal!("win32"),
arcstr::literal!("win32"),
),
(MarkerValueString::PlatformSystem, "Darwin") => (
CanonicalMarkerValueString::SysPlatform,
uv_small_str::literal!("darwin"),
arcstr::literal!("darwin"),
),
(MarkerValueString::PlatformSystem, "Linux") => (
CanonicalMarkerValueString::SysPlatform,
uv_small_str::literal!("linux"),
arcstr::literal!("linux"),
),
(MarkerValueString::PlatformSystem, "AIX") => (
CanonicalMarkerValueString::SysPlatform,
uv_small_str::literal!("aix"),
arcstr::literal!("aix"),
),
(MarkerValueString::PlatformSystem, "Emscripten") => (
CanonicalMarkerValueString::SysPlatform,
uv_small_str::literal!("emscripten"),
arcstr::literal!("emscripten"),
),
// See: https://peps.python.org/pep-0738/#sys
(MarkerValueString::PlatformSystem, "Android") => (
CanonicalMarkerValueString::SysPlatform,
uv_small_str::literal!("android"),
arcstr::literal!("android"),
),
_ => (key.into(), value),
};
Expand Down Expand Up @@ -873,48 +873,48 @@ impl InternerGuard<'_> {
MarkerExpression::String {
key: MarkerValueString::OsName,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("nt"),
value: arcstr::literal!("nt"),
},
MarkerExpression::String {
key: MarkerValueString::SysPlatform,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("linux"),
value: arcstr::literal!("linux"),
},
),
(
MarkerExpression::String {
key: MarkerValueString::OsName,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("nt"),
value: arcstr::literal!("nt"),
},
MarkerExpression::String {
key: MarkerValueString::SysPlatform,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("darwin"),
value: arcstr::literal!("darwin"),
},
),
(
MarkerExpression::String {
key: MarkerValueString::OsName,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("nt"),
value: arcstr::literal!("nt"),
},
MarkerExpression::String {
key: MarkerValueString::SysPlatform,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("ios"),
value: arcstr::literal!("ios"),
},
),
(
MarkerExpression::String {
key: MarkerValueString::OsName,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("posix"),
value: arcstr::literal!("posix"),
},
MarkerExpression::String {
key: MarkerValueString::SysPlatform,
operator: MarkerOperator::Equal,
value: uv_small_str::literal!("win32"),
value: arcstr::literal!("win32"),
},
),
];
Expand Down Expand Up @@ -954,12 +954,12 @@ impl InternerGuard<'_> {
MarkerExpression::String {
key: MarkerValueString::PlatformSystem,
operator: MarkerOperator::Equal,
value: SmallString::from(platform_system),
value: ArcStr::from(platform_system),
},
MarkerExpression::String {
key: MarkerValueString::SysPlatform,
operator: MarkerOperator::Equal,
value: SmallString::from(sys_platform),
value: ArcStr::from(sys_platform),
},
));
}
Expand Down Expand Up @@ -1000,13 +1000,13 @@ pub(crate) enum Variable {
/// string marker and value.
In {
key: CanonicalMarkerValueString,
value: SmallString,
value: ArcStr,
},
/// A variable representing a `<value> in <key>` expression for a particular
/// string marker and value.
Contains {
key: CanonicalMarkerValueString,
value: SmallString,
value: ArcStr,
},
/// A variable representing the existence or absence of a given extra.
///
Expand Down Expand Up @@ -1132,7 +1132,7 @@ pub(crate) enum Edges {
// Invariant: All ranges are simple, meaning they can be represented by a bounded
// interval without gaps. Additionally, there are at least two edges in the set.
String {
edges: SmallVec<(Ranges<SmallString>, NodeId)>,
edges: SmallVec<(Ranges<ArcStr>, NodeId)>,
},
// The edges of a boolean variable, representing the values `true` (the `high` child)
// and `false` (the `low` child).
Expand Down Expand Up @@ -1162,8 +1162,8 @@ impl Edges {
///
/// This function will panic for the `In` and `Contains` marker operators, which
/// should be represented as separate boolean variables.
fn from_string(operator: MarkerOperator, value: SmallString) -> Edges {
let range: Ranges<SmallString> = match operator {
fn from_string(operator: MarkerOperator, value: ArcStr) -> Edges {
let range: Ranges<ArcStr> = match operator {
MarkerOperator::Equal => Ranges::singleton(value),
MarkerOperator::NotEqual => Ranges::singleton(value).complement(),
MarkerOperator::GreaterThan => Ranges::strictly_higher_than(value),
Expand Down
5 changes: 2 additions & 3 deletions crates/uv-pep508/src/marker/parse.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use arcstr::ArcStr;
use std::str::FromStr;

use uv_normalize::ExtraName;
use uv_pep440::{Version, VersionPattern, VersionSpecifier};
use uv_small_str::SmallString;

use crate::cursor::Cursor;
use crate::marker::MarkerValueExtra;
Expand Down Expand Up @@ -93,7 +92,7 @@ pub(crate) fn parse_marker_value<T: Pep508Url>(
Some((start_pos, quotation_mark @ ('"' | '\''))) => {
cursor.next();
let (start, len) = cursor.take_while(|c| c != quotation_mark);
let value = SmallString::from(cursor.slice(start, len));
let value = ArcStr::from(cursor.slice(start, len));
cursor.next_expect_char(quotation_mark, start_pos)?;
Ok(MarkerValue::QuotedString(value))
}
Expand Down
7 changes: 3 additions & 4 deletions crates/uv-pep508/src/marker/simplify.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use std::fmt;
use std::ops::Bound;


use arcstr::ArcStr;
use indexmap::IndexMap;
use itertools::Itertools;
use rustc_hash::FxBuildHasher;
use version_ranges::Ranges;

use uv_pep440::{Version, VersionSpecifier};
use uv_small_str::SmallString;

use crate::{ExtraOperator, MarkerExpression, MarkerOperator, MarkerTree, MarkerTreeKind};

Expand Down Expand Up @@ -134,7 +133,7 @@ fn collect_dnf(

let expr = MarkerExpression::String {
key: marker.key().into(),
value: marker.value().clone(),
value: ArcStr::from(marker.value()),
operator,
};

Expand All @@ -153,7 +152,7 @@ fn collect_dnf(

let expr = MarkerExpression::String {
key: marker.key().into(),
value: SmallString::from(marker.value()),
value: ArcStr::from(marker.value()),
operator,
};

Expand Down
Loading

0 comments on commit ba1ebdc

Please sign in to comment.