From d2cc857d960a8938cab60f424fb358d010e372f7 Mon Sep 17 00:00:00 2001 From: konstin Date: Mon, 7 Jun 2021 18:17:36 +0200 Subject: [PATCH] Metadata-Version 2.2 Since PEP 643 is accepted we can upgrade to Metadata-Version 2.2 --- Changelog.md | 1 - Readme.md | 2 -- src/build_context.rs | 20 +++++++-------- src/build_options.rs | 18 +++++++------- src/develop.rs | 12 ++++----- src/lib.rs | 2 +- src/main.rs | 18 +++++++------- src/metadata.rs | 31 +++++++++++------------ src/module_writer.rs | 40 +++++++++++++++--------------- src/read_distribution.rs | 2 +- src/source_distribution.rs | 12 ++++----- src/upload.rs | 4 +-- test-data/pyo3_mixed-2.1.1.tar.gz | Bin 403 -> 391 bytes 13 files changed, 79 insertions(+), 83 deletions(-) diff --git a/Changelog.md b/Changelog.md index 4bdd92f38..bfa172ff3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,7 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Users should migrate away from the old `[package.metadata.maturin]` table of `Cargo.toml` to this new `[project]` table of `pyproject.toml` * Add PEP 656 musllinux support in [#543](https://github.com/PyO3/maturin/pull/543) * `--manylinux` is now called `--compatibility` and supports musllinux -* The pure rust install layout changed from just the shared library to a python module that reexports the shared library. This should have now observable consequences for users of the created wheel expect that `my_project.my_project` is now also importable (and equal to just `my_project`) ## 0.10.6 - 2021-05-21 diff --git a/Readme.md b/Readme.md index 2fe47a03c..2a01d6d67 100644 --- a/Readme.md +++ b/Readme.md @@ -426,5 +426,3 @@ The `sysconfig` folder contains the output of `python -m sysconfig` for differen You need to install `cffi` and `virtualenv` (`pip install cffi virtualenv`) to run the tests. There are two optional hacks that can speed up the tests (over 80s to 17s on my machine). By running `cargo build --release --manifest-path test-crates/cargo-mock/Cargo.toml` you can activate a cargo cache avoiding to rebuild the pyo3 test crates with every python version. Delete `target/test-cache` to clear the cache (e.g. after changing a test crate) or remove `test-crates/cargo-mock/target/release/cargo` to deactivate it. By running the tests with the `faster-tests` feature, binaries are stripped and wheels are only stored and not compressed. - -You might want to have look into my by now slightly outdated [blog post](https://blog.schuetze.link/2018/07/21/a-dive-into-packaging-native-python-extensions.html) which explains the intricacies of building native python packages. diff --git a/src/build_context.rs b/src/build_context.rs index c9d238a69..4eefbfb67 100644 --- a/src/build_context.rs +++ b/src/build_context.rs @@ -7,7 +7,7 @@ use crate::module_writer::write_python_part; use crate::module_writer::WheelWriter; use crate::module_writer::{write_bin, write_bindings_module, write_cffi_module}; use crate::source_distribution::source_distribution; -use crate::Metadata21; +use crate::Metadata22; use crate::PyProjectToml; use crate::PythonInterpreter; use crate::Target; @@ -125,12 +125,12 @@ pub struct BuildContext { /// Whether this project is pure rust or rust mixed with python pub project_layout: ProjectLayout, /// Python Package Metadata 2.1 - pub metadata21: Metadata21, + pub metadata22: Metadata22, /// The name of the crate pub crate_name: String, /// The name of the module can be distinct from the package name, mostly /// because package names normally contain minuses while module names - /// have underscores. The package name is part of metadata21 + /// have underscores. The package name is part of metadata22 pub module_name: String, /// The path to the Cargo.toml. Required for the cargo invocations pub manifest_path: PathBuf, @@ -191,7 +191,7 @@ impl BuildContext { Ok(pyproject) => { let sdist_path = source_distribution( &self.out, - &self.metadata21, + &self.metadata22, &self.manifest_path, &self.cargo_metadata, pyproject.sdist_include(), @@ -237,7 +237,7 @@ impl BuildContext { let platform = self.target.get_platform_tag(platform_tag, self.universal2); let tag = format!("cp{}{}-abi3-{}", major, min_minor, platform); - let mut writer = WheelWriter::new(&tag, &self.out, &self.metadata21, &[tag.clone()])?; + let mut writer = WheelWriter::new(&tag, &self.out, &self.metadata22, &[tag.clone()])?; write_bindings_module( &mut writer, @@ -292,7 +292,7 @@ impl BuildContext { ) -> Result { let tag = python_interpreter.get_tag(platform_tag, self.universal2); - let mut writer = WheelWriter::new(&tag, &self.out, &self.metadata21, &[tag.clone()])?; + let mut writer = WheelWriter::new(&tag, &self.out, &self.metadata22, &[tag.clone()])?; write_bindings_module( &mut writer, @@ -382,7 +382,7 @@ impl BuildContext { .target .get_universal_tags(platform_tag, self.universal2); - let mut builder = WheelWriter::new(&tag, &self.out, &self.metadata21, &tags)?; + let mut builder = WheelWriter::new(&tag, &self.out, &self.metadata22, &tags)?; write_cffi_module( &mut builder, @@ -420,11 +420,11 @@ impl BuildContext { .target .get_universal_tags(platform_tag, self.universal2); - if !self.metadata21.scripts.is_empty() { + if !self.metadata22.scripts.is_empty() { bail!("Defining entrypoints and working with a binary doesn't mix well"); } - let mut builder = WheelWriter::new(&tag, &self.out, &self.metadata21, &tags)?; + let mut builder = WheelWriter::new(&tag, &self.out, &self.metadata22, &tags)?; match self.project_layout { ProjectLayout::Mixed { @@ -443,7 +443,7 @@ impl BuildContext { let bin_name = artifact .file_name() .expect("Couldn't get the filename from the binary produced by cargo"); - write_bin(&mut builder, &artifact, &self.metadata21, bin_name)?; + write_bin(&mut builder, &artifact, &self.metadata22, bin_name)?; let wheel_path = builder.finish()?; Ok((wheel_path, "py3".to_string())) diff --git a/src/build_options.rs b/src/build_options.rs index 2ad27da7e..b8436e9bd 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -4,7 +4,7 @@ use crate::cross_compile::{find_sysconfigdata, is_cross_compiling, parse_sysconf use crate::python_interpreter::InterpreterKind; use crate::BuildContext; use crate::CargoToml; -use crate::Metadata21; +use crate::Metadata22; use crate::PythonInterpreter; use crate::Target; use anyhow::{bail, format_err, Context, Result}; @@ -130,7 +130,7 @@ impl BuildOptions { let cargo_toml = CargoToml::from_path(&manifest_file)?; let manifest_dir = manifest_file.parent().unwrap(); - let metadata21 = Metadata21::from_cargo_toml(&cargo_toml, &manifest_dir) + let metadata22 = Metadata22::from_cargo_toml(&cargo_toml, &manifest_dir) .context("Failed to parse Cargo.toml into python metadata")?; let extra_metadata = cargo_toml.remaining_core_metadata(); @@ -201,7 +201,7 @@ impl BuildOptions { // User given list of interpreters Some(interpreter) => find_interpreter(&bridge, &interpreter, &target, None)?, // Auto-detect interpreters - None => find_interpreter(&bridge, &[], &target, get_min_python_minor(&metadata21))?, + None => find_interpreter(&bridge, &[], &target, get_min_python_minor(&metadata22))?, }; let rustc_extra_args = split_extra_args(&self.rustc_extra_args)?; @@ -229,7 +229,7 @@ impl BuildOptions { target, bridge, project_layout, - metadata21, + metadata22, crate_name: crate_name.to_string(), module_name, manifest_path: self.manifest_path, @@ -249,8 +249,8 @@ impl BuildOptions { /// Uses very simple PEP 440 subset parsing to determine the /// minimum supported python minor version for interpreter search -fn get_min_python_minor(metadata21: &Metadata21) -> Option { - if let Some(requires_python) = &metadata21.requires_python { +fn get_min_python_minor(metadata22: &Metadata22) -> Option { + if let Some(requires_python) = &metadata22.requires_python { let regex = Regex::new(r#">=3\.(\d+)(?:\.\d)?"#).unwrap(); if let Some(captures) = regex.captures(&requires_python) { let min_python_minor = captures[1] @@ -760,8 +760,8 @@ mod test { fn test_get_min_python_minor() { // Nothing specified let cargo_toml = CargoToml::from_path("test-crates/pyo3-pure/Cargo.toml").unwrap(); - let metadata21 = - Metadata21::from_cargo_toml(&cargo_toml, &"test-crates/pyo3-pure").unwrap(); - assert_eq!(get_min_python_minor(&metadata21), None); + let metadata22 = + Metadata22::from_cargo_toml(&cargo_toml, &"test-crates/pyo3-pure").unwrap(); + assert_eq!(get_min_python_minor(&metadata22), None); } } diff --git a/src/develop.rs b/src/develop.rs index d8125ef77..6b0bc9f59 100644 --- a/src/develop.rs +++ b/src/develop.rs @@ -48,11 +48,11 @@ pub fn develop( })?; // Install dependencies - if !build_context.metadata21.requires_dist.is_empty() { + if !build_context.metadata22.requires_dist.is_empty() { let mut args = vec!["-m", "pip", "install"]; args.extend( build_context - .metadata21 + .metadata22 .requires_dist .iter() .map(|x| x.as_str()), @@ -74,7 +74,7 @@ pub fn develop( // // Uninstalling the actual code is done individually for each bridge model let base_path = target.get_venv_site_package(venv_dir, &interpreter); - let dist_info_dir = base_path.join(build_context.metadata21.get_dist_info_dir()); + let dist_info_dir = base_path.join(build_context.metadata22.get_dist_info_dir()); if dist_info_dir.is_dir() { fs::remove_dir_all(&dist_info_dir).context(format!( "Failed to uninstall existing installation by removing {}", @@ -178,18 +178,18 @@ pub fn develop( } }; - write_dist_info(&mut writer, &build_context.metadata21, &tags)?; + write_dist_info(&mut writer, &build_context.metadata22, &tags)?; // https://packaging.python.org/specifications/recording-installed-packages/#the-installer-file writer.add_bytes( build_context - .metadata21 + .metadata22 .get_dist_info_dir() .join("INSTALLER"), env!("CARGO_PKG_NAME").as_bytes(), )?; - writer.write_record(&build_context.metadata21)?; + writer.write_record(&build_context.metadata22)?; Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index 5ac67ade4..d1fead9f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -32,7 +32,7 @@ pub use crate::build_options::BuildOptions; pub use crate::cargo_toml::CargoToml; pub use crate::compile::compile; pub use crate::develop::develop; -pub use crate::metadata::{Metadata21, WheelMetadata}; +pub use crate::metadata::{Metadata22, WheelMetadata}; pub use crate::module_writer::{ write_dist_info, ModuleWriter, PathWriter, SDistWriter, WheelWriter, }; diff --git a/src/main.rs b/src/main.rs index dffbc8d91..35ab54289 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,7 +16,7 @@ use human_panic::setup_panic; use keyring::{Keyring, KeyringError}; use maturin::{ develop, source_distribution, write_dist_info, BridgeModel, BuildOptions, CargoToml, - Metadata21, PathWriter, PlatformTag, PyProjectToml, PythonInterpreter, Target, + Metadata22, PathWriter, PlatformTag, PyProjectToml, PythonInterpreter, Target, }; use std::env; use std::path::PathBuf; @@ -410,8 +410,8 @@ fn pep517(subcommand: Pep517Command) -> Result<()> { }; let mut writer = PathWriter::from_path(metadata_directory); - write_dist_info(&mut writer, &context.metadata21, &tags)?; - println!("{}", context.metadata21.get_dist_info_dir().display()); + write_dist_info(&mut writer, &context.metadata22, &tags)?; + println!("{}", context.metadata22.get_dist_info_dir().display()); } Pep517Command::BuildWheel { build_options, @@ -428,7 +428,7 @@ fn pep517(subcommand: Pep517Command) -> Result<()> { } => { let cargo_toml = CargoToml::from_path(&manifest_path)?; let manifest_dir = manifest_path.parent().unwrap(); - let metadata21 = Metadata21::from_cargo_toml(&cargo_toml, &manifest_dir) + let metadata22 = Metadata22::from_cargo_toml(&cargo_toml, &manifest_dir) .context("Failed to parse Cargo.toml into python metadata")?; let cargo_metadata = MetadataCommand::new() .manifest_path(&manifest_path) @@ -437,7 +437,7 @@ fn pep517(subcommand: Pep517Command) -> Result<()> { let path = source_distribution( sdist_directory, - &metadata21, + &metadata22, &manifest_path, &cargo_metadata, None, @@ -559,7 +559,7 @@ fn run() -> Result<()> { eprintln!("⚠ Warning: You're publishing debug wheels"); } - let metadata21 = build_context.metadata21.to_vec(); + let metadata22 = build_context.metadata22.to_vec(); let mut wheels = build_context.build_wheels()?; if !no_sdist { if let Some(sd) = build_context.build_source_distribution()? { @@ -569,7 +569,7 @@ fn run() -> Result<()> { let items = wheels .into_iter() - .map(|wheel| UploadItem::from_built_wheel(wheel, metadata21.clone())) + .map(|wheel| UploadItem::from_built_wheel(wheel, metadata22.clone())) .collect::>(); upload_ui(&items, &publish)? @@ -625,7 +625,7 @@ fn run() -> Result<()> { .context("A pyproject.toml with a PEP 517 compliant `[build-system]` table is required to build a source distribution")?; let cargo_toml = CargoToml::from_path(&manifest_path)?; - let metadata21 = Metadata21::from_cargo_toml(&cargo_toml, &manifest_dir) + let metadata22 = Metadata22::from_cargo_toml(&cargo_toml, &manifest_dir) .context("Failed to parse Cargo.toml into python metadata")?; let cargo_metadata = MetadataCommand::new() @@ -643,7 +643,7 @@ fn run() -> Result<()> { source_distribution( &wheel_dir, - &metadata21, + &metadata22, &manifest_path, &cargo_metadata, pyproject.sdist_include(), diff --git a/src/metadata.rs b/src/metadata.rs index 21539599f..fc2d2f9e0 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -10,22 +10,22 @@ use std::str; /// The metadata required to generate the .dist-info directory #[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)] pub struct WheelMetadata { - /// Python Package Metadata 2.1 - pub metadata21: Metadata21, + /// Python Package Metadata 2.2 + pub metadata22: Metadata22, /// The `[console_scripts]` for the entry_points.txt pub scripts: HashMap, /// The name of the module can be distinct from the package name, mostly /// because package names normally contain minuses while module names - /// have underscores. The package name is part of metadata21 + /// have underscores. The package name is part of metadata22 pub module_name: String, } -/// Python Package Metadata 2.1 as specified in +/// Python Package Metadata 2.2 as specified in /// https://packaging.python.org/specifications/core-metadata/ #[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)] #[serde(rename_all = "kebab-case")] #[allow(missing_docs)] -pub struct Metadata21 { +pub struct Metadata22 { // Mandatory fields pub metadata_version: String, pub name: String, @@ -78,7 +78,7 @@ fn path_to_content_type(path: &Path) -> String { }) } -impl Metadata21 { +impl Metadata22 { /// Merge metadata with pyproject.toml, where pyproject.toml takes precedence /// /// manifest_path must be the directory, not the file @@ -248,14 +248,13 @@ impl Metadata21 { } Ok(()) } - /// Uses a Cargo.toml to create the metadata for python packages /// /// manifest_path must be the directory, not the file pub fn from_cargo_toml( cargo_toml: &CargoToml, manifest_path: impl AsRef, - ) -> Result { + ) -> Result { let authors = cargo_toml.package.authors.join(", "); let classifiers = cargo_toml.classifiers(); @@ -296,8 +295,8 @@ impl Metadata21 { }) .unwrap_or_else(|| cargo_toml.package.name.clone()); - let mut metadata = Metadata21 { - metadata_version: "2.1".to_owned(), + let mut metadata = Metadata22 { + metadata_version: "2.2".to_owned(), // Mapped from cargo metadata name, @@ -475,7 +474,7 @@ mod test { let cargo_toml_struct: CargoToml = toml::from_str(&toml_with_path).unwrap(); let metadata = - Metadata21::from_cargo_toml(&cargo_toml_struct, &readme_md.path().parent().unwrap()) + Metadata22::from_cargo_toml(&cargo_toml_struct, &readme_md.path().parent().unwrap()) .unwrap(); let actual = metadata.to_file_contents(); @@ -538,7 +537,7 @@ mod test { let expected = indoc!( r#" - Metadata-Version: 2.1 + Metadata-Version: 2.2 Name: info-project Version: 0.1.0 Classifier: Programming Language :: Python @@ -597,7 +596,7 @@ mod test { let expected = indoc!( r#" - Metadata-Version: 2.1 + Metadata-Version: 2.2 Name: info-project Version: 0.1.0 Classifier: Programming Language :: Python @@ -645,7 +644,7 @@ mod test { let expected = indoc!( r#" - Metadata-Version: 2.1 + Metadata-Version: 2.2 Name: info Version: 0.1.0 Classifier: Programming Language :: Python @@ -658,7 +657,7 @@ mod test { let cargo_toml_struct: CargoToml = toml::from_str(&cargo_toml).unwrap(); let metadata = - Metadata21::from_cargo_toml(&cargo_toml_struct, "/not/exist/manifest/path").unwrap(); + Metadata22::from_cargo_toml(&cargo_toml_struct, "/not/exist/manifest/path").unwrap(); let actual = metadata.to_file_contents(); assert_eq!( @@ -702,7 +701,7 @@ mod test { fn test_merge_metadata_from_pyproject_toml() { let cargo_toml_str = fs_err::read_to_string("test-crates/pyo3-pure/Cargo.toml").unwrap(); let cargo_toml: CargoToml = toml::from_str(&cargo_toml_str).unwrap(); - let metadata = Metadata21::from_cargo_toml(&cargo_toml, "test-crates/pyo3-pure").unwrap(); + let metadata = Metadata22::from_cargo_toml(&cargo_toml, "test-crates/pyo3-pure").unwrap(); assert_eq!( metadata.summary, Some("Implements a dummy function in Rust".to_string()) diff --git a/src/module_writer.rs b/src/module_writer.rs index 881afa8f7..c61e39555 100644 --- a/src/module_writer.rs +++ b/src/module_writer.rs @@ -3,7 +3,7 @@ use crate::build_context::ProjectLayout; use crate::PythonInterpreter; use crate::Target; -use crate::{BridgeModel, Metadata21}; +use crate::{BridgeModel, Metadata22}; use anyhow::{anyhow, bail, Context, Result}; use flate2::write::GzEncoder; use flate2::Compression; @@ -122,10 +122,10 @@ impl PathWriter { } /// Writes the RECORD file after everything else has been written - pub fn write_record(self, metadata21: &Metadata21) -> Result<()> { + pub fn write_record(self, metadata22: &Metadata22) -> Result<()> { let record_file = self .base_path - .join(metadata21.get_dist_info_dir()) + .join(metadata22.get_dist_info_dir()) .join("RECORD"); let mut buffer = File::create(&record_file).context(format!( "Failed to create a file at {}", @@ -247,13 +247,13 @@ impl WheelWriter { pub fn new( tag: &str, wheel_dir: &Path, - metadata21: &Metadata21, + metadata22: &Metadata22, tags: &[String], ) -> Result { let wheel_path = wheel_dir.join(format!( "{}-{}-{}.whl", - metadata21.get_distribution_escaped(), - metadata21.get_version_escaped(), + metadata22.get_distribution_escaped(), + metadata22.get_version_escaped(), tag )); @@ -262,11 +262,11 @@ impl WheelWriter { let mut builder = WheelWriter { zip: ZipWriter::new(file), record: Vec::new(), - record_file: metadata21.get_dist_info_dir().join("RECORD"), + record_file: metadata22.get_dist_info_dir().join("RECORD"), wheel_path, }; - write_dist_info(&mut builder, &metadata21, &tags)?; + write_dist_info(&mut builder, &metadata22, &tags)?; Ok(builder) } @@ -339,11 +339,11 @@ impl ModuleWriter for SDistWriter { impl SDistWriter { /// Create a source distribution .tar.gz which can be subsequently expanded - pub fn new(wheel_dir: impl AsRef, metadata21: &Metadata21) -> Result { + pub fn new(wheel_dir: impl AsRef, metadata22: &Metadata22) -> Result { let path = wheel_dir.as_ref().join(format!( "{}-{}.tar.gz", - &metadata21.get_distribution_escaped(), - &metadata21.get_version_escaped() + &metadata22.get_distribution_escaped(), + &metadata22.get_version_escaped() )); let tar_gz = File::create(&path)?; @@ -679,7 +679,7 @@ pub fn write_cffi_module( pub fn write_bin( writer: &mut impl ModuleWriter, artifact: &Path, - metadata: &Metadata21, + metadata: &Metadata22, bin_name: &OsStr, ) -> Result<()> { let data_dir = PathBuf::from(format!( @@ -734,28 +734,28 @@ pub fn write_python_part( /// Creates the .dist-info directory and fills it with all metadata files except RECORD pub fn write_dist_info( writer: &mut impl ModuleWriter, - metadata21: &Metadata21, + metadata22: &Metadata22, tags: &[String], ) -> Result<()> { - let dist_info_dir = metadata21.get_dist_info_dir(); + let dist_info_dir = metadata22.get_dist_info_dir(); writer.add_directory(&dist_info_dir)?; writer.add_bytes( &dist_info_dir.join("METADATA"), - metadata21.to_file_contents().as_bytes(), + metadata22.to_file_contents().as_bytes(), )?; writer.add_bytes(&dist_info_dir.join("WHEEL"), wheel_file(tags).as_bytes())?; let mut entry_points = String::new(); - if !metadata21.scripts.is_empty() { - entry_points.push_str(&entry_points_txt("console_scripts", &metadata21.scripts)); + if !metadata22.scripts.is_empty() { + entry_points.push_str(&entry_points_txt("console_scripts", &metadata22.scripts)); } - if !metadata21.gui_scripts.is_empty() { - entry_points.push_str(&entry_points_txt("gui_scripts", &metadata21.gui_scripts)); + if !metadata22.gui_scripts.is_empty() { + entry_points.push_str(&entry_points_txt("gui_scripts", &metadata22.gui_scripts)); } - for (entry_type, scripts) in &metadata21.entry_points { + for (entry_type, scripts) in &metadata22.entry_points { entry_points.push_str(&entry_points_txt(entry_type, scripts)); } if !entry_points.is_empty() { diff --git a/src/read_distribution.rs b/src/read_distribution.rs index d73a32211..5156c12b2 100644 --- a/src/read_distribution.rs +++ b/src/read_distribution.rs @@ -200,7 +200,7 @@ mod test { let metadata = get_metadata_for_distribution(Path::new("test-data/pyo3_mixed-2.1.1.tar.gz")).unwrap(); let expected: Vec<_> = [ - ("Metadata-Version", "2.1"), + ("Metadata-Version", "2.2"), ("Name", "pyo3-mixed"), ("Version", "2.1.1"), ("Summary", "Implements a dummy function combining rust and python"), diff --git a/src/source_distribution.rs b/src/source_distribution.rs index b2b3d8e5d..8dada6adb 100644 --- a/src/source_distribution.rs +++ b/src/source_distribution.rs @@ -1,5 +1,5 @@ use crate::module_writer::ModuleWriter; -use crate::{Metadata21, SDistWriter}; +use crate::{Metadata22, SDistWriter}; use anyhow::{bail, Context, Result}; use cargo_metadata::Metadata; use fs_err as fs; @@ -164,7 +164,7 @@ fn add_crate_to_source_distribution( /// https://packaging.python.org/specifications/source-distribution-format/#source-distribution-file-format pub fn source_distribution( wheel_dir: impl AsRef, - metadata21: &Metadata21, + metadata22: &Metadata22, manifest_path: impl AsRef, cargo_metadata: &Metadata, sdist_include: Option<&Vec>, @@ -185,11 +185,11 @@ pub fn source_distribution( .map(|captures| (captures[1].to_string(), captures[2].to_string())) .collect(); - let mut writer = SDistWriter::new(wheel_dir, &metadata21)?; + let mut writer = SDistWriter::new(wheel_dir, &metadata22)?; let root_dir = PathBuf::from(format!( "{}-{}", - &metadata21.get_distribution_escaped(), - &metadata21.get_version_escaped() + &metadata22.get_distribution_escaped(), + &metadata22.get_version_escaped() )); // Add local path dependencies @@ -233,7 +233,7 @@ pub fn source_distribution( writer.add_bytes( root_dir.join("PKG-INFO"), - metadata21.to_file_contents().as_bytes(), + metadata22.to_file_contents().as_bytes(), )?; let source_distribution_path = writer.finish()?; diff --git a/src/upload.rs b/src/upload.rs index 1cd5b99f2..8da561eca 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -50,7 +50,7 @@ impl From for UploadError { pub fn upload( registry: &Registry, wheel_path: &Path, - metadata21: &[(String, String)], + metadata22: &[(String, String)], supported_version: &str, ) -> Result<(), UploadError> { let mut wheel = File::open(&wheel_path)?; @@ -75,7 +75,7 @@ pub fn upload( let joined_metadata: Vec<(String, String)> = api_metadata .into_iter() // Type system shenanigans - .chain(metadata21.to_vec().into_iter()) + .chain(metadata22.to_vec().into_iter()) // All fields must be lower case and with underscores or they will be ignored by warehouse .map(|(key, value)| { let mut key = key.to_lowercase().replace("-", "_"); diff --git a/test-data/pyo3_mixed-2.1.1.tar.gz b/test-data/pyo3_mixed-2.1.1.tar.gz index b5e9c02864f2de5a9961325c40ca015f1546c496..274c48d70e2fe495e90a5653e6c4158b429e1336 100644 GIT binary patch literal 391 zcmV;20eJo&iwFQWM!sMG1MO1ZPr@(|=DB~xB|dL#Y-I+-NK^gjwdibCU_JYEW@2q{k$$ zL9rXoYB$JE7MFy)=29}VtU*VnQ!cr(88ArjbP2;;#TK~`YdH`~s1X<(GBB0ki*~FP zY33MA4c0SNaI^WilT1tpdf{p_y4|px$Kvo9_km}z5ouA^x!1~~BB#Ghu?fo;wv1vY ziJq%E#A9YMZX0j?mUCT)88d<@+i17Cgk0@*Oq!6gc)~^;hT7mWMbQyRW^;ow=E9D# l000|u!P@`; literal 403 zcmV;E0c`#siwFP!000001MSk^PunmM2k<=SuQ+MXY2zkorZUhFP=pX{5=@?P0j;@(>Spqjt?|MT=XIXR#H*y0&|gU5OP zV*iUQi$qqAMUe|pavZ;iQAFt$b9m7w@Bf(!vX((6*UGor*$MGAh|i@_6YB3qvc4Pf z<|?mWbjC=(n$U@9?vznBv?QtK*%jS(whA0el`}WmYC9v(KbfShdB-q!Hs0@e@Do}% z+Xijv+tb5$BlX>lTMnF`?L9>$NB!hmv4^Uyyl(n)lLKc1XOvv78ZIKJWf*d@i`qTd z9jfNiw<_#jT~3p)J9IC-mNx7jPtW4`%Vx##J~gsh$eE&B=Xsm{&>0ySI?ri5=rHG! x*Rku*hJR|K#=GCD3WGTQ->n4z000000000000000004kb;1LYfe-Z#F000Ad#Pa|E