This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
packages:python-poldek [2006-06-07 01:42] glen |
packages:python-poldek [2008-07-29 20:00] grizz more adequate name |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | |||
- | |||
- | ====== Poldek unofficial Python bindings ====== | ||
- | 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. | ||
- | |||
- | |||
- | |||
- | <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() | ||
- | >>> print ctx | ||
- | <C poldek_ctx instance at _e0b70708_p_poldek_ctx> | ||
- | >>> ctx.load_config("foo") | ||
- | error: foo: No such file or directory | ||
- | 0 | ||
- | >>> ctx.setup() | ||
- | 1 | ||
- | >>> allpkg = ctx.get_avail_packages() | ||
- | |||
- | </file> | ||
- | |||
- | |||
- | ===== poldek_ctx ===== | ||
- | |||
- | * ctx.load_config(CONFIGFILE) | ||
- | CONFIGFILE string path to config file | ||
- | |||
- | |||
- | * ctx.configure(CONSTANT, "value") | ||
- | |||
- | |||
- | <file>>>> import poldekmod | ||
- | >>> ctx.configure(poldekmod.POLDEK_CONF_PM, "vrpm") | ||
- | 1 | ||
- | >>> ctx.configure(poldekmod.POLDEK_CONF_CACHEDIR, "/tmp/cache") | ||
- | 1 | ||
- | </file> | ||
- | |||
- | |||
- | ===== poldek_ts ===== | ||
- | poldek_ts(ctx, FLAGS) | ||
- | |||
- | where flags can be (from poldek_ts.c::poldek_ts_setf): | ||
- | |||
- | |||
- | * POLDEK_TS_INSTALL | ||
- | * POLDEK_TS_UNINSTALL | ||
- | * POLDEK_TS_VERIFY | ||
- | |||
- | |||
- | <file>>>> ts = poldek.poldek_ts(ctx, 0) | ||
- | >>> ts = poldek.poldek_ts(ctx, poldekmod.POLDEK_TS_INSTALL) | ||
- | </file> | ||
- | |||
- | |||
- | ===== poclidek_ctx ===== | ||
- | |||
- | |||
- | <file>>>> cctx = poldek.poclidek_ctx(ctx) | ||
- | >>> cmd = cctx.rcmd_new(ts) | ||
- | |||
- | </file> | ||