[Yum] HTTP/FTP Authentication

Michael Stenner mstenner at phy.duke.edu
Wed Jul 30 00:02:37 UTC 2003

On Tue, Jul 29, 2003 at 07:11:47PM -0400, seth vidal wrote:
> in 2.x you could maybe grab __version__ from yummain - or find a way of
> setting it from there
> or alternatively, push it into conf as  conf.version, or the reverse.
> you get the idea.
> I couldn't put version in the config stuff for the --version command b/c
> that part happens before the config exists - but certainly we could
> conf.version = __version__ after the conf has been setup.

OK, I feel a little silly.  I didn't know that was available at all.
I agree.  Probably the cleanest way to do it is to push it in from
yummain.  You could do that in two ways:

1) by importing urlgrabber from within yummain (making yummain depend
   on urlgrabber directly is no big deal because it already depends on
   it indirectly via clientStuff)

   # <within yummain.py>
   import urlgrabber
   urlgrabber.set_user_agent('Yum/%s' % __version__)

2) by going "through" clientStuff

   # <within yummain.py>
   clientStuff.urlgrabber.set_user_agent('Yum/%s' % __version__)

They're functionally identical.  It's just a matter of which is more
aesthetically appealing :)

  Michael Stenner                       Office Phone: 919-660-2513
  Duke University, Dept. of Physics       mstenner at phy.duke.edu
  Box 90305, Durham N.C. 27708-0305

More information about the Yum mailing list