From 773b3b134009e779ddb5fad9be7f00c1f8c2761b Mon Sep 17 00:00:00 2001 From: Sergey Kvachonok Date: Fri, 10 Dec 2021 15:07:16 +0300 Subject: [PATCH] Fix `upload::canonicalize_name()` regex subst Python `Pattern.sub()` corresponds to Rust `Regex::replace_all()`, not `Regex::replace()`. This fixes a bug where the same Python package `a_b_c` is uploaded as both `a-b-c` (wheel) and `a-b_c` (sdist). --- Changelog.md | 1 + src/upload.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index f0577c0c7..76fd6f9fc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fix docs for `new` and `init` commands in `maturin --help` in [#734](https://github.com/PyO3/maturin/pull/734) * Add support for x86_64 Haiku in [#735](https://github.com/PyO3/maturin/pull/735) +* Fix sdist upload for packages where the pkgname contains multiple underscores in [#741](https://github.com/PyO3/maturin/pull/741) ## [0.12.4] - 2021-12-06 diff --git a/src/upload.rs b/src/upload.rs index a7c8c7caf..f9342f316 100644 --- a/src/upload.rs +++ b/src/upload.rs @@ -198,7 +198,7 @@ fn complete_registry(opt: &PublishOpt) -> Result { fn canonicalize_name(name: &str) -> String { Regex::new("[-_.]+") .unwrap() - .replace(name, "-") + .replace_all(name, "-") .to_lowercase() }