X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fmup2ly.py;h=98ba97c5892d72173b84ae235f522615112f4d0d;hb=a6a63d43762b71bb1f0b5ea5f70eb8fcf4dcce5e;hp=e24f38ac183730236f823ef026d3cb6c7e3808c5;hpb=30c886ed7719a722a55787f955de5b28cc99517c;p=lilypond.git diff --git a/scripts/mup2ly.py b/scripts/mup2ly.py index e24f38ac18..98ba97c589 100644 --- a/scripts/mup2ly.py +++ b/scripts/mup2ly.py @@ -37,17 +37,17 @@ import tempfile # if set, LILYPONDPREFIX must take prevalence # if datadir is not set, we're doing a build and LILYPONDPREFIX -datadir = '@datadir@' +datadir = '@local_lilypond_datadir@' if os.environ.has_key ('LILYPONDPREFIX') \ - or '@datadir@' == '@' + 'datadir' + '@': + or '@local_lilypond_datadir@' == '@' + 'local_lilypond_datadir' + '@': datadir = os.environ['LILYPONDPREFIX'] else: - datadir = '@datadir@' + datadir = '@local_lilypond_datadir@' sys.path.append (os.path.join (datadir, 'python')) sys.path.append (os.path.join (datadir, 'python/out')) -program_name = 'ly2dvi' +program_name = sys.argv[0] program_version = '@TOPLEVEL_VERSION@' original_dir = os.getcwd () temp_dir = os.path.join (original_dir, '%s.dir' % program_name) @@ -55,9 +55,10 @@ errorport = sys.stderr keep_temp_dir_p = 0 verbose_p = 0 +localedir = '@localedir@' try: import gettext - gettext.bindtextdomain ('lilypond', '@localedir@') + gettext.bindtextdomain ('lilypond', localedir) gettext.textdomain ('lilypond') _ = gettext.gettext except: @@ -66,15 +67,15 @@ except: program_name = 'mup2ly' -help_summary = _ ("Convert mup to LilyPond source") +help_summary = _ ("Convert mup to LilyPond source.") option_definitions = [ ('', 'd', 'debug', _ ("debug")), ('NAME[=EXP]', 'D', 'define', _ ("define macro NAME [optional expansion EXP]")), - ('', 'h', 'help', _ ("this help")), + ('', 'h', 'help', _ ("print this help")), ('FILE', 'o', 'output', _ ("write output to FILE")), ('', 'E', 'pre-process', _ ("only pre-process")), - ('', 'V', 'verbose', _ ("verbose")), + ('', 'V', 'verbose', _ ("be verbose")), ('', 'v', 'version', _ ("print version number")), ('', 'w', 'warranty', _ ("show warranty and copyright")), ] @@ -126,14 +127,13 @@ def identify (): def warranty (): identify () sys.stdout.write ('\n') - sys.stdout.write (_ ('Copyright (c) %s by' % ' 2001--2002')) + sys.stdout.write (_ ('Copyright (c) %s by') % '2001--2004') 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): @@ -182,9 +182,9 @@ def option_help_str (o): if o[1]: sh = '-%s' % o[1] - sep = ' ' + sep = ' ' if o[1] and o[2]: - sep = ',' + sep = ', ' long = '' if o[2]: @@ -216,7 +216,7 @@ def options_help_str (opts): return str def help (): - ls = [(_ ("Usage: %s [OPTION]... FILE") % program_name), + ls = [(_ ("Usage: %s [OPTIONS]... FILE") % program_name), ('\n\n'), (help_summary), ('\n\n'), @@ -224,7 +224,7 @@ def help (): ('\n'), (options_help_str (option_definitions)), ('\n\n'), - (_ ("Report bugs to %s") % 'bug-lilypond@gnu.org'), + (_ ("Report bugs to %s.") % 'bug-lilypond@gnu.org'), ('\n')] map (sys.stdout.write, ls) @@ -313,12 +313,12 @@ def mkdir_p (dir, mode=0777): # if set, LILYPONDPREFIX must take prevalence # if datadir is not set, we're doing a build and LILYPONDPREFIX -datadir = '@datadir@' +datadir = '@local_lilypond_datadir@' if os.environ.has_key ('LILYPONDPREFIX') : datadir = os.environ['LILYPONDPREFIX'] else: - datadir = '@datadir@' + datadir = '@local_lilypond_datadir@' while datadir[-1] == os.sep: @@ -454,8 +454,8 @@ class Slur: e= self.end_chord if e and s: - s.note_suffix = s.note_suffix + '(' - e.note_prefix = ')' + e.note_prefix + s.note_suffix = s.note_suffix + '-(' + e.note_prefix = e.note_suffix + "-)" else: sys.stderr.write ("\nOrphaned slur") @@ -524,7 +524,7 @@ class Voice: str = str + ln id = self.idstring () - str = '''%s = \\context Voice = %s \\notes { + str = '''%s = \\context Voice = %s { %s } @@ -566,9 +566,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: @@ -637,8 +637,8 @@ class Staff: str = str + v.dump() refs = refs + '\n \\' + v.idstring () str = str + ''' -%s = \context Staff = %s <%s -> +%s = \context Staff = %s <<%s +>> ''' % (self.idstring (), self.idstring (), refs) return str @@ -720,19 +720,21 @@ class Chord: for p in self.pitches: if str: str = str + ' ' - str = str + pitch_to_lily_string (p) + sd + str = str + pitch_to_lily_string (p) - for s in self.scripts: - str = str + '-' + s str = self.note_prefix +str + self.note_suffix if len (self.pitches) > 1: str = '<%s>' % str elif self.multimeasure: - str = 'R' + sd + str = 'R' elif len (self.pitches) == 0: - str = 'r' + sd + str = 'r' + + str = str + sd + for s in self.scripts: + str = str + '-' + s str = self.chord_prefix + str + self.chord_suffix @@ -1097,9 +1099,9 @@ class Parser: str = str + ''' \score { - <%s - > - \paper {} + <<%s + >> + \layout {} \midi {} } ''' % refs @@ -1288,7 +1290,7 @@ if not files: files = ['-'] for f in files: - + h = None if f == '-': h = sys.stdin elif f and not os.path.isfile (f):