Commits

Ned Batchelder committed f1e1b62 Merge

Automated merge with ssh://bitbucket.org/ned/coveragepy

Comments (0)

Files changed (2)

 px:
 	$(SPHINXBUILD) -b px $(SPHINXOPTS) doc/_build/px
 	rm doc/_build/px/search.px
+	python doc/_ext/px_cleaner.py doc/_build/px/*.px
 
 dochtml:
 	$(SPHINXBUILD) -b html $(SPHINXOPTS) doc/_build/html

doc/_ext/px_cleaner.py

+"""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:])
+