aboutsummaryrefslogtreecommitdiff
path: root/contrib/scripts/pydiffer.py.in
diff options
context:
space:
mode:
authorNils Gillmann <ng0@n0.is>2018-05-19 14:43:13 +0000
committerNils Gillmann <ng0@n0.is>2018-05-19 14:43:13 +0000
commit6ab60d4920bb3199aee8cd872b930e9e3e808ba7 (patch)
tree3d761dbf8793a1d2422fbd14667255c7e0292ea4 /contrib/scripts/pydiffer.py.in
parentc2f27dfe8218545c327ab49d225a49910347c5c6 (diff)
downloadgnunet-6ab60d4920bb3199aee8cd872b930e9e3e808ba7.tar.gz
gnunet-6ab60d4920bb3199aee8cd872b930e9e3e808ba7.zip
Restructure contrib folder.
contrib/pogen.sh -> bin/pogen.sh bootstrap: Use new pogen location and execute it. contrib/openvpn-tap32: Move to contrib/3rdparty/Windows/openvpn-tap32. contrib/gnunet-logo*: Move to contrib/branding/logo/ Delete old patches in contrib, predating git. Move buildbot data to contrib/ci/buildbot, move docker data to contrib/ci/docker. Create contrib/conf and populate it with config files found in contrib and bin. Move gns related data to contrib/gns. delete contrib/repeat.sh Move contrib/log.php into contrib/web/log.php. Create folder contrib/scripts and use it for most scripts in contrib. Remove trailing whitespace in doc/Makefile.am Signed-off-by: Nils Gillmann <ng0@n0.is>
Diffstat (limited to 'contrib/scripts/pydiffer.py.in')
-rw-r--r--contrib/scripts/pydiffer.py.in44
1 files changed, 44 insertions, 0 deletions
diff --git a/contrib/scripts/pydiffer.py.in b/contrib/scripts/pydiffer.py.in
new file mode 100644
index 000000000..10145371c
--- /dev/null
+++ b/contrib/scripts/pydiffer.py.in
@@ -0,0 +1,44 @@
1#!@PYTHON@
2import os
3import sys
4import difflib
5import filecmp
6
7
8def getdiff(old, new):
9 diff = []
10 with open(old) as a:
11 with open(new) as b:
12 for l in difflib.unified_diff(a.read().splitlines(), b.read().splitlines()):
13 diff.append(l)
14 return diff
15
16
17def dc_getdiff(dc, old, new):
18 diff = []
19 for f in dc.left_only:
20 diff.append("Only in {}: {}".format(old, f))
21 for f in dc.right_only:
22 diff.append("Only in {}: {}".format(new, f))
23 for f in dc.diff_files:
24 r = getdiff(os.path.join(old, f), os.path.join(new, f))
25 diff.extend(r)
26 for dn, dc in dc.subdirs.items():
27 r = dc_getdiff(dc, os.path.join(old, dn), os.path.join(new, dn))
28 diff.extend(r)
29 return diff
30
31
32def dcdiff(old, new):
33 dc = filecmp.dircmp(old, new)
34 diff = dc_getdiff(dc, old, new)
35 return diff
36
37
38def main():
39 for l in dcdiff(sys.argv[1], sys.argv[2]):
40 print(l)
41
42
43if __name__ == '__main__':
44 main()