lilypond-user
[Top][All Lists]
Advanced

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

Re: Identify included files


From: Urs Liska
Subject: Re: Identify included files
Date: Mon, 18 May 2020 17:47:15 +0200
User-agent: Evolution 3.36.2-1

Am Montag, den 18.05.2020, 10:35 -0500 schrieb David Wright:
> 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.
> 

The include files may live in totally different directories, which are
essentially knows to LilyPond only.

I'm pretty sure that the only two ways to reasonably go forward is to
either invoke LilyPond to produce this list or to use a library that
already knows how LilyPond works. As I mentioned somewhere at the top
of this thread, Frescobaldi knows pretty well how to recurse into the
include files.

I would write a tool in Python that calls python-ly (well, probably
quickly, it's designated successor (
https://github.com/frescobaldi/quickly)) to produce the list of
dependencies and feed that into Make.

Urs

> 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]