diff options
author | lloyd <[email protected]> | 2009-07-15 15:31:08 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-07-15 15:31:08 +0000 |
commit | 1172c616fa849af893c1935b8b1dee085f8aaac8 (patch) | |
tree | 48a5308fb8d40fbea9216f7007678543d7a59a4e /doc/scripts | |
parent | 6fd01228840942ad122d1adabb3f7971a4e3b244 (diff) |
Add a script that reads the output of print_deps.py and rewrites
the info.txt files with the right module dependencies.
Apply it across the codebase.
Diffstat (limited to 'doc/scripts')
-rwxr-xr-x | doc/scripts/update_deps.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/doc/scripts/update_deps.py b/doc/scripts/update_deps.py new file mode 100755 index 000000000..8bada9d7e --- /dev/null +++ b/doc/scripts/update_deps.py @@ -0,0 +1,37 @@ +#!/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 + + 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()) |