lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Identify included files


From: David Wright
Subject: Re: Identify included files
Date: Mon, 18 May 2020 10:35:01 -0500
User-agent: Mutt/1.10.1 (2018-07-13)

On Fri 15 May 2020 at 12:03:33 (-0400), Fr. Samuel Springuel wrote:
> > On 5/15/20, Fr. Samuel Springuel <address@hidden> wrote:
> >> Before I start writing a script to do this, is there an existing tool which
> >> will identify all the `\include` files that a LilyPond file depends on?
> >> Even better, one that will work in a recursive fashion?
> 
> I’m hoping for something that doesn’t require actually typesetting the 
> document.  My end goal is a script which will somewhat intelligently 
> determine which files in a project have changed and re-typeset them as 
> needed.  Having to typeset the document in order to determine which files it 
> depends on means I’ve already done the typesetting.  Is there a way to pass 
> that and \set Score.skipTypesetting = ##t at the command line?

If you follow some simple rules in your source layout, constructing
such a list might be most straightforward to do in the shell, using
grep. For example,

$ grep -e '^[[:space:]]*\\include ' foo-top-level.ly

will find all the includes in the source, restricting it to the start
of lines, so that you can avoid false hits from, say, internal
documentation or test includes.

You would insert the resulting filenames into two lists, files visited
and all files. Iterate on the files list, skipping those visited,
until the files to visit reaches zero (lists are of equal length).

One complication is applying the search of libraries in the same
manner as LP, particularly if you rely on the order of searching.
Another is if you're using external libraries where you have no
control over their include format.

If you're not comfortable with shell programming, obviously it would
be preferable to use a language like Python or Perl for coding.

The resulting list could be used for, say, making a tarball of source
files for distribution, or for driving make to produce PDFs that are
assembled by, say, TeX programs into final documents.

Cheers,
David.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]