diff --git a/Cargo.lock b/Cargo.lock index b584a2953..d039ad5e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -169,6 +169,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" +[[package]] +name = "bstr" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +dependencies = [ + "memchr", +] + [[package]] name = "bumpalo" version = "3.8.0" @@ -370,6 +379,16 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +dependencies = [ + "cfg-if 1.0.0", + "lazy_static", +] + [[package]] name = "crypto-mac" version = "0.10.1" @@ -669,6 +688,19 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +[[package]] +name = "globset" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + [[package]] name = "goblin" version = "0.4.3" @@ -851,6 +883,24 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "ignore" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d" +dependencies = [ + "crossbeam-utils", + "globset", + "lazy_static", + "log", + "memchr", + "regex", + "same-file", + "thread_local", + "walkdir", + "winapi-util", +] + [[package]] name = "indexmap" version = "1.7.0" @@ -967,6 +1017,7 @@ dependencies = [ "glob", "goblin", "human-panic", + "ignore", "indoc", "keyring", "once_cell", @@ -988,7 +1039,6 @@ dependencies = [ "textwrap 0.14.2", "thiserror", "toml", - "walkdir", "zip", ] @@ -1892,6 +1942,15 @@ dependencies = [ "syn", ] +[[package]] +name = "thread_local" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +dependencies = [ + "once_cell", +] + [[package]] name = "time" version = "0.1.43" diff --git a/Cargo.toml b/Cargo.toml index 7688bc2ec..3dabd953a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 } @@ -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" diff --git a/src/module_writer.rs b/src/module_writer.rs index eee400cf3..652acfdd5 100644 --- a/src/module_writer.rs +++ b/src/module_writer.rs @@ -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 @@ -771,7 +770,9 @@ pub fn write_python_part( python_module: impl AsRef, module_name: impl AsRef, ) -> 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())?;