From e558e2b7f0a9472403bd9bd888817d234a4972b1 Mon Sep 17 00:00:00 2001 From: messense Date: Wed, 12 Jan 2022 20:26:44 +0800 Subject: [PATCH] Stop excluding `/` folder in wheel --- Changelog.md | 1 + src/build_context.rs | 6 ++---- src/module_writer.rs | 13 ++----------- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/Changelog.md b/Changelog.md index da0991e97..702a7c558 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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 diff --git a/src/build_context.rs b/src/build_context.rs index aaa4f8df3..8596b998b 100644 --- a/src/build_context.rs +++ b/src/build_context.rs @@ -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")?; } } diff --git a/src/module_writer.rs b/src/module_writer.rs index 8c80bae34..d2e082318 100644 --- a/src/module_writer.rs +++ b/src/module_writer.rs @@ -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")?; } @@ -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")?; } @@ -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, - module_name: impl AsRef, ) -> 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 {