Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix auditwheel bundled shared libs directory name #969

Merged
merged 1 commit into from
Jun 15, 2022
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
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Add `--find-interpreter` option to `build` and `publish` commands to search for python interpreters in [#964](https://github.com/PyO3/maturin/pull/964)
* Add support for Linux armv6l in [#966](https://github.com/PyO3/maturin/pull/966)
* Infer target triple from `ARCHFLAGS` for macOS to be compatible with `cibuildwheel` in [#967](https://github.com/PyO3/maturin/pull/967)
* Fix auditwheel bundled shared libs directory name in [#969](https://github.com/PyO3/maturin/pull/969)

## [0.12.19] - 2022-06-05

Expand Down
11 changes: 9 additions & 2 deletions src/build_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl ProjectLayout {
Cow::Owned(project_root.join(py_src))
});
let (python_module, rust_module, extension_name) = if parts.len() > 1 {
let mut rust_module = project_root.to_path_buf();
let mut rust_module = python_root.to_path_buf();
rust_module.extend(&parts[0..parts.len() - 1]);
(
python_root.join(parts[0]),
Expand Down Expand Up @@ -337,7 +337,14 @@ impl BuildContext {
}
// Put external libs to ${module_name}.libs directory
// See https://github.com/pypa/auditwheel/issues/89
let libs_dir = PathBuf::from(format!("{}.libs", self.module_name));
let mut libs_dir = self
.project_layout
.python_module
.as_ref()
.and_then(|py| py.file_name().map(|s| s.to_os_string()))
.unwrap_or_else(|| self.module_name.clone().into());
libs_dir.push(".libs");
let libs_dir = PathBuf::from(libs_dir);
writer.add_directory(&libs_dir)?;

let temp_dir = tempfile::tempdir()?;
Expand Down
1 change: 1 addition & 0 deletions test-crates/pyo3-mixed-py-subdir/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ crate-type = ["cdylib"]

[package.metadata.maturin]
python-source = "python"
name = "pyo3_mixed_py_subdir._pyo3_mixed"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .python_module.double import double
from .pyo3_mixed_py_subdir import get_21
from ._pyo3_mixed import get_21


def get_42() -> int:
Expand Down
2 changes: 1 addition & 1 deletion test-crates/pyo3-mixed-py-subdir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn get_21() -> usize {
}

#[pymodule]
fn pyo3_mixed_py_subdir(_py: Python, m: &PyModule) -> PyResult<()> {
fn _pyo3_mixed(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_wrapped(wrap_pyfunction!(get_21))?;

Ok(())
Expand Down