summaryrefslogtreecommitdiff
path: root/dist/s_whitespace
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2015-08-20 09:11:14 -0400
committerKeith Bostic <keith@wiredtiger.com>2015-08-20 09:11:14 -0400
commit5880ee9b58e0278f8122a06398da889ccf3afd31 (patch)
treea151dcff5120c04d49b8b87d4b37a485f5254f73 /dist/s_whitespace
parentb83b901de7d3340c571f396dcedc983d68d37d9a (diff)
downloadmongo-5880ee9b58e0278f8122a06398da889ccf3afd31.tar.gz
Python, whitespace cleanup.
Diffstat (limited to 'dist/s_whitespace')
-rwxr-xr-xdist/s_whitespace23
1 files changed, 20 insertions, 3 deletions
diff --git a/dist/s_whitespace b/dist/s_whitespace
index 3a51b251bfe..dfc031e3ea4 100755
--- a/dist/s_whitespace
+++ b/dist/s_whitespace
@@ -4,7 +4,16 @@
t=__wt.$$
trap 'rm -f $t; exit 0' 0 1 2 3 13 15
-ws()
+# Clear lines that only contain whitespace.
+whitespace()
+{
+ sed -e 's/[ ][ ]*$//' < $1 > $t
+ cmp $t $1 > /dev/null 2>&1 || (echo "$1" && cp $t $1)
+}
+
+# Clear lines that only contain whitespace, compress multiple empty lines
+# into a single line, discarding trailing empty lines.
+whitespace_and_empty_line()
{
sed -e 's/[ ][ ]*$//' \
-e '/^$/N' \
@@ -14,10 +23,12 @@ ws()
cd ..
+# Scripts.
for f in `find dist -name '*.py' -name 's_*'`; do
- ws $f
+ whitespace_and_empty_line $f
done
+# C-language sources.
for f in `find examples ext src test \
-name '*.[chi]' -o \
-name '*.dox' -o \
@@ -26,5 +37,11 @@ for f in `find examples ext src test \
if expr "$f" : ".*/Makefile.in" > /dev/null; then
continue
fi
- ws $f
+ whitespace_and_empty_line $f
+done
+
+# Python sources.
+for f in `find test \
+ -name '*.py' | sed '/3rdparty/d'`; do
+ whitespace $f
done