diff --git a/src/build_context.rs b/src/build_context.rs index 9f302189d..f0fd4aecd 100644 --- a/src/build_context.rs +++ b/src/build_context.rs @@ -1035,14 +1035,6 @@ impl BuildContext { if self.target.is_wasi() { eprintln!("⚠️ Warning: wasi support is experimental"); - // escaped can contain [\w\d.], but i don't know how we'd handle dots correctly here - if self.metadata24.get_distribution_escaped().contains('.') { - bail!( - "Can't build wasm wheel if there is a dot in the name ('{}')", - self.metadata24.get_distribution_escaped() - ) - } - if !self.metadata24.entry_points.is_empty() { bail!("You can't define entrypoints yourself for a binary project"); } diff --git a/src/metadata.rs b/src/metadata.rs index 345ebe333..bf01eec81 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -652,11 +652,17 @@ impl Metadata24 { Ok(out) } - /// Returns the distribution name according to PEP 427, Section "Escaping - /// and Unicode" + /// Returns the distribution name normalized according to the PyPA Binary + /// Distribution Format specification. + /// + /// This is the name that will be used in the wheel filename and for the + /// `.dist-info` directory name. It is also the name that will be used in + /// the source distribution (sdist) filename. + /// + /// See https://packaging.python.org/en/latest/specifications/binary-distribution-format/#escaping-and-unicode pub fn get_distribution_escaped(&self) -> String { - let re = Regex::new(r"[^\w\d.]+").unwrap(); - re.replace_all(&self.name, "_").to_string() + let re = Regex::new(r"[-_.]+").unwrap(); + re.replace_all(&self.name, "_").to_lowercase() } /// Returns the version encoded according to PEP 427, Section "Escaping