X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fmup2ly.py;h=59810972eef2830d40f36e1ee7fbc6f7dd5fd32b;hb=c2b0bbf77c6702079acdaa20e54e819728140899;hp=bb071d6d100e744fc753544c7b03102f0ecd4773;hpb=145376509af3f2caf35122d257d24eb7edcb7092;p=lilypond.git diff --git a/scripts/mup2ly.py b/scripts/mup2ly.py index bb071d6d10..59810972ee 100644 --- a/scripts/mup2ly.py +++ b/scripts/mup2ly.py @@ -47,7 +47,7 @@ else: sys.path.append (os.path.join (datadir, 'python')) sys.path.append (os.path.join (datadir, 'python/out')) -program_name = 'mup2ly' +program_name = sys.argv[0] program_version = '@TOPLEVEL_VERSION@' original_dir = os.getcwd () temp_dir = os.path.join (original_dir, '%s.dir' % program_name) @@ -86,28 +86,6 @@ option_definitions = [ # # source file of the GNU LilyPond music typesetter -# Handle bug in Python 1.6-2.1 -# -# there are recursion limits for some patterns in Python 1.6 til 2.1. -# fix this by importing pre instead. Fix by Mats. - -# todo: should check Python version first. -try: - import pre - re = pre - del pre -except ImportError: - import re - -# Attempt to fix problems with limited stack size set by Python! -# Sets unlimited stack size. Note that the resource module only -# is available on UNIX. -try: - import resource - resource.setrlimit (resource.RLIMIT_STACK, (-1, -1)) -except: - pass - try: import gettext gettext.bindtextdomain ('lilypond', localedir) @@ -127,14 +105,13 @@ def identify (): def warranty (): identify () sys.stdout.write ('\n') - sys.stdout.write (_ ('Copyright (c) %s by' % ' 2001--2003')) + sys.stdout.write (_ ('Copyright (c) %s by') % '2001--2005') sys.stdout.write ('\n') sys.stdout.write (' Han-Wen Nienhuys') sys.stdout.write (' Jan Nieuwenhuizen') - sys.stdout.write ('\n') - sys.stdout.write (_ (r''' -Distributed under terms of the GNU General Public License. It comes with -NO WARRANTY.''')) + sys.stdout.write ('\n\n') + sys.stdout.write (_ ("Distributed under terms of the GNU General Public License.")) + sys.stdout.write (_ ("It comes with NO WARRANTY.")) sys.stdout.write ('\n') def progress (s): @@ -290,23 +267,6 @@ def cp_to_dir (pattern, dir): map (lambda x, d=dir: shutil.copy2 (x, os.path.join (d, x)), files) -# Python < 1.5.2 compatibility -# -# On most platforms, this is equivalent to -#`normpath(join(os.getcwd()), PATH)'. *Added in Python version 1.5.2* -if os.path.__dict__.has_key ('abspath'): - abspath = os.path.abspath -else: - def abspath (path): - return os.path.normpath (os.path.join (os.getcwd (), path)) - -if os.__dict__.has_key ('makedirs'): - makedirs = os.makedirs -else: - def makedirs (dir, mode=0777): - system ('mkdir -p %s' % dir) - - def mkdir_p (dir, mode=0777): if not os.path.isdir (dir): makedirs (dir, mode) @@ -525,7 +485,7 @@ class Voice: str = str + ln id = self.idstring () - str = '''%s = \\context Voice = %s \\notes { + str = '''%s = \\context Voice = %s { %s } @@ -567,9 +527,9 @@ class Key: if self.sharps and self.flats: k = '\\keysignature %s ' % 'TODO' elif self.sharps: - k = '\\notes\\key %s \major' % key_sharps[self.sharps] + k = '\\key %s \major' % key_sharps[self.sharps] elif self.flats: - k = '\\notes\\key %s \major' % key_flats[self.flats] + k = '\\key %s \major' % key_flats[self.flats] return k class Time: @@ -1102,7 +1062,7 @@ class Parser: \score { <<%s >> - \paper {} + \layout {} \midi {} } ''' % refs @@ -1291,12 +1251,13 @@ if not files: files = ['-'] for f in files: - + h = None if f == '-': h = sys.stdin elif f and not os.path.isfile (f): f = strip_extension (f, '.mup') + '.mup' - h = open (f) + + h = open (f) progress ( _("Processing `%s'..." % f)) raw_lines = h.readlines () p = Pre_processor (raw_lines)