Skip to content

Commit

Permalink
Fix upload::canonicalize_name() regex subst
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
ravenexp committed Dec 10, 2021
1 parent c04de80 commit 773b3b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ fn complete_registry(opt: &PublishOpt) -> Result<Registry> {
fn canonicalize_name(name: &str) -> String {
Regex::new("[-_.]+")
.unwrap()
.replace(name, "-")
.replace_all(name, "-")
.to_lowercase()
}

Expand Down

0 comments on commit 773b3b1

Please sign in to comment.