X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=stepmake%2Fbin%2Fpackage-diff.py;h=357ab5046a9924737935d83436f3221a55a02a6a;hb=0817e0513d1016ff22a633b6fee20ddba2a062f2;hp=e07dd3ade3c95d2b43dde802c13b49c524ab427d;hpb=a2b44dbc67d57638f57754b4035e0f919aa46e93;p=lilypond.git diff --git a/stepmake/bin/package-diff.py b/stepmake/bin/package-diff.py index e07dd3ade3..357ab5046a 100644 --- a/stepmake/bin/package-diff.py +++ b/stepmake/bin/package-diff.py @@ -5,7 +5,7 @@ # -import find + import fnmatch import sys import os @@ -14,6 +14,32 @@ 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: @@ -87,20 +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 for d in dirs: if os.path.isdir (d): - files = files + find.find ('*', d) + files = files + find ('*', d) for f in files: try: