Skip to content

Commit

Permalink
Stop excluding <module_name>/<module_name> folder in wheel
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Jan 12, 2022
1 parent 2860914 commit e66de62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
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 e66de62

Please sign in to comment.