]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Run grand-replace for 2012
[lilypond.git] / scripts / lilypond-book.py
index 4d2b000fbd80252d9a3776244f6ad7a26aebdf5f..9e5777284982a924aac8f74db7e76b22cb0e81f7 100644 (file)
@@ -113,7 +113,7 @@ def warranty ():
 
 %s
 %s
-''' % ( _ ('Copyright (c) %s by') % '2001--2011',
+''' % ( _ ('Copyright (c) %s by') % '2001--2012',
         '\n  '.join (authors),
         _ ("Distributed under terms of the GNU General Public License."),
         _ ("It comes with NO WARRANTY.")))
@@ -380,11 +380,19 @@ def system_in_directory (cmd, directory, logfile):
 
     current = os.getcwd()
     os.chdir (directory)
-    ly.system(cmd,
+    """NB - ignore_error is deliberately set to the same value
+    as redirect_output - this is not a typo."""
+    retval = ly.system(cmd,
               be_verbose=ly.is_verbose (),
               redirect_output=global_options.redirect_output,
               log_file=logfile,
-              progress_p=1)
+              progress_p=1,
+              ignore_error=global_options.redirect_output)
+    if retval != 0:
+        print ("Error trapped by lilypond-book")
+        print ("\nPlease see " + logfile + ".log\n")
+        sys.exit(1)
+
     os.chdir (current)
 
 
@@ -422,7 +430,7 @@ def write_file_map (lys, name):
 #(define output-empty-score-list #f)
 #(ly:add-file-name-alist '(%s
     ))\n
-""" % '\n'.join(['("%s.ly" . "%s")\n' % (ly.basename (), name)
+""" % '\n'.join(['("%s.ly" . "%s")\n' % (ly.basename ().replace('\\','/'), name)
                  for ly in lys]))
 
 def split_output_files(directory):
@@ -448,11 +456,9 @@ def do_process_cmd (chunks, input_name, options):
     progress (_ ("Writing snippets..."))
     for snippet in outdated:
         snippet.write_ly()
-    progress ('\n')
 
     if outdated:
         progress (_ ("Processing..."))
-        progress ('\n')
         process_snippets (options.process_cmd, outdated,
                           options.formatter, options.lily_output_dir)
 
@@ -466,8 +472,6 @@ def do_process_cmd (chunks, input_name, options):
                                            output_files,
                                            options.output_dir)
 
-    progress ('\n')
-
 
 ###
 # Format guessing data
@@ -488,7 +492,6 @@ def write_if_updated (file_name, lines):
         new_str = ''.join (lines)
         if oldstr == new_str:
             progress (_ ("%s is up to date.") % file_name)
-            progress ('\n')
 
             # this prevents make from always rerunning lilypond-book:
             # output file must be touched in order to be up to date
@@ -503,7 +506,6 @@ def write_if_updated (file_name, lines):
 
     progress (_ ("Writing `%s'...") % file_name)
     file (file_name, 'w').writelines (lines)
-    progress ('\n')
 
 
 def note_input_file (name, inputs=[]):
@@ -569,7 +571,6 @@ def do_file (input_filename, included=False):
     try:
         progress (_ ("Reading %s...") % input_fullname)
         source = in_handle.read ()
-        progress ('\n')
 
         if not included:
             global_options.formatter.init_default_snippet_options (source)
@@ -580,7 +581,6 @@ def do_file (input_filename, included=False):
 
         # Let the formatter modify the chunks before further processing
         chunks = global_options.formatter.process_chunks (chunks)
-        progress ('\n')
 
         if global_options.filter_cmd:
             write_if_updated (output_filename,
@@ -588,7 +588,6 @@ def do_file (input_filename, included=False):
         elif global_options.process_cmd:
             do_process_cmd (chunks, input_fullname, global_options)
             progress (_ ("Compiling %s...") % output_filename)
-            progress ('\n')
             write_if_updated (output_filename,
                      [s.replacement_text ()
                      for s in chunks])
@@ -597,7 +596,6 @@ def do_file (input_filename, included=False):
             os.chdir (original_dir)
             name = snippet.substring ('filename')
             progress (_ ("Processing include: %s") % name)
-            progress ('\n')
             return do_file (name, included=True)
 
         include_chunks = map (process_include,
@@ -609,7 +607,6 @@ def do_file (input_filename, included=False):
     except BookSnippet.CompileError:
         os.chdir (original_dir)
         progress (_ ("Removing `%s'") % output_filename)
-        progress ('\n')
         raise BookSnippet.CompileError
 
 def do_options ():