diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2011-02-12 23:08:28 -0500 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2011-02-12 23:08:28 -0500 |
| commit | 5bf8e0a10cc8a7ab8a09636777e0080386f38bc1 (patch) | |
| tree | 18ee8d3ab68dec92490b5ff5297369a32044097f /doc/_ext/px_cleaner.py | |
| parent | 12c3dd51679344f4173e82552af7515db46453ee (diff) | |
| parent | 45dc1dacb7f9af89dcb841692c3a92253b40a75d (diff) | |
| download | python-coveragepy-git-5bf8e0a10cc8a7ab8a09636777e0080386f38bc1.tar.gz | |
Automated merge with ssh://bitbucket.org/ned/coveragepy
Diffstat (limited to 'doc/_ext/px_cleaner.py')
| -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:]) + |
