.*?)
.*?)
+
.*?)
.*?)
+
\s.*?
\s))''',
+
+ 'lilypondversion':
+ r'''(?mx)
+ (?P
+ )''',
},
##
@@ -429,6 +498,12 @@ snippet_res = {
\\begin\s*{verbatim}
.*?
\\end\s*{verbatim}))''',
+
+ 'lilypondversion':
+ r'''(?smx)
+ (?P
+ \\lilypondversion)[^a-zA-Z]''',
+
},
##
@@ -495,17 +570,21 @@ snippet_res = {
@example
\s.*?
@end\s+example\s))''',
- },
-}
+ 'lilypondversion':
+ r'''(?mx)
+ [^@](?P
+ @lilypondversion)[^a-zA-Z]''',
+ },
+}
format_res = {
- DOCBOOK: {
- 'intertext': r',?\s*intertext=\".*?\"',
+ DOCBOOK: {
+ 'intertext': r',?\s*intertext=\".*?\"',
'option_sep': '\s*',
- },
+ },
HTML: {
'intertext': r',?\s*intertext=\".*?\"',
'option_sep': '\s*',
@@ -522,17 +601,19 @@ format_res = {
},
}
+
# Options without a pattern in ly_options.
simple_options = [
EXAMPLEINDENT,
FRAGMENT,
NOFRAGMENT,
+ NOGETTEXT,
NOINDENT,
PRINTFILENAME,
+ DOCTITLE,
TEXIDOC,
LANG,
VERBATIM,
- FONTLOAD,
FILENAME,
ALT,
ADDVERSION
@@ -556,19 +637,19 @@ ly_options = {
RAGGED_RIGHT: r'''ragged-right = ##t''',
- PACKED: r'''packed = ##t''',
+ NORAGGED_RIGHT: r'''ragged-right = ##f''',
},
##
LAYOUT: {
NOTIME: r'''
\context {
- \Score
- timing = ##f
+ \Score
+ timing = ##f
}
\context {
- \Staff
- \remove Time_signature_engraver
+ \Staff
+ \remove "Time_signature_engraver"
}''',
},
@@ -580,19 +661,37 @@ ly_options = {
output = {
##
- DOCBOOK: {
- FILTER: r'''%(code)s ''',
-
- OUTPUT: r'''
-
-
-
-
- ''',
-
- VERBATIM: r'''%(verb)s ''',
-
- PRINTFILENAME: '%(filename)s '
+ DOCBOOK: {
+ FILTER: r'''
+
+
+%(code)s
+
+
+ ''',
+
+ OUTPUT: r'''
+
+
+
+
+ ''',
+
+ VERBATIM: r'''
+%(verb)s ''',
+
+ VERSION: program_version,
+
+ PRINTFILENAME: r'''
+
+
+
+ %(filename)s
+
+
+
+ '''
},
##
HTML: {
@@ -609,8 +708,10 @@ output = {
''',
OUTPUT: r'''
- ''',
+ ''',
PRINTFILENAME: '',
@@ -621,34 +722,38 @@ output = {
VERBATIM: r'''
%(verb)s
''',
+
+ VERSION: program_version,
},
##
LATEX: {
OUTPUT: r'''{%%
-\parindent 0pt%%
-\ifx\preLilyPondExample \undefined%%
- \relax%%
-\else%%
- \preLilyPondExample%%
-\fi%%
+\parindent 0pt
+\ifx\preLilyPondExample \undefined
+\else
+ \expandafter\preLilyPondExample
+\fi
\def\lilypondbook{}%%
-\input %(base)s-systems.tex%%
-\ifx\postLilyPondExample \undefined%%
- \relax%%
-\else%%
- \postLilyPondExample%%
-\fi%%
+\input %(base)s-systems.tex
+\ifx\postLilyPondExample \undefined
+\else
+ \expandafter\postLilyPondExample
+\fi
}''',
PRINTFILENAME: '''\\texttt{%(filename)s}
- ''',
+''',
- QUOTE: r'''\begin{quotation}%(str)s
+ QUOTE: r'''\begin{quotation}
+%(str)s
\end{quotation}''',
VERBATIM: r'''\noindent
-\begin{verbatim}%(verb)s\end{verbatim}''',
+\begin{verbatim}%(verb)s\end{verbatim}
+''',
+
+ VERSION: program_version,
FILTER: r'''\begin{lilypond}[%(options)s]
%(code)s
@@ -675,7 +780,9 @@ output = {
+ border="0"
+ src="%(image)s"
+ alt="%(alt)s">
@end html
@@ -704,6 +811,8 @@ output = {
%(verb)s@end verbatim
''',
+ VERSION: program_version,
+
ADDVERSION: r'''@example
\version @w{"@version{}"}
@end example
@@ -728,14 +837,12 @@ PREAMBLE_LY = '''%%%% Generated by %(program_name)s
%% ****************************************************************
-%% Start cut-&-pastable-section
+%% Start cut-&-pastable-section
%% ****************************************************************
%(preamble_string)s
\paper {
- #(define dump-extents #t)
- %(font_dump_setting)s
%(paper_string)s
force-assignment = #""
line-width = #(- line-width (* mm %(padding_mm)f))
@@ -810,7 +917,7 @@ def find_file (name, raise_error=True):
full = os.path.join (i, name)
if os.path.exists (full):
return full
-
+
if raise_error:
error (_ ("file not found: %s") % name + '\n')
exit (1)
@@ -821,9 +928,38 @@ def verbatim_html (s):
re.sub ('<', '<',
re.sub ('&', '&', s)))
+ly_var_def_re = re.compile (r'^([a-zA-Z]+)[\t ]*=', re.M)
+ly_comment_re = re.compile (r'(%+[\t ]*)(.*)$', re.M)
+ly_context_id_re = re.compile ('\\\\(?:new|context)\\s+(?:[a-zA-Z]*?(?:Staff\
+(?:Group)?|Voice|FiguredBass|FretBoards|Names|Devnull))\\s+=\\s+"?([a-zA-Z]+)"?\\s+')
+
+def ly_comment_gettext (t, m):
+ return m.group (1) + t (m.group (2))
+
+def verb_ly_gettext (s):
+ if not document_language:
+ return s
+ try:
+ t = langdefs.translation[document_language]
+ except:
+ return s
+
+ s = ly_comment_re.sub (lambda m: ly_comment_gettext (t, m), s)
+
+ if langdefs.LANGDICT[document_language].enable_ly_identifier_l10n:
+ for v in ly_var_def_re.findall (s):
+ s = re.sub (r"(?m)(^|[' \\#])%s([^a-zA-Z])" % v,
+ "\\1" + t (v) + "\\2",
+ s)
+ for id in ly_context_id_re.findall (s):
+ s = re.sub (r'(\s+|")%s(\s+|")' % id,
+ "\\1" + t (id) + "\\2",
+ s)
+ return s
texinfo_lang_re = re.compile ('(?m)^@documentlanguage (.*?)( |$)')
def set_default_options (source, default_ly_options, format):
+ global document_language
if LINE_WIDTH not in default_ly_options:
if format == LATEX:
textwidth = get_latex_textwidth (source)
@@ -831,9 +967,9 @@ def set_default_options (source, default_ly_options, format):
elif format == TEXINFO:
m = texinfo_lang_re.search (source)
if m and not m.group (1).startswith ('en'):
- default_ly_options[LANG] = m.group (1)
+ document_language = m.group (1)
else:
- default_ly_options[LANG] = ''
+ document_language = ''
for regex in texinfo_line_widths:
# FIXME: @layout is usually not in
# chunk #0:
@@ -856,7 +992,7 @@ class Chunk:
def is_plain (self):
return False
-
+
class Substring (Chunk):
"""A string that does not require extra memory."""
def __init__ (self, source, start, end, line_number):
@@ -865,7 +1001,7 @@ class Substring (Chunk):
self.end = end
self.line_number = line_number
self.override_text = None
-
+
def is_plain (self):
return True
@@ -911,7 +1047,12 @@ class LilypondSnippet (Snippet):
self.do_options (os, self.type)
def verb_ly (self):
- return self.substring ('code')
+ verb_text = self.substring ('code')
+ if not NOGETTEXT in self.option_dict:
+ verb_text = verb_ly_gettext (verb_text)
+ if not verb_text.endswith ('\n'):
+ verb_text += '\n'
+ return verb_text
def ly (self):
contents = self.substring ('code')
@@ -965,6 +1106,12 @@ class LilypondSnippet (Snippet):
if k not in self.option_dict:
self.option_dict[k] = default_ly_options[k]
+ # RELATIVE does not work without FRAGMENT;
+ # make RELATIVE imply FRAGMENT
+ has_relative = self.option_dict.has_key (RELATIVE)
+ if has_relative and not self.option_dict.has_key (FRAGMENT):
+ self.option_dict[FRAGMENT] = None
+
if not has_line_width:
if type == 'lilypond' or FRAGMENT in self.option_dict:
self.option_dict[RAGGED_RIGHT] = None
@@ -984,13 +1131,16 @@ class LilypondSnippet (Snippet):
if not INDENT in self.option_dict:
self.option_dict[INDENT] = '0\\mm'
- # The QUOTE pattern from ly_options only emits the `line-width'
- # keyword.
- if has_line_width and QUOTE in self.option_dict:
- if no_line_width_value:
- del self.option_dict[LINE_WIDTH]
- else:
- del self.option_dict[QUOTE]
+ # Set a default line-width if there is none. We need this, because
+ # lilypond-book has set left-padding by default and therefore does
+ # #(define line-width (- line-width (* 3 mm)))
+ # TODO: Junk this ugly hack if the code gets rewritten to concatenate
+ # all settings before writing them in the \paper block.
+ if not LINE_WIDTH in self.option_dict:
+ if not QUOTE in self.option_dict:
+ if not LILYQUOTE in self.option_dict:
+ self.option_dict[LINE_WIDTH] = "#(- paper-width \
+left-margin-default right-margin-default)"
def compose_ly (self, code):
if FRAGMENT in self.option_dict:
@@ -1090,9 +1240,6 @@ class LilypondSnippet (Snippet):
notes_string = '\n '.join (compose_dict[NOTES]) % vars ()
preamble_string = '\n '.join (compose_dict[PREAMBLE]) % override
padding_mm = global_options.padding_mm
- font_dump_setting = ''
- if FONTLOAD in self.option_dict:
- font_dump_setting = '#(define-public force-eps-font-include #t)\n'
d = globals().copy()
d.update (locals())
@@ -1100,11 +1247,19 @@ class LilypondSnippet (Snippet):
def get_checksum (self):
if not self.checksum:
- hash = md5.md5 (self.relevant_contents (self.full_ly ()))
+ # Work-around for md5 module deprecation warning in python 2.5+:
+ try:
+ from hashlib import md5
+ except ImportError:
+ from md5 import md5
+
+ # We only want to calculate the hash based
+ # on the snippet code, not the snippet + preamble
+ hash = md5 (self.relevant_contents (self.ly ()))
## let's not create too long names.
self.checksum = hash.hexdigest ()[:10]
-
+
return self.checksum
def basename (self):
@@ -1123,7 +1278,8 @@ class LilypondSnippet (Snippet):
file (path + '.txt', 'w').write ('image of music')
def relevant_contents (self, ly):
- return re.sub (r'\\(version|sourcefileline|sourcefilename)[^\n]*\n', '', ly)
+ return re.sub (r'\\(version|sourcefileline|sourcefilename)[^\n]*\n|' +
+ NOGETTEXT + '[,\]]', '', ly)
def link_all_output_files (self, output_dir, output_dir_files, destination):
existing, missing = self.all_output_files (output_dir, output_dir_files)
@@ -1143,7 +1299,7 @@ class LilypondSnippet (Snippet):
os.makedirs (dst_path)
os.link (src, dst)
-
+
def all_output_files (self, output_dir, output_dir_files):
"""Return all files generated in lily_output_dir, a set.
@@ -1156,7 +1312,7 @@ class LilypondSnippet (Snippet):
def consider_file (name):
if name in output_dir_files:
result.add (name)
-
+
def require_file (name):
if name in output_dir_files:
result.add (name)
@@ -1171,12 +1327,22 @@ class LilypondSnippet (Snippet):
if not skip_lily:
require_file (base + '-systems.count')
+ if 'ddump-profile' in global_options.process_cmd:
+ require_file (base + '.profile')
+ if 'dseparate-log-file' in global_options.process_cmd:
+ require_file (base + '.log')
+
map (consider_file, [base + '.tex',
base + '.eps',
base + '.texidoc',
+ base + '.doctitle',
base + '-systems.texi',
base + '-systems.tex',
base + '-systems.pdftexi'])
+ if document_language:
+ map (consider_file,
+ [base + '.texidoc' + document_language,
+ base + '.doctitle' + document_language])
# UGH - junk global_options
if (base + '.eps' in result and self.format in (HTML, TEXINFO)
@@ -1191,17 +1357,24 @@ class LilypondSnippet (Snippet):
system_count = 0
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)
require_file (systemfile + '.eps')
consider_file (systemfile + '.pdf')
-
+
+ # We can't require signatures, since books and toplevel
+ # markups do not output a signature.
+ if 'ddump-signature' in global_options.process_cmd:
+ consider_file (systemfile + '.signature')
+
+
return (result, missing)
-
+
def is_outdated (self, output_dir, current_files):
found, missing = self.all_output_files (output_dir, current_files)
return missing
-
+
def filter_text (self):
"""Run snippet bodies through a command (say: convert-ly).
@@ -1226,14 +1399,14 @@ class LilypondSnippet (Snippet):
single = '%(base)s.png' % vars ()
multiple = '%(base)s-page1.png' % vars ()
images = (single,)
- if (os.path.exists (multiple)
+ if (os.path.exists (multiple)
and (not os.path.exists (single)
or (os.stat (multiple)[stat.ST_MTIME]
> os.stat (single)[stat.ST_MTIME]))):
count = ps_page_count ('%(base)s.eps' % vars ())
images = ['%s-page%d.png' % (base, page) for page in range (1, count+1)]
images = tuple (images)
-
+
return images
def output_docbook (self):
@@ -1242,8 +1415,8 @@ class LilypondSnippet (Snippet):
for image in self.get_images ():
(base, ext) = os.path.splitext (image)
str += output[DOCBOOK][OUTPUT] % vars ()
- str += self.output_print_filename (DOCBOOK)
- if (self.substring('inline') == 'inline'):
+ str += self.output_print_filename (DOCBOOK)
+ if (self.substring('inline') == 'inline'):
str = '' + str + ' '
else:
str = '' + str + ' '
@@ -1251,7 +1424,7 @@ class LilypondSnippet (Snippet):
verb = verbatim_html (self.verb_ly ())
str = output[DOCBOOK][VERBATIM] % vars () + str
return str
-
+
def output_html (self):
str = ''
base = self.basename ()
@@ -1302,7 +1475,7 @@ class LilypondSnippet (Snippet):
if 0:
breaks = self.ly ().count ("\n")
str += "".ljust (breaks, "\n").replace ("\n","%\n")
-
+
if QUOTE in self.option_dict:
str = output[LATEX][QUOTE] % vars ()
return str
@@ -1319,9 +1492,16 @@ class LilypondSnippet (Snippet):
def output_texinfo (self):
str = self.output_print_filename (TEXINFO)
base = self.basename ()
+ if DOCTITLE in self.option_dict:
+ doctitle = base + '.doctitle'
+ translated_doctitle = doctitle + document_language
+ if os.path.exists (translated_doctitle):
+ str += '@lydoctitle %s\n\n' % open (translated_doctitle).read ()
+ elif os.path.exists (doctitle):
+ str += '@lydoctitle %s\n\n' % open (doctitle).read ()
if TEXIDOC in self.option_dict:
texidoc = base + '.texidoc'
- translated_texidoc = texidoc + default_ly_options[LANG]
+ translated_texidoc = texidoc + document_language
if os.path.exists (translated_texidoc):
str += '@include %(translated_texidoc)s\n\n' % vars ()
elif os.path.exists (texidoc):
@@ -1363,6 +1543,10 @@ class LilypondFileSnippet (LilypondSnippet):
s = self.contents
s = re_begin_verbatim.split (s)[-1]
s = re_end_verbatim.split (s)[0]
+ if not NOGETTEXT in self.option_dict:
+ s = verb_ly_gettext (s)
+ if not s.endswith ('\n'):
+ s += '\n'
return s
def ly (self):
@@ -1371,11 +1555,21 @@ class LilypondFileSnippet (LilypondSnippet):
% (name, self.contents))
+class LilyPondVersionString (Snippet):
+ """A string that does not require extra memory."""
+ def __init__ (self, type, match, format, line_number):
+ Snippet.__init__ (self, type, match, format, line_number)
+
+ def replacement_text (self):
+ return output[self.format][self.type]
+
+
snippet_type_to_class = {
'lilypond_file': LilypondFileSnippet,
'lilypond_block': LilypondSnippet,
'lilypond': LilypondSnippet,
'include': IncludeSnippet,
+ 'lilypondversion': LilyPondVersionString,
}
def find_linestarts (s):
@@ -1418,7 +1612,7 @@ def find_toplevel_snippets (input_string, format, types):
for type in types:
if not found[type] or found[type][0] < index:
found[type] = None
-
+
m = res[type].search (input_string[index:endex])
if not m:
continue
@@ -1437,8 +1631,8 @@ def find_toplevel_snippets (input_string, format, types):
found[type] = (start, snip)
- if (found[type]
- and (not first
+ if (found[type]
+ and (not first
or found[type][0] < found[first][0])):
first = type
@@ -1471,7 +1665,7 @@ def find_toplevel_snippets (input_string, format, types):
def filter_pipe (input, cmd):
"""Pass input through cmd, and return the result."""
-
+
if global_options.verbose:
progress (_ ("Opening filter `%s'") % cmd)
@@ -1506,13 +1700,13 @@ def system_in_directory (cmd, directory):
Because of win32 compatibility, we can't simply use subprocess.
"""
-
+
current = os.getcwd()
os.chdir (directory)
- ly.system(cmd, be_verbose=global_options.verbose,
+ ly.system(cmd, be_verbose=global_options.verbose,
progress_p=1)
os.chdir (current)
-
+
def process_snippets (cmd, snippets,
format, lily_output_dir):
@@ -1520,23 +1714,23 @@ def process_snippets (cmd, snippets,
if not snippets:
return
-
+
if format in (HTML, TEXINFO) and '--formats' not in cmd:
cmd += ' --formats=png '
elif format in (DOCBOOK) and '--formats' not in cmd:
cmd += ' --formats=png,pdf '
checksum = snippet_list_checksum (snippets)
- contents = '\n'.join (['snippet-map-%d.ly' % checksum]
+ contents = '\n'.join (['snippet-map-%d.ly' % checksum]
+ [snip.basename() + '.ly' for snip in snippets])
name = os.path.join (lily_output_dir,
'snippet-names-%d.ly' % checksum)
file (name, 'wb').write (contents)
- system_in_directory (' '.join ([cmd, name]),
+ system_in_directory (' '.join ([cmd, ly.mkarg (name)]),
lily_output_dir)
-
-
+
+
###
# Retrieve dimensions from LaTeX
LATEX_INSPECTION_DOCUMENT = r'''
@@ -1554,13 +1748,13 @@ def get_latex_textwidth (source):
m = re.search (r'''(?P\\begin\s*{document})''', source)
if m == None:
warning (_ ("cannot find \\begin{document} in LaTeX document"))
-
+
## what's a sensible default?
return 550.0
-
+
preamble = source[:m.start (0)]
latex_document = LATEX_INSPECTION_DOCUMENT % vars ()
-
+
(handle, tmpfile) = tempfile.mkstemp('.tex')
logfile = os.path.splitext (tmpfile)[0] + '.log'
logfile = os.path.split (logfile)[1]
@@ -1568,25 +1762,26 @@ def get_latex_textwidth (source):
tmp_handle = os.fdopen (handle,'w')
tmp_handle.write (latex_document)
tmp_handle.close ()
-
- ly.system ('latex %s' % tmpfile, be_verbose=global_options.verbose)
+
+ ly.system ('%s %s' % (global_options.latex_program, tmpfile),
+ be_verbose=global_options.verbose)
parameter_string = file (logfile).read()
-
+
os.unlink (tmpfile)
os.unlink (logfile)
columns = 0
- m = re.search ('columns=([0-9.]*)', parameter_string)
+ m = re.search ('columns=([0-9.]+)', parameter_string)
if m:
columns = int (m.group (1))
columnsep = 0
- m = re.search ('columnsep=([0-9.]*)pt', parameter_string)
+ m = re.search ('columnsep=([0-9.]+)pt', parameter_string)
if m:
columnsep = float (m.group (1))
textwidth = 0
- m = re.search ('textwidth=([0-9.]*)pt', parameter_string)
+ m = re.search ('textwidth=([0-9.]+)pt', parameter_string)
if m:
textwidth = float (m.group (1))
if columns:
@@ -1602,7 +1797,7 @@ def modify_preamble (chunk):
r"\\usepackage{graphics}" + '\n'
+ r"\\begin{document}",
str)
- chunk.override_text = str
+ chunk.override_text = str
format2ext = {
@@ -1650,8 +1845,8 @@ def do_process_cmd (chunks, input_name, options):
output_files = split_output_files (options.lily_output_dir)
outdated = [c for c in snippets if c.is_outdated (options.lily_output_dir, output_files)]
-
- write_file_map (outdated, input_name)
+
+ write_file_map (outdated, input_name)
progress (_ ("Writing snippets..."))
for snippet in outdated:
snippet.write_ly()
@@ -1715,9 +1910,14 @@ def write_if_updated (file_name, lines):
# this prevents make from always rerunning lilypond-book:
# output file must be touched in order to be up to date
os.utime (file_name, None)
+ return
except:
pass
+ output_dir = os.path.dirname (file_name)
+ if not os.path.exists (output_dir):
+ os.makedirs (output_dir)
+
progress (_ ("Writing `%s'...") % file_name)
file (file_name, 'w').writelines (lines)
progress ('\n')
@@ -1736,7 +1936,7 @@ def samefile (f1, f2):
f2 = re.sub ("//*", "/", f2)
return f1 == f2
-def do_file (input_filename):
+def do_file (input_filename, included=False):
# Ugh.
if not input_filename or input_filename == '-':
in_handle = sys.stdin
@@ -1754,6 +1954,8 @@ def do_file (input_filename):
if input_filename == '-':
input_base = 'stdin'
+ elif included:
+ input_base = os.path.splitext (input_filename)[0]
else:
input_base = os.path.basename (
os.path.splitext (input_filename)[0])
@@ -1763,15 +1965,15 @@ def do_file (input_filename):
global_options.output_dir = os.getcwd()
else:
global_options.output_dir = os.path.abspath(global_options.output_dir)
-
+
if not os.path.isdir (global_options.output_dir):
os.mkdir (global_options.output_dir, 0777)
os.chdir (global_options.output_dir)
output_filename = os.path.join(global_options.output_dir,
input_base + format2ext[global_options.format])
- if (os.path.exists (input_filename)
- and os.path.exists (output_filename)
+ if (os.path.exists (input_filename)
+ and os.path.exists (output_filename)
and samefile (output_filename, input_fullname)):
error (
_ ("Output would overwrite input file; use --output."))
@@ -1796,6 +1998,7 @@ def do_file (input_filename):
'lilypond_file',
'include',
'lilypond',
+ 'lilypondversion',
)
progress (_ ("Dissecting..."))
chunks = find_toplevel_snippets (source, global_options.format, snippet_types)
@@ -1818,20 +2021,20 @@ def do_file (input_filename):
write_if_updated (output_filename,
[s.replacement_text ()
for s in chunks])
-
+
def process_include (snippet):
os.chdir (original_dir)
name = snippet.substring ('filename')
progress (_ ("Processing include: %s") % name)
progress ('\n')
- return do_file (name)
+ return do_file (name, included=True)
include_chunks = map (process_include,
filter (lambda x: isinstance (x, IncludeSnippet),
chunks))
return chunks + reduce (lambda x, y: x + y, include_chunks, [])
-
+
except CompileError:
os.chdir (original_dir)
progress (_ ("Removing `%s'") % output_filename)
@@ -1847,14 +2050,14 @@ def do_options ():
global_options.format = TEXINFO
global_options.include_path = map (os.path.abspath, global_options.include_path)
-
+
if global_options.warranty:
warranty ()
exit (0)
if not args or len (args) > 1:
opt_parser.print_help ()
exit (2)
-
+
return args
def main ():
@@ -1863,7 +2066,7 @@ def main ():
basename = os.path.splitext (files[0])[0]
basename = os.path.split (basename)[1]
-
+
if not global_options.format:
global_options.format = guess_format (files[0])
@@ -1872,25 +2075,30 @@ def main ():
formats += ',png'
if global_options.process_cmd == '':
- global_options.process_cmd = (lilypond_binary
+ global_options.process_cmd = (lilypond_binary
+ ' --formats=%s -dbackend=eps ' % formats)
if global_options.process_cmd:
- global_options.process_cmd += ' '.join ([(' -I %s' % ly.mkarg (p))
- for p in global_options.include_path])
+ includes = global_options.include_path
+ if global_options.lily_output_dir:
+ # This must be first, so lilypond prefers to read .ly
+ # files in the other lybookdb dir.
+ includes = [os.path.abspath(global_options.lily_output_dir)] + includes
+ global_options.process_cmd += ' '.join ([' -I %s' % ly.mkarg (p)
+ for p in includes])
if global_options.format in (TEXINFO, LATEX):
## prevent PDF from being switched on by default.
global_options.process_cmd += ' --formats=eps '
if global_options.create_pdf:
global_options.process_cmd += "--pdf -dinclude-eps-fonts -dgs-load-fonts "
-
+
if global_options.verbose:
global_options.process_cmd += " --verbose "
if global_options.padding_mm:
global_options.process_cmd += " -deps-box-padding=%f " % global_options.padding_mm
-
+
global_options.process_cmd += " -dread-file-list -dno-strip-output-dir"
if global_options.lily_output_dir:
@@ -1899,7 +2107,7 @@ def main ():
os.makedirs (global_options.lily_output_dir)
else:
global_options.lily_output_dir = os.path.abspath(global_options.output_dir)
-
+
identify ()
try:
@@ -1915,7 +2123,7 @@ def main ():
final_output_file = os.path.join (global_options.output_dir,
base_file_name
+ '.%s' % global_options.format)
-
+
os.chdir (original_dir)
file (dep_file, 'w').write ('%s: %s'
% (final_output_file, ' '.join (inputs)))