Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/build_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
14 changes: 10 additions & 4 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Comment thread
artob marked this conversation as resolved.
}
Comment thread
artob marked this conversation as resolved.

/// Returns the version encoded according to PEP 427, Section "Escaping
Expand Down
Loading