summaryrefslogtreecommitdiffstats
path: root/botan/doc/scripts/update_deps.py
diff options
context:
space:
mode:
Diffstat (limited to 'botan/doc/scripts/update_deps.py')
-rw-r--r--botan/doc/scripts/update_deps.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/botan/doc/scripts/update_deps.py b/botan/doc/scripts/update_deps.py
new file mode 100644
index 0000000..61aa887
--- /dev/null
+++ b/botan/doc/scripts/update_deps.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+
+import sys
+import re
+import os.path
+
+def update_requires(dir, deps):
+ lines = map(lambda x: x.strip(),
+ open(os.path.join(dir, 'info.txt')).readlines())
+
+ if '<requires>' in lines:
+ start = lines.index('<requires>')
+
+ while lines.pop(start) != '</requires>':
+ pass
+
+ while lines[-1] == '':
+ lines = lines[:-1]
+
+ if len(deps) > 0:
+ lines.append('')
+ lines.append('<requires>')
+ for dep in deps:
+ lines.append(dep)
+ lines.append('</requires>')
+ lines.append('')
+
+ lines = "\n".join(lines).replace("\n\n\n", "\n\n")
+
+ output = open(os.path.join(dir, 'info.txt'), 'w')
+ output.write(lines)
+ output.close()
+
+def main():
+ for line in sys.stdin.readlines():
+ (dirname, deps) = line.split(':')
+ deps = deps.strip().split(' ')
+ update_requires(dirname, deps)
+
+if __name__ == '__main__':
+ sys.exit(main())