]> git.donarmstrong.com Git - lilypond.git/blobdiff - stepmake/bin/package-diff.py
release: 1.5.19
[lilypond.git] / stepmake / bin / package-diff.py
index bc2c8a8eba31a2527f3c761b311dc49a05404cc4..357ab5046a9924737935d83436f3221a55a02a6a 100644 (file)
@@ -5,12 +5,41 @@
 #
 
 
-import find
+
+import fnmatch
 import sys
 import os
+import re
 import string
 import getopt
 import pipes
+
+
+_debug = 0
+
+_prune = ['(*)']
+
+def find(pattern, dir = os.curdir):
+        list = []
+        names = os.listdir(dir)
+        names.sort()
+        for name in names:
+                if name in (os.curdir, os.pardir):
+                        continue
+                fullname = os.path.join(dir, name)
+                if fnmatch.fnmatch(name, pattern):
+                        list.append(fullname)
+                if os.path.isdir(fullname) and not os.path.islink(fullname):
+                        for p in _prune:
+                                if fnmatch.fnmatch(name, p):
+                                        if _debug: print "skip", `fullname`
+                                        break
+                        else:
+                                if _debug: print "descend into", `fullname`
+                                list = list + find(pattern, fullname)
+        return list
+
+
 topdir = ''
 def gulp_file(f):
        try:
@@ -84,18 +113,20 @@ def remove_automatic (dirnames):
        for d in dirnames:
                try:
                        for p in pats:
-                               files = files + find.find (p, d)
+                               files = files + find (p, d)
                except:
                        sys.stderr.write ("Can't find dir: %s\n" % d)
                        cleanup ()
                        sys.exit (1)
 
-       dirs = map (lambda d: find.find ('out', d), dirnames)
+       dirs = map (lambda d: find ('out*', d), dirnames)
        dirs = reduce (lambda x,y:  x + y, dirs)
        
-       print dirs 
+       #print dirs
+
        for d in dirs:
-               files = files + find.find ('*', d)
+               if os.path.isdir (d):
+                       files = files + find ('*', d)
                
        for f in files:
                try:
@@ -172,8 +203,8 @@ def makediff (fromdir, todir, patch_name):
                        
        sys.stderr.write ('diffing to %s... ' % patch_name)
        os.system ('pwd')
-       print ('diff -urN %s . >> %s' % (fromdir, patch_name))
-       os.system ('diff -urN %s . >> %s' % (fromdir, patch_name))
+       print ('diff -purN %s . >> %s' % (fromdir, patch_name))
+       os.system ('diff -purN %s . >> %s' % (fromdir, patch_name))
        os.system ('gzip --quiet -9f %s' % patch_name)