From: fred Date: Tue, 21 Jul 1998 19:31:14 +0000 (+0000) Subject: lilypond-1.0.1 X-Git-Tag: release/1.5.59~5892 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=5b696724cc15500f7f6a287b721cafdb2ad48beb;p=lilypond.git lilypond-1.0.1 --- diff --git a/stepmake/bin/flower.py b/stepmake/bin/flower.py new file mode 100755 index 0000000000..b105098ed3 --- /dev/null +++ b/stepmake/bin/flower.py @@ -0,0 +1,87 @@ +#!@PYTHON@ + +# +# flower.py -- python flower lib +# +# source file of the GNU LilyPond music typesetter +# +# (c) 1997 Han-Wen Nienhuys +# + +import sys +from string import * + +class File: + """silly wrapper for Python file object.""" + def __init__ (self,nm, mode='r'): + if nm: + self.file_ = open (nm, mode); + elif mode == 'w': + self.file_ = sys.stdout + else: + self.file_ = sys.stdin + + self.eof_ = 0; + def readline (self): + l= self.file_.readline (); + if not l: + self.eof_ = 1; + return l; + def write (self, str): + self.file_.write (str) + def eof (self): + return self.eof_ + def close (self): + self.file_.close () + 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 + +def file_exist_b(name): + try: + f = open(name) + except IOError: + return 0 + f.close () + return 1 +