-
Notifications
You must be signed in to change notification settings - Fork 84
/
foreach.sh
executable file
·48 lines (45 loc) · 1.44 KB
/
foreach.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Run a command for each of our packages
set -ef
QUIET=0
if [ "$1" = '--quiet' ]; then
QUIET=1
shift
fi
if [ "$1" = '--changed' ]; then
shift
# Package list, filtered to ones changed since last tag
LAST_TAG=$(git tag -l v\* | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | tail -1)
PACKAGES=$(git diff --name-only ${LAST_TAG} | grep pytest- | cut -d'/' -f1 | sort | uniq)
else
# Package list, in order of ancestry
# removed pytest-qt-app
DEFAULT_PACKAGES="pytest-fixture-config \
pytest-shutil \
pytest-server-fixtures \
pytest-pyramid-server \
pytest-devpi-server \
pytest-listener \
pytest-svn \
pytest-git \
pytest-virtualenv \
pytest-webdriver \
pytest-profiling \
pytest-verbose-parametrize"
PACKAGES="${PACKAGES:-$DEFAULT_PACKAGES}"
fi
for pkg in $PACKAGES; do
export PKG=$pkg
(cd $pkg
if [ $QUIET -eq 1 ]; then
bash -c "$*"
else
echo "-----------------------------------------------------"
echo " $pkg"
echo "-----------------------------------------------------"
echo
bash -x -c "$*"
echo
fi
)
done