]> git.donarmstrong.com Git - lilypond.git/blobdiff - bin/flower.py
release: 0.1.44
[lilypond.git] / bin / flower.py
index 5625599e7ac3971ae146f048eea3d3dee62f95a4..c7af8dd307e498ddd0ab2dc1912597fec20ba0a9 100644 (file)
@@ -33,3 +33,42 @@ class File:
     def __del__ (self):
        self.close ();
 
+
+
+import fnmatch
+import os
+
+_debug = 0
+
+_prune = ['(*)']
+
+
+def my_find(patterns, 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)
+               for pat in patterns:
+                   if fnmatch.fnmatch(name, pat):
+                        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`
+                               found = my_find(patterns, fullname)
+                               if found:
+                                   list = list + found
+        return list
+
+def multiple_find(pats, dirnames):
+    from find import find
+    l = []
+    for d in dirnames:
+       l = l + my_find(pats,  d)
+    return l