1 |
I've put together a little test config file and extremely basic |
2 |
commands.py. |
3 |
|
4 |
It works quite well from my live python trials. |
5 |
|
6 |
brian@big_squirt ~/porthole/trunk/porthole/backends/test $ python |
7 |
Python 2.5.2 (r252:60911, Apr 25 2008, 19:29:41) |
8 |
[GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2 |
9 |
Type "help", "copyright", "credits" or "license" for more information. |
10 |
>>> from commands import get_cmd as g |
11 |
>>> from commands import get_sections, get_items, get_options |
12 |
>>> get_sections() |
13 |
['sync', 'install_opts', 'update', 'install', 'uninstall'] |
14 |
>>> get_options('install') |
15 |
['install_pv', 'install_p', 'install'] |
16 |
>>> get_items('install') |
17 |
[('install_pv', 'emerge -pv'), ('install_p', 'emerge -p'), ('install', |
18 |
'emerge')] |
19 |
>>> g('install','install_p') |
20 |
'emerge -p' |
21 |
>>> g('install','install_pv') |
22 |
'emerge -pv' |
23 |
>>> |
24 |
|
25 |
|
26 |
Of course it can be refined a lot more, but seems to work quite well. I |
27 |
will need to change the way porthole builds it commands to be more |
28 |
compatible with pkgcore. But I think this method will work better |
29 |
overall. I have had requests for the ability to specify custom scripts |
30 |
for several of the currently hard coded 'emerge' commands. That part of |
31 |
it can be taken care of by checking for a users ~/.porthole/portage.cfg |
32 |
or ~/.porthole/pkgcore.cfg depending on the backend selected and using |
33 |
it instead of the pre-configured one in the backend subdirectory. |
34 |
-- |
35 |
Brian <dol-sen@×××××.net> |