diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2011-02-12 23:08:22 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2011-02-12 23:08:22 -0500 |
commit | 45dc1dacb7f9af89dcb841692c3a92253b40a75d (patch) | |
tree | 603aa390bc7feb80d8efde1a697d1629c2790cb0 /doc | |
parent | 2419ccf5218042b6caf9e972873d4815490c2690 (diff) | |
download | python-coveragepy-git-45dc1dacb7f9af89dcb841692c3a92253b40a75d.tar.gz |
New sphinx adds a blank line before the xml declaration, this micro-tool strips it off.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/_ext/px_cleaner.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/_ext/px_cleaner.py b/doc/_ext/px_cleaner.py new file mode 100644 index 00000000..a5c00ff3 --- /dev/null +++ b/doc/_ext/px_cleaner.py @@ -0,0 +1,26 @@ +"""Clean up .px files created by Sphinx.""" + +import sys + +def clean_px(fname): + """Clean a px file.""" + + f = open(fname) + try: + text = f.read() + finally: + f.close() + text = text.lstrip() + f = open(fname, "w") + try: + f.write(text) + finally: + f.close() + +def clean_px_files(fnames): + for fname in fnames: + clean_px(fname) + +if __name__ == '__main__': + clean_px_files(sys.argv[1:]) + |