Skip to content

Commit

Permalink
Revert "Remove this"
Browse files Browse the repository at this point in the history
This reverts commit 9287146.
  • Loading branch information
charliermarsh committed Jan 14, 2025
1 parent 9287146 commit b64a42f
Show file tree
Hide file tree
Showing 18 changed files with 344 additions and 480 deletions.
8 changes: 4 additions & 4 deletions crates/uv-bench/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ name = "distribution-filename"
path = "benches/distribution_filename.rs"
harness = false

# [[bench]]
# name = "uv"
# path = "benches/uv.rs"
# harness = false
[[bench]]
name = "uv"
path = "benches/uv.rs"
harness = false

[dependencies]
uv-cache = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions crates/uv-bench/benches/distribution_filename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ fn benchmark_wheelname_tag_compatibility(c: &mut Criterion<WallTime>) {

criterion_group!(
uv_distribution_filename,
// benchmark_build_platform_tags,
benchmark_build_platform_tags,
benchmark_wheelname_parsing,
benchmark_wheelname_parsing_failure,
// benchmark_wheelname_tag_compatibility,
benchmark_wheelname_tag_compatibility,
);
criterion_main!(uv_distribution_filename);
118 changes: 54 additions & 64 deletions crates/uv-build-backend/src/wheel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use tracing::{debug, trace};
use walkdir::WalkDir;
use zip::{CompressionMethod, ZipWriter};

use uv_distribution_filename::{TagSet, WheelFilename, WheelTag};
use uv_distribution_filename::WheelFilename;
use uv_fs::Simplified;
use uv_globfilter::{parse_portable_glob, GlobDirFilter};
use uv_platform_tags::{AbiTag, LanguageTag, PlatformTag};
Expand All @@ -33,18 +33,16 @@ pub fn build_wheel(
}
crate::check_metadata_directory(source_tree, metadata_directory, &pyproject_toml)?;

let filename = WheelFilename {
name: pyproject_toml.name().clone(),
version: pyproject_toml.version().clone(),
tags: WheelTag::from_parts(
LanguageTag::Python {
major: 3,
minor: None,
},
AbiTag::None,
PlatformTag::Any,
),
};
let filename = WheelFilename::new(
pyproject_toml.name().clone(),
pyproject_toml.version().clone(),
LanguageTag::Python {
major: 3,
minor: None,
},
AbiTag::None,
PlatformTag::Any,
);

let wheel_path = wheel_dir.join(filename.to_string());
debug!("Writing wheel at {}", wheel_path.user_display());
Expand Down Expand Up @@ -72,18 +70,16 @@ pub fn list_wheel(
warn_user_once!("{warning}");
}

let filename = WheelFilename {
name: pyproject_toml.name().clone(),
version: pyproject_toml.version().clone(),
tags: WheelTag::from_parts(
LanguageTag::Python {
major: 3,
minor: None,
},
AbiTag::None,
PlatformTag::Any,
),
};
let filename = WheelFilename::new(
pyproject_toml.name().clone(),
pyproject_toml.version().clone(),
LanguageTag::Python {
major: 3,
minor: None,
},
AbiTag::None,
PlatformTag::Any,
);

let mut files = FileList::new();
let writer = ListWriter::new(&mut files);
Expand Down Expand Up @@ -255,18 +251,16 @@ pub fn build_editable(

crate::check_metadata_directory(source_tree, metadata_directory, &pyproject_toml)?;

let filename = WheelFilename {
name: pyproject_toml.name().clone(),
version: pyproject_toml.version().clone(),
tags: WheelTag::from_parts(
LanguageTag::Python {
major: 3,
minor: None,
},
AbiTag::None,
PlatformTag::Any,
),
};
let filename = WheelFilename::new(
pyproject_toml.name().clone(),
pyproject_toml.version().clone(),
LanguageTag::Python {
major: 3,
minor: None,
},
AbiTag::None,
PlatformTag::Any,
);

let wheel_path = wheel_dir.join(filename.to_string());
debug!("Writing wheel at {}", wheel_path.user_display());
Expand Down Expand Up @@ -311,18 +305,16 @@ pub fn metadata(
warn_user_once!("{warning}");
}

let filename = WheelFilename {
name: pyproject_toml.name().clone(),
version: pyproject_toml.version().clone(),
tags: WheelTag::from_parts(
LanguageTag::Python {
major: 3,
minor: None,
},
AbiTag::None,
PlatformTag::Any,
),
};
let filename = WheelFilename::new(
pyproject_toml.name().clone(),
pyproject_toml.version().clone(),
LanguageTag::Python {
major: 3,
minor: None,
},
AbiTag::None,
PlatformTag::Any,
);

debug!(
"Writing metadata files to {}",
Expand Down Expand Up @@ -572,9 +564,9 @@ fn wheel_info(filename: &WheelFilename, uv_version: &str) -> String {
("Generator", format!("uv {uv_version}")),
("Root-Is-Purelib", "true".to_string()),
];
for python_tag in filename.tags.python_tags() {
for abi_tag in filename.tags.abi_tags() {
for platform_tag in filename.tags.platform_tags() {
for python_tag in filename.python_tags() {
for abi_tag in filename.abi_tags() {
for platform_tag in filename.platform_tags() {
wheel_info.push(("Tag", format!("{python_tag}-{abi_tag}-{platform_tag}")));
}
}
Expand Down Expand Up @@ -769,18 +761,16 @@ mod test {

#[test]
fn test_wheel() {
let filename = WheelFilename {
name: PackageName::from_str("foo").unwrap(),
version: Version::from_str("1.2.3").unwrap(),
tags: WheelTag::from_parts(
LanguageTag::Python {
major: 3,
minor: None,
},
AbiTag::None,
PlatformTag::Any,
),
};
let filename = WheelFilename::new(
PackageName::from_str("foo").unwrap(),
Version::from_str("1.2.3").unwrap(),
LanguageTag::Python {
major: 3,
minor: None,
},
AbiTag::None,
PlatformTag::Any,
);

assert_snapshot!(wheel_info(&filename, "1.0.0+test"), @r"
Wheel-Version: 1.0
Expand Down
4 changes: 2 additions & 2 deletions crates/uv-distribution-filename/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub use build_tag::{BuildTag, BuildTagError};
pub use egg::{EggInfoFilename, EggInfoFilenameError};
pub use extension::{DistExtension, ExtensionError, SourceDistExtension};
pub use source_dist::{SourceDistFilename, SourceDistFilenameError};
pub use wheel::{TagSet, WheelTag, WheelFilename, WheelFilenameError};
pub use wheel::{TagSet, WheelFilename, WheelFilenameError};

mod build_tag;
mod egg;
Expand Down Expand Up @@ -99,6 +99,6 @@ mod tests {

#[test]
fn wheel_filename_size() {
assert_eq!(size_of::<WheelFilename>(), 128);
assert_eq!(size_of::<WheelFilename>(), 48);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,27 @@ Ok(
"foo",
),
version: "1.2.3",
build_tag: Some(
BuildTag(
202206090410,
None,
),
),
python_tag: [
Python {
major: 3,
minor: None,
tags: Large {
large: WheelTagLarge {
build_tag: Some(
BuildTag(
202206090410,
None,
),
),
python_tag: [
Python {
major: 3,
minor: None,
},
],
abi_tag: [
None,
],
platform_tag: [
Any,
],
},
],
abi_tag: [
None,
],
platform_tag: [
Any,
],
},
},
)

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,37 @@ Ok(
"foo",
),
version: "1.2.3",
build_tag: None,
python_tag: [
CPython {
python_version: (
3,
11,
),
tags: Large {
large: WheelTagLarge {
build_tag: None,
python_tag: [
CPython {
python_version: (
3,
11,
),
},
],
abi_tag: [
CPython {
gil_disabled: false,
python_version: (
3,
11,
),
},
],
platform_tag: [
Manylinux {
major: 2,
minor: 17,
arch: X86_64,
},
Manylinux2014 {
arch: X86_64,
},
],
},
],
abi_tag: [
CPython {
gil_disabled: false,
python_version: (
3,
11,
),
},
],
platform_tag: [
Manylinux {
major: 2,
minor: 17,
arch: X86_64,
},
Manylinux2014 {
arch: X86_64,
},
],
},
},
)
Loading

0 comments on commit b64a42f

Please sign in to comment.