head	1.1;
access;
symbols
	PyQwt3D-0-1-6:1.1
	PyQwt3D-0-1-5:1.1;
locks; strict;
comment	@# @;


1.1
date	2007.07.28.13.40.36;	author gvermeul;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Switch to qwtplot3d-0.2.7 and tools to patch it and to remove its the \r's and \t's.
@
text
@#!/usr/bin/env python

import difflib
import os
import sys
import time

def usage():
    print "gendiff tree .suffix"
    sys.exit(1)

# usage()

def main(args):
    if len(args) != 3:
        usage()
    tree = args[1]
    suffix = args[2]
    for root, _, files in os.walk(tree):
        for name in files:
            fromfile = os.path.join(root, name)
            tofile = os.path.join(root, os.path.splitext(name)[0])
            if os.path.splitext(name)[-1] == suffix and os.path.exists(tofile):
                fromdate = time.ctime(os.stat(fromfile).st_mtime)
                todate = time.ctime(os.stat(tofile).st_mtime)
                fromlines = open(fromfile, 'U').readlines()
                tolines = open(tofile, 'U').readlines()
                sys.stdout.writelines(difflib.unified_diff(
                    fromlines, tolines, fromfile, tofile, fromdate, todate))

# main()

if __name__ == '__main__':
    main(sys.argv)


# Local Variables: ***
# mode: python ***
# End: ***
@
