Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 | 2 |
3 import book_base as BookBase | 3 import book_base as BookBase |
4 import lilylib as ly | 4 import lilylib as ly |
5 global _;_=ly._ | 5 global _;_=ly._ |
6 import re | 6 import re |
7 import os | 7 import os |
8 import copy | 8 import copy |
9 import shutil | |
9 # TODO: We are using os.popen3, which has been deprecated since python 2.6. The | 10 # TODO: We are using os.popen3, which has been deprecated since python 2.6. The |
10 # suggested replacement is the Popen function of the subprocess module. | 11 # suggested replacement is the Popen function of the subprocess module. |
11 # Unfortunately, on windows this needs the msvcrt module, which doesn't seem | 12 # Unfortunately, on windows this needs the msvcrt module, which doesn't seem |
12 # to be available in GUB?!?!?! | 13 # to be available in GUB?!?!?! |
13 # from subprocess import Popen, PIPE | 14 # from subprocess import Popen, PIPE |
14 | 15 |
15 progress = ly.progress | 16 progress = ly.progress |
16 warning = ly.warning | 17 warning = ly.warning |
17 error = ly.error | 18 error = ly.error |
18 debug = ly.debug_output | 19 debug = ly.debug_output |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
633 os.unlink (os.path.join (destination, final_name)) | 634 os.unlink (os.path.join (destination, final_name)) |
634 except OSError: | 635 except OSError: |
635 pass | 636 pass |
636 | 637 |
637 src = os.path.join (output_dir, name) | 638 src = os.path.join (output_dir, name) |
638 dst = os.path.join (destination, final_name) | 639 dst = os.path.join (destination, final_name) |
639 dst_path = os.path.split(dst)[0] | 640 dst_path = os.path.split(dst)[0] |
640 if not os.path.isdir (dst_path): | 641 if not os.path.isdir (dst_path): |
641 os.makedirs (dst_path) | 642 os.makedirs (dst_path) |
642 try: | 643 try: |
643 os.rename (src, dst) | 644 os.link (src, dst) |
Reinhold
2011/10/04 20:10:43
Doesn't this REMOVE the src?
os.link creates a lin
Julien Rioux
2011/10/04 20:22:28
Yes it removes the src and moves it to dst. Why do
| |
645 except AttributeError: | |
646 shutil.copyfile (src, dst) | |
644 except OSError: | 647 except OSError: |
645 print '\nCould not overwrite file', dst | 648 print '\nCould not overwrite file', dst |
646 raise CompileError(self.basename()) | 649 raise CompileError(self.basename()) |
647 | 650 |
648 def additional_files_to_consider (self, base, full): | 651 def additional_files_to_consider (self, base, full): |
649 return [] | 652 return [] |
650 def additional_files_required (self, base, full): | 653 def additional_files_required (self, base, full): |
651 return [] | 654 return [] |
652 | 655 |
653 | 656 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
934 | 937 |
935 | 938 |
936 snippet_type_to_class = { | 939 snippet_type_to_class = { |
937 'lilypond_file': LilypondFileSnippet, | 940 'lilypond_file': LilypondFileSnippet, |
938 'lilypond_block': LilypondSnippet, | 941 'lilypond_block': LilypondSnippet, |
939 'lilypond': LilypondSnippet, | 942 'lilypond': LilypondSnippet, |
940 'include': IncludeSnippet, | 943 'include': IncludeSnippet, |
941 'lilypondversion': LilyPondVersionString, | 944 'lilypondversion': LilyPondVersionString, |
942 'musicxml_file': MusicXMLFileSnippet, | 945 'musicxml_file': MusicXMLFileSnippet, |
943 } | 946 } |
LEFT | RIGHT |