diff options
author | marha <marha@users.sourceforge.net> | 2011-10-06 08:56:22 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-10-06 08:56:22 +0200 |
commit | 0b89113fb6ba5b0a9cd0169e53fe284ddcac6682 (patch) | |
tree | d5dd4c22dd8bed17bbcf027264d7c05b9f33d65a /filesthatshouldbethesame.py | |
parent | 543c5ecf97b067fe5e0824f996c227e30ee693b0 (diff) | |
download | vcxsrv-0b89113fb6ba5b0a9cd0169e53fe284ddcac6682.tar.gz vcxsrv-0b89113fb6ba5b0a9cd0169e53fe284ddcac6682.tar.bz2 vcxsrv-0b89113fb6ba5b0a9cd0169e53fe284ddcac6682.zip |
Do line-ending independent compare
Diffstat (limited to 'filesthatshouldbethesame.py')
-rw-r--r-- | filesthatshouldbethesame.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/filesthatshouldbethesame.py b/filesthatshouldbethesame.py index 1ee7dea6b..fa0367902 100644 --- a/filesthatshouldbethesame.py +++ b/filesthatshouldbethesame.py @@ -189,25 +189,25 @@ Files=FilesStr.split() Diff=False
-def CompareFiles(SrcFile, DestFile):
+# do linefeed independent compare
+def CompareFiles(f1name, f2name):
try:
if len(sys.argv)>1:
- print "Comparing",SrcFile,DestFile
- Src=open(SrcFile,'rb')
- Dest=open(DestFile,'rb')
- while 1:
- SrcLine=Src.read(4096)
- DestLine=Dest.read(4096)
- if SrcLine!=DestLine:
- print "\n!!!!",SrcFile,"and",DestFile,"are different\n"
+ print "Comparing",f1name,f2name
+ f1 = open(f1name, 'U')
+ f2 = open(f2name, 'U')
+
+ a = f1.readlines(); f1.close()
+ b = f2.readlines(); f2.close()
+ for line in difflib.ndiff(a, b):
+ if line[0]!=' ':
return True
- if not SrcLine:
- return False
+
+ return False
except:
- if not os.path.exists(SrcFile): print "\n",SrcFile,"does not exist\n"
- if not os.path.exists(DestFile): print "\n",DestFile,"does not exist\n"
+ if not os.path.exists(f1name): print "\n",f1name,"does not exist\n"
+ if not os.path.exists(f2name): print "\n",f2name,"does not exist\n"
return False
-
for SrcFile,DestFile in izip(Files[0::2], Files[1::2]):
Diff |= CompareFiles(SrcFile, DestFile)
|