On Sat, Apr 13, 2013 at 03:23:43AM +0200, Daniel Dehennin wrote:
> Hello,
> 
> I just began to work on this issue on a temporary branch[1].
> 
> I wonder if we could not factorize the string expansion across all tools
> and how we could do it.

This would need a new section in gbp.conf

[replacements]
last_upstream = ...
foo = cmd1
bar = cmd2

Im undecided if the rhs should be evaluated by a shell or by python but
we probably want both.

> One option is to factorize the options management in reusable parsers
> and let all tools use them with the "parents" option of
> "argparse.ArgumentParser", then we could add an "expand" method to the
> "options" and use it when needed.

If you create a derived class from string and return that from optparse
you can use "{foo} {bar}".format() whenever the actual option gets used
(not when evaluated during Option.parse()). Isn't ttmore what we want?
You'd need to override the format() method of that new string class of
course to fill in all values from replacements by default. Does this
make sense?
Cheers,
 -- Guido

> 
> Any idea?
> 
> Regards.
> 
> 
> Footnotes: 
> [1]  
> http://git.baby-gnu.net/gitweb/?p=git-buildpackage.git;a=shortlog;h=refs/heads/feature/git-dch-define-more-replacement-strings
> 
> -- 
> Daniel Dehennin
> Récupérer ma clef GPG:
> gpg --keyserver pgp.mit.edu --recv-keys 0x7A6FE2DF


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to