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()
['no-herd']
>>> for maint in pkg_md.maintainers():
...     print "{0} ({1})".format(maint.email, maint.name)
...
nixphoeni@gentoo.org (Joe Sapp)
>>> for flag in pkg_md.use():
...     print flag.name, "->", 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 'Thomas_Hinkle@alumni.brown.edu'>], 'bugtracker': [],
 'changelog': []}>]
>>> upstream[0].maintainer[0].name
'Thomas Mills Hinkle'
Classes [hide private]
  _MetadataTreeBuilder
Implements doctype() as required to avoid deprecation warnings with Python >=2.7.
  _Maintainer
An object for representing one maintainer.
  _Useflag
An object for representing one USE flag.
  _Upstream
An object for representing one package's upstream.
  MetaDataXML
Access metadata.xml
Variables [hide private]
  __package__ = 'portage.xml'

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