summaryrefslogtreecommitdiff
path: root/checkeol.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-03-05 21:21:43 -0500
committerNed Batchelder <ned@nedbatchelder.com>2009-03-05 21:21:43 -0500
commit0cc8fd18714cb214327a0a58b704401a9efdf8dc (patch)
tree0a6ac59eaf1b7acaf26053a5f3c69304b9ddbda3 /checkeol.py
downloadpython-coveragepy-git-0cc8fd18714cb214327a0a58b704401a9efdf8dc.tar.gz
Initial coverage.py 3.0 beta 1
Diffstat (limited to 'checkeol.py')
-rw-r--r--checkeol.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/checkeol.py b/checkeol.py
new file mode 100644
index 00000000..65843eec
--- /dev/null
+++ b/checkeol.py
@@ -0,0 +1,24 @@
+# Check files for incorrect newlines
+
+import fnmatch, os
+
+def check_file(fname):
+ for n, line in enumerate(open(fname, "rb")):
+ if "\r" in line:
+ print "%s@%d: CR found" % (fname, n)
+ return
+
+def check_files(root, patterns):
+ for root, dirs, files in os.walk(root):
+ for f in files:
+ fname = os.path.join(root, f)
+ for p in patterns:
+ if fnmatch.fnmatch(fname, p):
+ check_file(fname)
+ break
+ if '.svn' in dirs:
+ dirs.remove('.svn')
+
+check_files("coverage", ["*.py"])
+check_files("test", ["*.py"])
+check_file("setup.py")