[Calypso] [PATCH] Allow to override calypso's config dir

Guido Günther agx at sigxcpu.org
Sun Jan 24 10:13:56 PST 2016


On Sun, Jan 24, 2016 at 04:39:16PM +0000, Jelmer Vernooij wrote:
> On Sun, Jan 24, 2016 at 12:37:46PM +0100, Petter Reinholdtsen wrote:
> > Here is another patch from Guido, found via
> > <URL: git://prometheus.amsuess.com/calypso-patches >.  He added this
> > comment to it in 2014:
> > 
> >   This can be useful when running automatic tests via e.g. autopkgtest
> >   where we want to have all files in a temporary directory.
> > 
> > diff --git a/calypso/config.py b/calypso/config.py
> > index dc17eec..59cbd85 100644
> > --- a/calypso/config.py
> > +++ b/calypso/config.py
> > @@ -72,6 +72,9 @@ for section, values in INITIAL_CONFIG.items():
> >  
> >  _CONFIG_PARSER.read("/etc/calypso/config")
> >  _CONFIG_PARSER.read(os.path.expanduser("~/.config/calypso/config"))
> > +cfg = os.getenv("CALYPSO_CONFIG")
> > +if cfg:
> > +    _CONFIG_PARSER.read(cfg)
> >  
> >  # Wrap config module into ConfigParser instance
> >  sys.modules[__name__] = _CONFIG_PARSER
> 
> LGTM. Should this override the existing config, rather than adding to
> it?

Good point. I wonder if it wouldn't be better to add a --config option
to give the config file explicitly instead of using an env var? So I
think we can hold this off until we really need it.

Cheers,
 -- Guido


More information about the Calypso mailing list