# 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)
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:
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")),
]
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):
if o[1]:
sh = '-%s' % o[1]
- sep = ' '
+ sep = ' '
if o[1] and o[2]:
- sep = ','
+ sep = ', '
long = ''
if o[2]:
return str
def help ():
- ls = [(_ ("Usage: %s [OPTION]... FILE") % program_name),
+ ls = [(_ ("Usage: %s [OPTIONS]... FILE") % program_name),
('\n\n'),
(help_summary),
('\n\n'),
('\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)
# 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:
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")
str = str + ln
id = self.idstring ()
- str = '''%s = \\context Voice = %s \\notes {
+ str = '''%s = \\context Voice = %s {
%s
}
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:
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
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
str = str + '''
\score {
- <%s
- >
- \paper {}
+ <<%s
+ >>
+ \layout {}
\midi {}
}
''' % refs
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)