]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Optionally preserve input path.
[lilypond.git] / scripts / lilypond-book.py
index f2052910f3b249f9e18bdad2bb74f51ca540e10a..2c3870a3366ff437469f8806e2283e79ca882c06 100644 (file)
@@ -146,11 +146,17 @@ def get_option_parser ():
                   action='store', dest='output_dir',
                   default='')
     
-    p.add_option ('--no-lily-run',
+    p.add_option ('--skip-lily-check',
                   help=_ ("do not fail if no lilypond output is found."),
                   metavar=_ ("DIR"),
                   action='store_true', dest='skip_lilypond_run',
                   default=False)
+
+    p.add_option ('--skip-png-check',
+                  help=_ ("do not fail if no PNG images are found for EPS files"),
+                  metavar=_ ("DIR"),
+                  action='store_true', dest='skip_png_check',
+                  default=False)
     
     p.add_option ('--lily-output-dir',
                   help=_ ("write lily-XXX files to DIR, link into --output dir."),
@@ -1101,9 +1107,6 @@ class LilypondSnippet (Snippet):
         return self.checksum
 
     def basename (self):
-        if FILENAME in self.option_dict:
-            return self.option_dict[FILENAME]
-
         cs = self.get_checksum ()
 
         # TODO: use xx/xxxxx directory layout.
@@ -1156,6 +1159,7 @@ class LilypondSnippet (Snippet):
             else:
                 missing.add (name)
 
+        # UGH - junk global_options
         skip_lily = global_options.skip_lilypond_run
         for required in [base + '.ly',
                          base + '.txt']:
@@ -1170,7 +1174,9 @@ class LilypondSnippet (Snippet):
                              base + '-systems.tex',
                              base + '-systems.pdftexi'])
 
-        if base + '.eps' in result and self.format in (HTML, TEXINFO):
+        # UGH - junk global_options
+        if (base + '.eps' in result and self.format in (HTML, TEXINFO)
+            and not global_options.skip_png_check):
             page_count = ps_page_count (full + '.eps')
             if page_count <= 1:
                 require_file (base + '.png')
@@ -1179,7 +1185,7 @@ class LilypondSnippet (Snippet):
                     require_file (base + '-page%d.png' % page)
 
         system_count = 0
-        if not skip_lily:
+        if not skip_lily and not missing:
             system_count = int(file (full + '-systems.count').read())
         for number in range(1, system_count + 1):
             systemfile = '%s-%d' % (base, number)
@@ -1619,8 +1625,8 @@ 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)
-                for ly in lys))
+""" % '\n'.join(['("%s.ly" . "%s")\n' % (ly.basename (), name)
+                 for ly in lys]))
 
 def do_process_cmd (chunks, input_name, options):
     snippets = [c for c in chunks if isinstance (c, LilypondSnippet)]