diff options
-rw-r--r-- | contrib/Makefile.am | 2 | ||||
-rwxr-xr-x | contrib/removetrailingwhitespace | 14 | ||||
-rwxr-xr-x | contrib/removetrailingwhitespace.py.in | 15 | ||||
-rwxr-xr-x | pre-commit | 4 |
4 files changed, 19 insertions, 16 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 1db5b3091..40e6d3e92 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am | |||
@@ -19,6 +19,7 @@ endif | |||
19 | noinst_SCRIPTS = \ | 19 | noinst_SCRIPTS = \ |
20 | terminate.py \ | 20 | terminate.py \ |
21 | pydiffer.py \ | 21 | pydiffer.py \ |
22 | removetrailingwhitespace.py \ | ||
22 | gnunet_pyexpect.py \ | 23 | gnunet_pyexpect.py \ |
23 | gnunet_janitor.py \ | 24 | gnunet_janitor.py \ |
24 | gnunet-chk.py | 25 | gnunet-chk.py |
@@ -52,6 +53,7 @@ EXTRA_DIST = \ | |||
52 | gnunet_pyexpect.py.in \ | 53 | gnunet_pyexpect.py.in \ |
53 | gnunet_janitor.py.in \ | 54 | gnunet_janitor.py.in \ |
54 | gnunet-chk.py.in \ | 55 | gnunet-chk.py.in \ |
56 | removetrailingwhitespace.py.in \ | ||
55 | pydiffer.py.in \ | 57 | pydiffer.py.in \ |
56 | gnunet-gns-import.sh \ | 58 | gnunet-gns-import.sh \ |
57 | openvpn-tap32/tapw32/tap0901.sys \ | 59 | openvpn-tap32/tapw32/tap0901.sys \ |
diff --git a/contrib/removetrailingwhitespace b/contrib/removetrailingwhitespace deleted file mode 100755 index 9e620cbb2..000000000 --- a/contrib/removetrailingwhitespace +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | #!/usr/bin/python | ||
2 | |||
3 | import sys | ||
4 | import re | ||
5 | |||
6 | for fileName in sys.argv[1:]: | ||
7 | f = open(fileName, 'r+') | ||
8 | fileString = f.read() | ||
9 | |||
10 | fileString = re.sub(r'[ ]+\n', r'\n', fileString) | ||
11 | fileString = re.sub(r'\r', r'', fileString) | ||
12 | f.seek(0) | ||
13 | f.write(fileString) | ||
14 | f.truncate(len(fileString)) | ||
diff --git a/contrib/removetrailingwhitespace.py.in b/contrib/removetrailingwhitespace.py.in new file mode 100755 index 000000000..5824fb591 --- /dev/null +++ b/contrib/removetrailingwhitespace.py.in | |||
@@ -0,0 +1,15 @@ | |||
1 | #!@PYTHON@ | ||
2 | |||
3 | import sys | ||
4 | import re | ||
5 | |||
6 | |||
7 | for fileName in sys.argv[1:]: | ||
8 | f = open(fileName, 'r+') | ||
9 | fileString = f.read() | ||
10 | |||
11 | fileString = re.sub(r'[ ]+\n', r'\n', fileString) | ||
12 | fileString = re.sub(r'\r', r'', fileString) | ||
13 | f.seek(0) | ||
14 | f.write(fileString) | ||
15 | f.truncate(len(fileString)) | ||
diff --git a/pre-commit b/pre-commit index 5213f2cf4..777728a6b 100755 --- a/pre-commit +++ b/pre-commit | |||
@@ -12,8 +12,8 @@ find $PATHS -name "*.c" -exec indent {} \; | |||
12 | find $PATHS -name "*.h" -exec indent {} \; | 12 | find $PATHS -name "*.h" -exec indent {} \; |
13 | find $PATHS -name "*.c" -exec indent {} \; | 13 | find $PATHS -name "*.c" -exec indent {} \; |
14 | find $PATHS -name "*.h" -exec indent {} \; | 14 | find $PATHS -name "*.h" -exec indent {} \; |
15 | find $PATHS -name "*.c" -exec contrib/removetrailingwhitespace {} \; | 15 | find $PATHS -name "*.c" -exec contrib/removetrailingwhitespace.py {} \; |
16 | find $PATHS -name "*.h" -exec contrib/removetrailingwhitespace {} \; | 16 | find $PATHS -name "*.h" -exec contrib/removetrailingwhitespace.py {} \; |
17 | if test -x "`which 'dos2unix'`" | 17 | if test -x "`which 'dos2unix'`" |
18 | then | 18 | then |
19 | find $PATHS -name "*.c" -exec dos2unix {} \; | 19 | find $PATHS -name "*.c" -exec dos2unix {} \; |