Gentoo Archives: gentoo-guis

From: Brian <dol-sen@×××××.net>
To: gentoo-guis@l.g.o
Subject: [gentoo-guis] new gettext like command retrieval
Date: Wed, 14 May 2008 13:31:29
Message-Id: 1210771958.18161.77.camel@localhost
I've put together a little test config file and extremely basic

It works quite well from my live python trials.

brian@big_squirt ~/porthole/trunk/porthole/backends/test $ python
Python 2.5.2 (r252:60911, Apr 25 2008, 19:29:41) 
[GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from commands import get_cmd as g >>> from commands import get_sections, get_items, get_options >>> get_sections()
['sync', 'install_opts', 'update', 'install', 'uninstall']
>>> get_options('install')
['install_pv', 'install_p', 'install']
>>> get_items('install')
[('install_pv', 'emerge -pv'), ('install_p', 'emerge -p'), ('install', 'emerge')]
>>> g('install','install_p')
'emerge -p'
>>> g('install','install_pv')
'emerge -pv'
Of course it can be refined a lot more, but seems to work quite well. I will need to change the way porthole builds it commands to be more compatible with pkgcore. But I think this method will work better overall. I have had requests for the ability to specify custom scripts for several of the currently hard coded 'emerge' commands. That part of it can be taken care of by checking for a users ~/.porthole/portage.cfg or ~/.porthole/pkgcore.cfg depending on the backend selected and using it instead of the pre-configured one in the backend subdirectory. -- Brian <dol-sen@×××××.net>


File name MIME type text/x-python
portage.cfg text/plain