[Yum-devel] Re: [Yum] repository wildcards
Terrel Shumway
terrel at gmail.com
Tue Feb 22 06:01:27 UTC 2005
> just letting you know, now - I won't merge a patch that add that's
> option in. repoglobbing is a edge-case as it is - regex matching on repo
> name is downright obscure.
Fair enough. Anyone who is dead set on it can always make their own client.
findRepos is probably more useful in a GUI client anyway.
> why add complexity to the code just to return a generator? What's the
> perk, here?
I don't see this as adding complexity. Generators more often
simplify the code. but this isn't a particularly good example of
that, since it is pretty simple to begin with.
(You could very well argue that the type dispatching
adds unnecessary complexity, but the generator? no.)
> >Yes, but I didn't notice any particularly obvious way to do that.
> >If there were a logging object floating around, I would say
> > log.warn("wildcard pattern did not match any repository %s",pat)
> >but I didn't notice any other code in repos.py doing that.
>
> repos can't have a log object b/c there isn't necessarily one around yet
Why not? Add two lines to the top of the module
import logging
log = logging.getLogger("yum.repos")
and in __main__ (before any other code dreams of being run)
import logging
logging.basicConfig() # pipes the root logger to sys.stderr
log = logging.getLogger("yum.cli")
The thing I like most about the logging module is that it is dirt-simple
to turn it on and go on with your programming.
(oops. logging didn't get added to the standard library until 2.3.)
> when repos are parsed but it can raise exceptions that are dealt with.
But they have to be dealt with by every piece of code that uses it.
logging is transparent. Code that really cares that no repos matched
can explicitly watch for that condition.
More information about the Yum-devel
mailing list