X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=python%2Fbook_snippets.py;h=4bc4252e79da3bad9cb15876eb2f4218a4f24d2f;hb=79c17e0eaedca79e5f7605f5b9f92db27c68e679;hp=12dd5e9d8260c0b8d8badaf7645ecbc8cdee33f0;hpb=70cc6f11795ab109dbe39c608be9bbe6ea95ced0;p=lilypond.git diff --git a/python/book_snippets.py b/python/book_snippets.py index 12dd5e9d82..4bc4252e79 100644 --- a/python/book_snippets.py +++ b/python/book_snippets.py @@ -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())