Skip to content

Commit

Permalink
Merge pull request #772 from messense/fix-771
Browse files Browse the repository at this point in the history
Stop excluding `<module_name>/<module_name>` folder in wheel
  • Loading branch information
messense authored Jan 13, 2022
2 parents 2860914 + e558e2b commit 804d22a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
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

* Add support for using [`zig cc`](https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html) as linker for easier cross compiling and manylinux compliance in [#756](https://github.com/PyO3/maturin/pull/756)
* Switch from reqwest to ureq to reduce dependencies in [#767](https://github.com/PyO3/maturin/pull/767)
* Fix missing Python submodule in wheel in [#772](https://github.com/PyO3/maturin/pull/772)

## [0.12.6] - 2021-12-31

Expand Down
6 changes: 2 additions & 4 deletions src/build_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,12 +611,10 @@ impl BuildContext {

match self.project_layout {
ProjectLayout::Mixed {
ref python_module,
ref extension_name,
..
ref python_module, ..
} => {
if !self.editable {
write_python_part(&mut writer, python_module, extension_name)
write_python_part(&mut writer, python_module)
.context("Failed to add the python module to the package")?;
}
}
Expand Down
13 changes: 2 additions & 11 deletions src/module_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ pub fn write_bindings_module(
..
} => {
if !editable {
write_python_part(writer, python_module, &module_name)
write_python_part(writer, python_module)
.context("Failed to add the python module to the package")?;
}

Expand Down Expand Up @@ -695,7 +695,7 @@ pub fn write_cffi_module(
ref extension_name,
} => {
if !editable {
write_python_part(writer, python_module, &module_name)
write_python_part(writer, python_module)
.context("Failed to add the python module to the package")?;
}

Expand Down Expand Up @@ -767,24 +767,15 @@ pub fn write_bin(
}

/// Adds the python part of a mixed project to the writer,
/// excluding older versions of the native library or generated cffi declarations
pub fn write_python_part(
writer: &mut impl ModuleWriter,
python_module: impl AsRef<Path>,
module_name: impl AsRef<Path>,
) -> Result<()> {
use ignore::WalkBuilder;

for absolute in WalkBuilder::new(&python_module).hidden(false).build() {
let absolute = absolute?.into_path();

let relative = absolute.strip_prefix(python_module.as_ref().parent().unwrap())?;

// Ignore the cffi folder from develop, if any
if relative.starts_with(module_name.as_ref().join(&module_name)) {
continue;
}

if absolute.is_dir() {
writer.add_directory(relative)?;
} else {
Expand Down

0 comments on commit 804d22a

Please sign in to comment.