Skip to content

Commit

Permalink
lock
Browse files Browse the repository at this point in the history
  • Loading branch information
vmchale committed Apr 22, 2018
1 parent 380c428 commit 7b88b47
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
27 changes: 11 additions & 16 deletions src/walk_parallel/mod.rs
Expand Up @@ -3,22 +3,22 @@ extern crate walkdir;

pub mod single_threaded;

use std::sync::Arc;
use std::sync::atomic::{Ordering};
use std::fs;
use std::sync::atomic::Ordering;
use std::sync::Arc;

use self::crossbeam::sync::chase_lev;
use self::walkdir::WalkDir;
use colored::*;
use error::*;
use regex::{Regex, RegexSet};
use std::ffi::OsStr;
use std::path::Path;
use std::path::PathBuf;
use colored::*;
use std::process::exit;
use utils::size;
use std::thread;
use error::*;
use std::ffi::OsStr;
use types::FileSize;
use std::path::Path;
use utils::size;

pub use walk_parallel::single_threaded::*;

Expand All @@ -29,7 +29,7 @@ pub use walk_parallel::single_threaded::*;
use std::sync::atomic::AtomicUsize as AtomicU64;

#[cfg(target_pointer_width = "64")]
fn as_u64(x: usize) -> u64{
fn as_u64(x: usize) -> u64 {
x as u64
}

Expand All @@ -38,8 +38,6 @@ fn as_usize(x: u64) -> usize {
x as usize
}



/// Enum for messaging between workers/stealers
pub enum Status<T> {
Done,
Expand Down Expand Up @@ -301,8 +299,7 @@ impl Walk {
fn ats_cgen(p: Option<&OsStr>) -> bool {
lazy_static! {
static ref DATS_C: Regex =
Regex::new(r"(_(d|h)ats\.c|_lats\.dats|_sats\.c|_stub\.h)$")
.unwrap();
Regex::new(r"(_(d|h)ats\.c|_lats\.dats|_sats\.c|_stub\.h)$").unwrap();
}
match p {
Some(p) => DATS_C.is_match(&p.to_string_lossy().to_string()),
Expand All @@ -312,9 +309,7 @@ fn ats_cgen(p: Option<&OsStr>) -> bool {

fn latex_log<P: AsRef<Path>>(p: P) -> bool {
lazy_static! {
static ref LOG: Regex =
Regex::new(r"\.log$")
.unwrap();
static ref LOG: Regex = Regex::new(r"\.log$").unwrap();
}

if LOG.is_match(&p.as_ref().to_string_lossy().to_string()) {
Expand All @@ -335,7 +330,7 @@ fn latex_log<P: AsRef<Path>>(p: P) -> bool {
pub fn clean_project_dirs<P: AsRef<Path>>(p: P, exclude: Option<Regex>, _: bool) -> () {
lazy_static! {
static ref REGEX: Regex =
Regex::new(r"\.(a|la|lo|o|keter|bc|dyn_o|d|rlib|crate|hi|hc|dyn_hi|S|jsexe|webapp|js\.externs|ibc|toc|aux|fdb_latexmk|fls|egg-info|whl|js_a|js_hi|jld|ji|js_o|so.*|dump-.*|vmb|crx|orig|elmo|elmi|hspec-failures|pyc|mod|vo|beam|agdai|go\.(v|teak|xmldef|rewrittenast|rewrittengo|simplego|tree-(bind|eval|finish|parse))|p_hi|p_o|prof|hide-cache|ghc\.environment\..*-\d.\d.\d|tix|synctex\.gz|hl|sandbox\.config)$")
Regex::new(r"\.(a|la|lo|o|keter|bc|dyn_o|d|rlib|crate|hi|hc|dyn_hi|S|jsexe|webapp|js\.externs|ibc|toc|aux|fdb_latexmk|fls|egg-info|whl|js_a|js_hi|jld|ji|js_o|so.*|dump-.*|vmb|crx|orig|elmo|elmi|hspec-failures|pyc|mod|vo|beam|agdai|go\.(v|teak|xmldef|rewrittenast|rewrittengo|simplego|tree-(bind|eval|finish|parse))|p_hi|p_o|prof|hide-cache|ghc\.environment\..*-\d.\d.\d|tix|synctex\.gz|hl|sandbox\.config|hp|eventlog)$")
.unwrap();
}

Expand Down
20 changes: 10 additions & 10 deletions src/walk_parallel/single_threaded.rs
@@ -1,16 +1,16 @@
extern crate glob;

use std::fs;
use self::glob::glob;
use colored::*;
use error::*;
use regex::{Regex, RegexSet};
use utils::*;
use std::fs;
use std::fs::Metadata;
use std::path::PathBuf;
use colored::*;
use std::process::exit;
use types::*;
use std::fs::Metadata;
use error::*;
use self::glob::glob;
use std::result::Result;
use types::*;
use utils::*;

#[cfg(not(target_os = "windows"))]
use std::os::unix::fs::PermissionsExt;
Expand Down Expand Up @@ -145,6 +145,7 @@ pub fn is_project_dir(p: &str, name: &str) -> bool {
/// - `.ji`, `.jld`: julia
/// - `.exe`: Windows executable
/// - `.sandbox.config`: Cabal sandbox configuration
/// - `.eventlog`: GHC event log
pub fn is_artifact(
path_str: &str,
full_path: &str,
Expand All @@ -154,15 +155,14 @@ pub fn is_artifact(
) -> bool {
lazy_static! {
static ref REGEX_GITIGNORE: Regex =
Regex::new(r"\.(stats|conf|h|c|out|cache.*|dat|pc|info|ll|js)$")
.unwrap();
Regex::new(r"\.(stats|conf|h|c|out|cache.*|dat|pc|info|ll|js)$").unwrap();
}

// otherwise, use builtin expressions
{
lazy_static! {
static ref REGEX: Regex =
Regex::new(r"\.(a|la|lo|o|keter|bc|dyn_o|d|rlib|crate|hi|hc|dyn_hi|S|jsexe|webapp|js\.externs|ibc|toc|aux|fdb_latexmk|fls|egg-info|whl|js_a|js_hi|jld|ji|js_o|so.*|dump-.*|vmb|crx|orig|elmo|elmi|hspec-failures|pyc|vo|agdai|beam|mod|go\.(v|teak|xmldef|rewrittenast|rewrittengo|simplego|tree-(bind|eval|finish|parse))|p_hi|p_o|prof|hide-cache|ghc\.environment\..*-\d.\d.\d|tix|synctex\.gz|hl|sandbox\.config|exe)$")
Regex::new(r"\.(a|la|lo|o|keter|bc|dyn_o|d|rlib|crate|hi|hc|dyn_hi|S|jsexe|webapp|js\.externs|ibc|toc|aux|fdb_latexmk|fls|egg-info|whl|js_a|js_hi|jld|ji|js_o|so.*|dump-.*|vmb|crx|orig|elmo|elmi|hspec-failures|pyc|vo|agdai|beam|mod|go\.(v|teak|xmldef|rewrittenast|rewrittengo|simplego|tree-(bind|eval|finish|parse))|p_hi|p_o|prof|hide-cache|ghc\.environment\..*-\d.\d.\d|tix|synctex\.gz|hl|hp|sandbox\.config|exe|eventlog)$")
.unwrap();
}

Expand Down

0 comments on commit 7b88b47

Please sign in to comment.