Refactor find options. Skip venv (Python virtualenv directory.)
Chris Pressey
6 years ago
48 | 48 | _shelf_link_stuff() { |
49 | 49 | dir="$1" |
50 | 50 | subdir="$2" |
51 | find_opts="-name .git -prune -o -path Funicular/eg -prune -o -path Chrysoberyl/modules -prune -o -path Chrysoberyl/checkout -prune -o $3" | |
51 | ||
52 | exclude_dirs=".git .hg venv" | |
53 | exclude_paths="Funicular/eg Chrysoberyl/modules Chrysoberyl/checkout" | |
54 | find_opts="" | |
55 | for ed in $exclude_dirs; do | |
56 | find_opts="$find_opts -name $ed -prune -o " | |
57 | done | |
58 | for ep in $exclude_paths; do | |
59 | find_opts="$find_opts -path $ep -prune -o " | |
60 | done | |
61 | find_opts="$find_opts $3" | |
62 | _shelf_verbose "Find-opts: <<$find_opts>>" | |
63 | ||
52 | 64 | if [ "X$dir" = X ]; then |
53 | 65 | echo "Usage: _shelf_link_stuff <dir> <subdir> <find-opts>" |
54 | 66 | return 1 |
58 | 70 | base=`basename "$source"` |
59 | 71 | if [ "X$subdir" = "Xbin" ]; then |
60 | 72 | case "$base" in |
61 | *.jpg|*.png|.git|.hg|depcomp|configure|config.guess|*.h|*.so|*.so.*) | |
73 | *.jpg|*.png|.git|.hg|venv|depcomp|configure|config.guess|*.h|*.so|*.so.*) | |
62 | 74 | _shelf_verbose Skipping $base |
63 | 75 | ;; |
64 | 76 | *) |
67 | 79 | esac |
68 | 80 | elif [ "X$subdir" = "Xinclude" ]; then |
69 | 81 | case "$base" in |
70 | *.jpg|*.png|.git|.hg) | |
82 | *.jpg|*.png|.git|.hg|venv) | |
71 | 83 | _shelf_verbose Skipping $base |
72 | 84 | ;; |
73 | 85 | *) |
76 | 88 | esac |
77 | 89 | elif [ "X$subdir" = "Xlib" ]; then |
78 | 90 | case "$base" in |
79 | *.jpg|*.png|.git|.hg) | |
91 | *.jpg|*.png|.git|.hg|venv) | |
80 | 92 | _shelf_verbose Skipping $base |
81 | 93 | ;; |
82 | 94 | *) |