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

Stop excluding <module_name>/<module_name> folder in wheel #772

Merged
merged 1 commit into from
Jan 13, 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 @@ -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