Skip to content

Commit

Permalink
Add support for excluding files from wheels by .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Nov 22, 2021
1 parent 1e9fb50 commit 00b226d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 4 deletions.
61 changes: 60 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ structopt = "0.3.21"
tar = "0.4.33"
tempfile = "3.2.0"
toml = "0.5.8"
walkdir = "2.3.1"
zip = "0.5.5"
thiserror = "1.0.24"
dirs = { version = "4.0.0", optional = true }
Expand All @@ -58,6 +57,7 @@ target-lexicon = "0.12.0"
pyproject-toml = "0.3.0"
python-pkginfo = "0.5.0"
textwrap = "0.14.2"
ignore = "0.4.18"

[dev-dependencies]
indoc = "1.0.3"
Expand Down
5 changes: 3 additions & 2 deletions src/module_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use std::path::{Path, PathBuf};
use std::process::{Command, Output};
use std::str;
use tempfile::{tempdir, TempDir};
use walkdir::WalkDir;
use zip::{self, ZipWriter};

/// Allows writing the module to a wheel or add it directly to the virtualenv
Expand Down Expand Up @@ -771,7 +770,9 @@ pub fn write_python_part(
python_module: impl AsRef<Path>,
module_name: impl AsRef<Path>,
) -> Result<()> {
for absolute in WalkDir::new(&python_module) {
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())?;
Expand Down

0 comments on commit 00b226d

Please sign in to comment.