diff options
author | Tim Peters <tim.peters@gmail.com> | 2004-10-03 19:03:19 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2004-10-03 19:03:19 (GMT) |
commit | 130e37f3e263af29de31d75170ff665ec3ab076b (patch) | |
tree | 362c30d4cf4ad2a315253b78bc001ee682bf2f59 | |
parent | ab9b32c0778655db5d2bf3f4c34d3a205d87a1af (diff) | |
download | cpython-130e37f3e263af29de31d75170ff665ec3ab076b.zip cpython-130e37f3e263af29de31d75170ff665ec3ab076b.tar.gz cpython-130e37f3e263af29de31d75170ff665ec3ab076b.tar.bz2 |
Read the text files to be compared in universal-newline mode.
-rw-r--r-- | Misc/NEWS | 6 | ||||
-rw-r--r-- | Tools/scripts/diff.py | 4 | ||||
-rwxr-xr-x | Tools/scripts/ndiff.py | 2 |
3 files changed, 8 insertions, 4 deletions
@@ -157,7 +157,11 @@ New platforms Tools/Demos ----------- -... +- The text file comparison scripts ``ndiff.py`` and ``diff.py`` now + read the input files in universal-newline mode. This spares them + from consuming a great deal of time to deduce the useless result that, + e.g., a file with Windows line ends and a file with Linux line ends + have no lines in common. What's New in Python 2.4 alpha 3? diff --git a/Tools/scripts/diff.py b/Tools/scripts/diff.py index 05bfc25..52dcab1 100644 --- a/Tools/scripts/diff.py +++ b/Tools/scripts/diff.py @@ -31,8 +31,8 @@ def main(): fromdate = time.ctime(os.stat(fromfile).st_mtime) todate = time.ctime(os.stat(tofile).st_mtime) - fromlines = open(fromfile).readlines() - tolines = open(tofile).readlines() + fromlines = open(fromfile, 'U').readlines() + tolines = open(tofile, 'U').readlines() if options.u: diff = difflib.unified_diff(fromlines, tolines, fromfile, tofile, fromdate, todate, n=n) diff --git a/Tools/scripts/ndiff.py b/Tools/scripts/ndiff.py index f399338..88712b8 100755 --- a/Tools/scripts/ndiff.py +++ b/Tools/scripts/ndiff.py @@ -60,7 +60,7 @@ def fail(msg): # couldn't be opened def fopen(fname): try: - return open(fname, 'r') + return open(fname, 'U') except IOError, detail: return fail("couldn't open " + fname + ": " + str(detail)) |