diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-07-16 11:57:41 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-07-16 11:57:41 -0400 |
commit | ff08be82e20706a0e019484c83faa72c2e2f4d03 (patch) | |
tree | b932eb8704784683e4f310e0d3611e75623f6c48 /igor.py | |
parent | d6844a2fd49a2a807399f16981a7b501c527b5e0 (diff) | |
download | python-coveragepy-git-ff08be82e20706a0e019484c83faa72c2e2f4d03.tar.gz |
Make igor.py fully py3 compatible, and further generalize the deletion of C extensions.
Diffstat (limited to 'igor.py')
-rw-r--r-- | igor.py | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -6,6 +6,7 @@ of in shell scripts, batch files, or Makefiles. """ import fnmatch +import glob import os import sys import zipfile @@ -13,16 +14,18 @@ import zipfile def do_remove_extension(args): """Remove the compiled C extension, no matter what its name.""" - so_names = """ + so_patterns = """ tracer.so - tracer.cpython-32m.so + tracer.*.so """.split() - for filename in so_names: - try: - os.remove(os.path.join("coverage", filename)) - except OSError: - pass + for pattern in so_patterns: + pattern = os.path.join("coverage", pattern) + for filename in glob.glob(pattern): + try: + os.remove(filename) + except OSError: + pass def do_test_with_tracer(args): """Run nosetests with a particular tracer.""" @@ -45,12 +48,12 @@ def do_check_eol(args): for n, line in enumerate(open(fname, "rb")): if crlf: if "\r" in line: - print "%s@%d: CR found" % (fname, n+1) + print("%s@%d: CR found" % (fname, n+1)) return if trail_white: line = line[:-1] if line.rstrip() != line: - print "%s@%d: trailing whitespace found" % (fname, n+1) + print("%s@%d: trailing whitespace found" % (fname, n+1)) return def check_files(root, patterns, **kwargs): |