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
5 changes: 5 additions & 0 deletions maturin.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@
"type": "string",
"const": "check"
},
{
"description": "Audit wheel and warn about external libraries, but do not fail or repair",
"type": "string",
"const": "warn"
},
{
"description": "Don't check for manylinux compliance",
"type": "string",
Expand Down
3 changes: 3 additions & 0 deletions src/auditwheel/audit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pub enum AuditWheelMode {
Repair,
/// Check wheel for manylinux compliance, but do not repair
Check,
/// Audit wheel and warn about external libraries, but do not fail or repair
Warn,
/// Don't check for manylinux compliance
Skip,
}
Expand All @@ -23,6 +25,7 @@ impl fmt::Display for AuditWheelMode {
match self {
AuditWheelMode::Repair => write!(f, "repair"),
AuditWheelMode::Check => write!(f, "check"),
AuditWheelMode::Warn => write!(f, "warn"),
AuditWheelMode::Skip => write!(f, "skip"),
}
}
Expand Down
18 changes: 12 additions & 6 deletions src/build_context/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl BuildContextBuilder {
}

let (strip, include_debuginfo, auditwheel) =
Self::resolve_build_flags(strip, &build_options, pyproject);
Self::resolve_build_flags(strip, &build_options, pyproject, &target);

let sbom = Self::resolve_sbom_config(&build_options, pyproject);

Expand Down Expand Up @@ -319,6 +319,7 @@ impl BuildContextBuilder {
strip: Option<bool>,
build_options: &BuildOptions,
pyproject: Option<&PyProjectToml>,
target: &Target,
) -> (bool, bool, AuditWheelMode) {
let strip = strip.unwrap_or_else(|| pyproject.map(|x| x.strip()).unwrap_or_default());
let include_debuginfo = if strip && build_options.output.include_debuginfo {
Expand All @@ -331,15 +332,20 @@ impl BuildContextBuilder {
};
let skip_auditwheel = pyproject.map(|x| x.skip_auditwheel()).unwrap_or_default()
|| build_options.platform.skip_auditwheel;
let default_mode = if skip_auditwheel {
AuditWheelMode::Skip
} else if target.is_linux() {
AuditWheelMode::Repair
} else {
// macOS and Windows repair support is newer;
// default to Warn so we don't break existing workflows.
AuditWheelMode::Warn
};
let auditwheel = build_options
.platform
.auditwheel
.or_else(|| pyproject.and_then(|x| x.auditwheel()))
.unwrap_or(if skip_auditwheel {
AuditWheelMode::Skip
} else {
AuditWheelMode::Repair
});
.unwrap_or(default_mode);
(strip, include_debuginfo, auditwheel)
}

Expand Down
20 changes: 15 additions & 5 deletions src/build_context/repair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,21 @@ impl BuildContext {
}
}

if matches!(self.python.auditwheel, AuditWheelMode::Check) {
bail!(
"Your library requires copying the above external libraries. \
Re-run with `--auditwheel=repair` to copy them."
);
match self.python.auditwheel {
AuditWheelMode::Warn => {
eprintln!(
"⚠️ Warning: Your library requires copying the above external libraries. \
Re-run with `--auditwheel=repair` to copy them into the wheel."
);
return Ok(());
}
AuditWheelMode::Check => {
bail!(
"Your library requires copying the above external libraries. \
Re-run with `--auditwheel=repair` to copy them."
);
}
_ => {}
}

let repairer = self
Expand Down
1 change: 1 addition & 0 deletions tests/cmd/build.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Options:
Possible values:
- repair: Audit and repair wheel for manylinux compliance
- check: Check wheel for manylinux compliance, but do not repair
- warn: Audit wheel and warn about external libraries, but do not fail or repair
- skip: Don't check for manylinux compliance

--zig
Expand Down
1 change: 1 addition & 0 deletions tests/cmd/publish.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Options:
Possible values:
- repair: Audit and repair wheel for manylinux compliance
- check: Check wheel for manylinux compliance, but do not repair
- warn: Audit wheel and warn about external libraries, but do not fail or repair
- skip: Don't check for manylinux compliance

--zig
Expand Down
Loading