lilypond-devel
[Top][All Lists]
Advanced

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

Re: Re-write of documentation tree build process


From: John Mandereau
Subject: Re: Re-write of documentation tree build process
Date: Sun, 17 Dec 2006 16:04:29 +0100

Han-Wen Nienhuys wrote: 
> First of all: do you think you could shove the entire 
> 
>   local-WWW-post
> 
> target into a python script? In that case, we don't need any awkward
> quoting, and can junk most of the command line decoding, as we could
> do
> 
>   import mirrortree
>   mirrortree.miror_tree ('out-www/offline-webroot', {'ignore-dirs': 
> 'foo.*(ext|') , 'lose-dirs': 'more-regexes'})
> 
> (or use keyword arguments to pass options.)    

Agreed. It would make build-trees.py twice shorter. There should also be
a langdefs.py module centralizing language definitions: it would be used
by add-html-footer.py, html-gettext.py, and Documentation/GNUmakefile.


> > diff --git a/stepmake/bin/add-html-footer.py 
> > b/stepmake/bin/add-html-footer.py
> > index 08ff5ff..9a28237 100644
> > --- a/stepmake/bin/add-html-footer.py
> > +++ b/stepmake/bin/add-html-footer.py
> > @@ -13,7 +13,7 @@ import getopt
> >  index_url=''
> >  top_url=''
> >  changelog_file=''
> > -content_negotiation = False
> > +targets = []
> 
> I think that this script could be cleaned up a lot if didn't try to do
> two targets in one go. Can you look into doing something like
> 
>   find  online-root -name '*.html' | xargs $(footify)
>   find  offline-root -name '*.html' | xargs $(footify)

It's easily doable if:
-- all .html are hardlinked in both targets by build-trees, so the
"specific files" (ie. HTML files) stuff could be dropped.
-- add-html-footer is called for each target; for each .html file, it
reads it, unlink it, process the page and write it.
So, let's change to that.

[...]
> Nowadays, optparse is the standard module for handling option
> parsing. Can you change to that?  See lilypond-book.py
> (get_option_parser) for an example how to use.

It won't be necessary, as I'm going to re-write build-trees (renamed
into mirrortree) and add-html-footer as modules.


> > +for s in ['common_f', 'specific_f', 'excluded_d',
> > +          'excluded_f', 'process_d', 'lost_d_names']:
> > +    exec s + '_re = re.compile (' + s + ')'
> 
> 
> Don't use exec. If you must, try
> 
> 
>   locals()[s + "_re"] = ..

I only used that to avoid typing six times the same line of code.


> what's _f and _d?  Write _dir or _file if you mean that. 

Yes, I mean that.


> usually, list comprehensions  are shorter and clearer,
> 
>   [p % s for p in targets]

Oh, yes , I didn't remember that possibility in Python.

I'm sending another patch according to your comments asap.

Cheers
-- 
John Mandereau <address@hidden>





reply via email to

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