Package portage :: Package xml :: Module metadata
[hide private]

Module metadata

source code

Provides an easy-to-use python interface to Gentoo's metadata.xml file.

Example usage:

>>> from portage.xml.metadata import MetaDataXML
>>> pkg_md = MetaDataXML('/usr/portage/app-misc/gourmet/metadata.xml')
>>> pkg_md
<MetaDataXML '/usr/portage/app-misc/gourmet/metadata.xml'>
>>> pkg_md.herds()
>>> for maint in pkg_md.maintainers():
...     print "{0} ({1})".format(,
... (Joe Sapp)
>>> for flag in pkg_md.use():
...     print, "->", flag.description
rtf -> Enable export to RTF
gnome-print -> Enable printing support using gnome-print
>>> upstream = pkg_md.upstream()
>>> upstream
[<_Upstream {'docs': [], 'remoteid': [], 'maintainer':
 [<_Maintainer ''>], 'bugtracker': [],
 'changelog': []}>]
>>> upstream[0].maintainer[0].name
'Thomas Mills Hinkle'
Classes [hide private]
Implements doctype() as required to avoid deprecation warnings with Python >=2.7.
An object for representing one maintainer.
An object for representing one USE flag.
An object for representing one package's upstream.
Access metadata.xml
Variables [hide private]
  __package__ = 'portage.xml'

Imports: sys, etree, ExpatError, re, xml, _encodings, _unicode_encode, unique_everseen