summaryrefslogtreecommitdiff
path: root/sandbox/grubert/split-test-txt.py
diff options
context:
space:
mode:
authorwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-08-17 13:59:12 +0000
committerwiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2005-08-17 13:59:12 +0000
commita4bc0d09f3d1f633a5780976d1f913e083c9564a (patch)
tree1777475e88463b08438f0719be97cc087554eadd /sandbox/grubert/split-test-txt.py
parent60c69f8cf97125135948a3d35b7698ee80921137 (diff)
parent2818db9a234cc37008c5f2bb0e821f9b1fa92de2 (diff)
downloaddocutils-0.3.9.tar.gz
re-added docutils-0.3.9 tag one level deeper (without web/ and sandboxes/)docutils-0.3.9
git-svn-id: http://svn.code.sf.net/p/docutils/code/tags/docutils-0.3.9@3815 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'sandbox/grubert/split-test-txt.py')
-rw-r--r--sandbox/grubert/split-test-txt.py61
1 files changed, 0 insertions, 61 deletions
diff --git a/sandbox/grubert/split-test-txt.py b/sandbox/grubert/split-test-txt.py
deleted file mode 100644
index 81cb1fd84..000000000
--- a/sandbox/grubert/split-test-txt.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/python
-
-"""
-Author: grubert@users.sourceforge.net
-Revision: $Revision$
-
-Split docutils/tools/test.txt up to test one by one.
-"""
-
-import sys, os, os.path
-
-if len(sys.argv)>1:
- test_filename = sys.argv[1]
-else:
- # run from sandbox subdirectory.
- test_filename = "../../tools/test.txt"
-
-if not os.path.exists(test_filename):
- print "Testfile not found:", test_filename
- sys.exit()
-
-print "Using file:", test_filename
-
-class Output:
- def __init__(self,test_dir="test"):
- self._file = 0
- self._file_cnt = 0
- self._test_dir = test_dir
- self._test_file = "from_test_txt"
- def close(self):
- if self._file:
- self._file.close()
- def next_file(self):
- self.close()
- self._file_cnt += 1
- self._file = open("%s/%s-%02d.txt.new"
- %(self._test_dir,self._test_file,self._file_cnt),"w")
- def write_line(self,str):
- self._file.write(str+"\n")
- def get_count(self):
- return self._file_cnt
-
-out = Output()
-out.next_file()
-
-line_before = -1
-section_one = 1 # header plus first section into first file
-for line in open(test_filename).readlines():
- line = line.rstrip() # remove end of line
- # we split on "------" sections.
- if ((len(line)>0)and(line == "-"*(len(line)))and(len(line)==len(line_before))):
- if not section_one:
- out.next_file()
- print section_one,line_before,line
- section_one = 0
- if not (type(line_before)==type(-1)):
- # special treatment of start block
- out.write_line(line_before)
- line_before = line
-
-out.close()