This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
packages:python-poldek [2006-06-07 01:49] glen |
packages:python-poldek [2013-04-10 14:45] (current) glen Page name changed from packages:poldekpythonbindings to packages:python-poldek |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | /* page was renamed from Packages/Poldek */ | ||
Line 4: | Line 5: | ||
Here's some information i managed to gather by looking at swig source and py code. A lot of help gave ''cli/test_cli.c'', had no clue where to start from. | Here's some information i managed to gather by looking at swig source and py code. A lot of help gave ''cli/test_cli.c'', had no clue where to start from. | ||
+ | You may also find useful [[http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/poldek/poldek/python/test.py|poldek/python/test.py]] from poldek cvs | ||
- | |||
- | <file>$ python | ||
- | Python 2.4.3 (#1, May 15 2006, 19:23:25) | ||
- | [GCC 3.3.6 (PLD Linux)] on linux2 | ||
- | Type "help", "copyright", "credits" or "license" for more information. | ||
- | >>> import poldek | ||
- | >>> poldek.lib_init() | ||
- | >>> ctx = poldek.poldek_ctx() | ||
- | >>> ctx.load_config("/etc/poldek/poldek.conf") | ||
- | >>> ctx.setup() | ||
- | 1 | ||
- | >>> allpkg = ctx.get_avail_packages() | ||
- | </file> | ||
===== poldek_ctx ===== | ===== poldek_ctx ===== | ||
+ | |||
+ | |||
+ | <file>import poldek | ||
+ | poldek.lib_init() | ||
+ | ctx = poldek.poldek_ctx() | ||
+ | ctx.load_config("/etc/poldek/poldek.conf") | ||
+ | ctx.setup() | ||
+ | </file> | ||
* ctx.load_config(CONFIGFILE) | * ctx.load_config(CONFIGFILE) | ||
Line 34: | Line 31: | ||
>>> ctx.configure(poldekmod.POLDEK_CONF_CACHEDIR, "/tmp/cache") | >>> ctx.configure(poldekmod.POLDEK_CONF_CACHEDIR, "/tmp/cache") | ||
1 | 1 | ||
+ | </file> | ||
+ | |||
+ | * ctx.get_avail_packages() | ||
+ | sample | ||
+ | |||
+ | <file>print ctx.get_avail_packages() | ||
</file> | </file> | ||
Line 48: | Line 51: | ||
- | <file>>>> ts = poldek.poldek_ts(ctx, 0) | + | <file>ts = poldek.poldek_ts(ctx, 0) |
- | >>> ts = poldek.poldek_ts(ctx, poldekmod.POLDEK_TS_INSTALL) | + | ts = poldek.poldek_ts(ctx, poldekmod.POLDEK_TS_INSTALL) |
+ | ts = poldek.poldek_ts(ctx, poldekmod.POLDEK_OP_GREEDY) | ||
</file> | </file> | ||
Line 56: | Line 60: | ||
- | <file>>>> cctx = poldek.poclidek_ctx(ctx) | + | <file>cctx = poldek.poclidek_ctx(ctx) |
- | >>> cmd = cctx.rcmd_new(ts) | + | cmd = cctx.rcmd_new(ts) |
</file> | </file> | ||