注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Package:Appi

From Funtoo
Revision as of 12:20, August 26, 2017 by Pytony (talk | contribs) (Created page with "{{Ebuild |Summary=Another Portage Python Interface |CatPkg=dev-python/appi |Maintainer=pytony |Homepage=https://appi.readthedocs.io/ }} Appi is a python module to deal with p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Appi

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


Appi is a python module to deal with portage. It is an alternative to the official portage python module. It is designed to be more accessible to newcomers, which concretely consists in a:

Examples

Let's say you want to list all ebuilds matching an atom. With appi, nothing's easier:

user $ python
Python 3.5.3 (default, Jul 30 2017, 22:03:59) 
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import appi
>>> atom = appi.QueryAtom('~media-gfx/gimp-2.9.4')                                                                                     
>>> atom
<QueryAtom: '~media-gfx/gimp-2.9.4'>
>>> atom.list_matching_ebuilds()
{<Ebuild: 'media-gfx/gimp-2.9.4-r2::media-kit'>, <Ebuild: 'media-gfx/gimp-2.9.4-r1::media-kit'>}
>>> 

Want to know if an ebuild matching this atom is installed? Not even harder:

>>> atom.is_installed()
True
>>> # Want to know which one?
>>> for ebuild in atom.list_matching_ebuilds():
...     if ebuild.is_installed():
...         print("{} is installed".format(ebuild))
...     else:
...         print("{} is not installed".format(ebuild))
...
media-gfx/gimp-2.9.4-r2::media-kit is installed
media-gfx/gimp-2.9.4-r1::media-kit is not installed
>>>

Please read the docs for a complete overview of appi.

Contributing

Appi is still at an early stage. If you're interested in contributing to it, please contact me (pytony) on IRC. Whatever the help you can provide, it will be greatly appreciated.