sys.stdout.write ('\n')
sys.stdout.write (' Han-Wen Nienhuys')
sys.stdout.write (' Jan Nieuwenhuizen')
+ sys.stdout.write ('\n\n')
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 (_ ("Distributed under terms of the GNU General Public License. It comes with NO WARRANTY."))
sys.stdout.write ('\n')
def progress (s):
def user_error (s, e=1):
errorport.write (program_name + ":" + _ ("error: ") + s + '\n')
- sys.exit (e)
+ if (e):
+ sys.exit (e)
def error (s):
'''Report the error S. Exit by raising an exception. Please
help_summary = _ ("Run LilyPond using LaTeX for titling")
option_definitions = [
- ('', 'd', 'dependencies', _ ("write Makefile dependencies for every input file")),
+ ('', 'd', 'dependencies',
+ _ ("write Makefile dependencies for every input file")),
('', 'h', 'help', _ ("this help")),
(_ ("DIR"), 'I', 'include', _ ("add DIR to LilyPond's search path")),
- ('', 'k', 'keep', _ ("keep all output, and name the directory %s.dir") % program_name),
+ ('', 'k', 'keep',
+ _ ("keep all output, output to directory %s.dir") % program_name),
('', '', 'no-lily', _ ("don't run LilyPond")),
('', 'm', 'no-paper', _ ("produce MIDI output only")),
(_ ("FILE"), 'o', 'output', _ ("write ouput to FILE")),
(_ ("FILE"), 'f', 'find-pfa', _ ("find pfa fonts used in FILE")),
- # FIXME: preview, picture; to indicate creation of a PNG?
- ('', '', 'preview', _("make a picture of the first system.")),
- (_ ('RES'), '', 'preview-resolution', _("set the resolution of the preview to RES.")),
+ (_ ('RES'), '', 'preview-resolution',
+ _ ("set the resolution of the preview to RES")),
('', 'P', 'postscript', _ ("generate PostScript output")),
('', 'p', 'pdf', _ ("generate PDF output")),
+ ('', '', 'pdftex', _ ("use pdflatex to generate a PDF output")),
+ # FIXME: preview, picture; to indicate creation of a PNG?
+ ('', '', 'preview', _ ("make a picture of the first system")),
(_ ("KEY=VAL"), 's', 'set', _ ("change global setting KEY to VAL")),
('', 'V', 'verbose', _ ("verbose")),
('', 'v', 'version', _ ("print version number")),
('', 'w', 'warranty', _ ("show warranty and copyright")),
- ('', '', 'pdftex', _("Use pdflatex to generate a PDF output")),
]
layout_fields = ['dedication', 'title', 'subtitle', 'subsubtitle',
try:
dict[key].append (val)
except KeyError:
- warning (_ ("no such setting: %s") % `key`)
+ warning (_ ("no such setting: `%s'") % `key`)
dict[key] = [val]
exit_status = status >> 8
# 2 == user interrupt.
- if signal and signal <> 2:
- error("\n\nLilyPond crashed (signal %d). Please submit a bugreport to bug-lilypond@gnu.org\n" % signal)
+ if signal and signal != 2:
+ error ("\n\n" + _ ("LilyPond crashed (signal %d).") % signal \
+ + _ ("Please submit a bug report to bug-lilypond@gnu.org") + "\n")
if status:
- error ("\n\nLilyPond failed on the input file. (exit status %d)\n" % exit_status)
+ error ( "\n" \
+ + _ ("LilyPond failed on the input file (exit status %d).") % exit_status + "\n")
def analyse_lilypond_output (filename, extra):
x = x + 1
if not x:
fstr = string.join (files, ', ')
- warning (_ ("no LilyPond output found for %s") % fstr)
+ warning (_ ("no LilyPond output found for `%s'") % fstr)
return tfiles
def one_latex_definition (defn, first):
try:
options = ly_paper_to_latexpaper[extra['papersize'][0]]
except KeyError:
- warning (_ ("invalid value: %s") % `extra['papersize'][0]`)
+ warning (_ ("invalid value: `%s'") % `extra['papersize'][0]`)
pass
if extra['latexoptions']:
start = m.start (0)
logstr = logstr[start:start+200]
- sys.stderr.write(_("""LaTeX failed on the output file.
-The error log is as follows:
-%s...\n""" % logstr))
+ user_error (_ ("LaTeX failed on the output file."), 0)
+ sys.stderr.write ("\n")
+ user_error (_ ("The error log is as follows:"), 0)
+ sys.stderr.write ("\n")
+ sys.stderr.write (logstr)
+ sys.stderr.write ("\n")
raise 'LaTeX error'
if preview_p:
# make a preview by rendering only the 1st line.
preview_fn = outbase + '.preview.tex'
- f = open(preview_fn, 'w')
+ f = open (preview_fn, 'w')
f.write (r'''
%s
\input lilyponddefs
s = open (name).read ()
if s[:len (PS)] != PS:
# no ps header?
- errorport.write (_( "error: ") + _ ("not a PostScript file: `%s\'" % name))
- errorport.write ('\n')
- sys.exit (1)
+ user_error (_ ("not a PostScript file: `%s\'" % name))
here = 0
m = re.match ('.*?/(feta[-a-z0-9]+) +findfont', s[here:], re.DOTALL)
pfa = []
(options, files) = getopt.getopt(sys.argv[1:], sh, long)
except getopt.error, s:
errorport.write ('\n')
- errorport.write (_ ("error: ") + _ ("getopt says: `%s\'" % s))
- errorport.write ('\n')
+ user_error (_ ("getopt says: `%s\'" % s), 0)
errorport.write ('\n')
help ()
sys.exit (2)
progress (_ ("pseudo filter"))
else:
help ()
- user_error (_ ("pseudo filter only for single input file."), 2)
+ user_error (_ ("pseudo filter only for single input file"), 2)
original_output = output_name
else:
help ()
- user_error (_ ("no files specified on command line."), 2)
+ user_error (_ ("no files specified on command line"), 2)