]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/ly2dvi.py
* VERSION (MY_PATCH_LEVEL): make 1.7.0
[lilypond.git] / scripts / ly2dvi.py
index e8c871ec36d1852d72b0dce41db36f6ff2dd5a62..1dfae0331396132ae7dca6d51b624bc4a29bcc59 100644 (file)
@@ -130,9 +130,13 @@ def user_error (s, e=1):
                sys.exit (e)
        
 def error (s):
-       '''Report the error S.  Exit by raising an exception. Please
-       do not abuse by trying to catch this error. If you do not want
-       a stack trace, write to the output directly.
+       '''Report the error S.
+
+       If verbose is set, exit by raising an exception. Otherwise,
+       simply sys.exit().
+
+       Please do not abuse by trying to catch this error. If you do
+       not want a stack trace, write to the output directly.
 
        RETURN VALUE
 
@@ -141,7 +145,10 @@ def error (s):
        '''
        
        progress (_ ("error: ") + s)
-       raise _ ("Exiting ... ")
+       if verbose_p:
+               raise _ ("Exiting ... ")
+       else:
+               sys.exit (2)
 
 def getopt_args (opts):
        '''Construct arguments (LONG, SHORT) for getopt from  list of options.'''
@@ -321,6 +328,7 @@ errorport = sys.stderr
 keep_temp_dir_p = 0
 verbose_p = 0
 preview_p = 0
+lilypond_error_p = 0
 preview_resolution = 90
 pseudo_filter_p = 0
 latex_cmd = 'latex'
@@ -509,8 +517,12 @@ def run_lilypond (files, dep_prefix):
                       + _ ("Please submit a bug report to bug-lilypond@gnu.org") + "\n")
 
        if status:
-               error ( "\n" \
-                       + _ ("LilyPond failed on the input file (exit status %d).") % exit_status + "\n")
+               sys.stderr.write ( "\n" \
+                       + _ ("LilyPond failed on an input file (exit status %d).") % exit_status + "\n")
+               sys.stderr.write (_("Trying to salvage the rest.") +'\n\n')
+
+               global lilypond_error_p
+               lilypond_error_p = 1
                
 
 def analyse_lilypond_output (filename, extra):
@@ -600,6 +612,7 @@ def one_latex_definition (defn, first):
 ly_paper_to_latexpaper =  {
        'a4' : 'a4paper',
        'letter' : 'letterpaper', 
+       'a3' : 'a3paper'
 }
 
 #TODO: should set textheight (enlarge) depending on papersize. 
@@ -1105,7 +1118,8 @@ if files:
                        
        os.chdir (original_dir)
        cleanup_temp ()
-       
+
+       sys.exit (lilypond_error_p)
 else:
        help ()
        user_error (_ ("no files specified on command line"), 2)