]> git.donarmstrong.com Git - lilypond.git/blobdiff - python/book_snippets.py
lilypond-manuals.css: edit color scheme and some spacing
[lilypond.git] / python / book_snippets.py
index 12dd5e9d8260c0b8d8badaf7645ecbc8cdee33f0..4bc4252e79da3bad9cb15876eb2f4218a4f24d2f 100644 (file)
@@ -46,7 +46,6 @@ INDENT = 'indent'
 NORAGGED_RIGHT = 'noragged-right'
 NOTES = 'body'
 NOTIME = 'notime'
-NOSTAFF = 'nostaff'
 OUTPUT = 'output'
 OUTPUTIMAGE = 'outputimage'
 PAPER = 'paper'
@@ -63,8 +62,8 @@ VERSION = 'lilypondversion'
 
 
 
-# NOTIME, NOSTAFF and NOGETTEXT have no opposite so they aren't part of
-# this dictionary.
+# NOTIME and NOGETTEXT have no opposite so they aren't part of this
+# dictionary.
 no_options = {
     NOFRAGMENT: FRAGMENT,
     NOINDENT: INDENT,
@@ -134,17 +133,6 @@ snippet_options = {
  \context {
    \Staff
    \remove "Time_signature_engraver"
- }''',
-        NOSTAFF: r'''
- \context {
-   \Score
-   timing = ##f
- }
- \context {
-   \Staff
-   \remove "Time_signature_engraver"
-   \remove "Clef_engraver"
-   \remove "Staff_symbol_engraver"
  }''',
     },
 
@@ -656,10 +644,20 @@ printing diff against existing file." % filename)
             if not os.path.isdir (dst_path):
                 os.makedirs (dst_path)
             try:
-                os.link (src, dst)
-            except AttributeError:
-                shutil.copyfile (src, dst)
-            except OSError:
+                if (self.global_options.use_source_file_names
+                        and isinstance (self, LilypondFileSnippet)):
+                    fout = open (dst, 'w')
+                    fin = open (src, 'r')
+                    for line in fin.readlines ():
+                        fout.write (line.replace (self.basename (), self.final_basename ()))
+                    fout.close ()
+                    fin.close ()
+                else:
+                    try:
+                        os.link (src, dst)
+                    except AttributeError:
+                        shutil.copyfile (src, dst)
+            except (IOError, OSError):
                 error (_ ('Could not overwrite file %s') % dst)
                 raise CompileError(self.basename())