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]
str(object='') -> string
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
Functions [hide private]
_cmp_lang(a, b) source code
Records are wrapped in XML as per GLEP 56 returns a dict with keys constisting of USE flag names and values containing their respective descriptions
source code
Variables [hide private]
  _lang_pref = {u'': 0, u'en': 1}
  __package__ = 'portage.xml'

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