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:33] 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. | ||
- | Very first success: | + | 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() | ||
- | >>> print ctx | ||
- | <C poldek_ctx instance at _e0b70708_p_poldek_ctx> | ||
- | >>> ctx.load_config("foo") | ||
- | error: foo: No such file or directory | ||
- | 0 | ||
- | >>> | ||
- | </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 36: | 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 50: | 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 58: | 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> | ||
+ | |||
+ | |||
+ | ===== poclidek_rcmd ===== | ||
+ | |||
+ | |||
+ | <file>>>> rcmd = poldek.poclidek_rcmd(cctx, ts) | ||
+ | >>> rcmd.execline("ls xmms*") | ||
+ | 1 | ||
+ | >>> a = rcmd.get_packages() | ||
+ | >>> print a | ||
+ | [xmms-1.2.10-4, xmms-alarm-0.3.6-1, xmms-clxmms-0.6-4, xmms-devel-1.2.10-4, xmms-effect-liveice-1.0.0-7, xmms-effect-rva-0.7.6-4, xmms-effect-volnorm-0.4.1-1, xmms-general-audioscrobbler-0.3.6-1, xmms-general-crystality-0.92-4, xmms-general-goodnight-0.3.2-3, xmms-general-infopipe-1.3-25, xmms-general-lirc-1.2-5, xmms-general-status-1.0-4, xmms-general-xosd-2.2.10-1, xmms-gnome-mime-info-1.2.10-4, xmms-imms-1.1-1, xmms-input-cdaudio-1.2.10-4, xmms-input-faad2-2.0-5.3, xmms-input-faad2-2.0-6, xmms-input-flac-1.1.2-3, xmms-input-midi-0.03-4, xmms-input-mikmod-1.2.10-4, xmms-input-modplug-2.05-2, xmms-input-mpg123-1.2.10-4, xmms-input-musepack-1.2-1, xmms-input-nosefart-2.0-2, xmms-input-sap-0.4-3, xmms-input-sid-0.8.0beta10-3, xmms-input-sndfile-1.2-1, xmms-input-speex-0.9.1-1, xmms-input-tonegen-1.2.10-4, xmms-input-uade-1.03-1, xmms-input-vorbis-1.2.10-4, xmms-input-vqf-0.94-1, xmms-input-vtx-0.8.1-1, xmms-input-wav-1.2.10-4, xmms-input-wma-1.0.3-1, xmms-input-xmp-2.0.5-0.pre3.3, xmms-kde-3.1-2, xmms-libs-1.2.10-4, xmms-output-ALSA-1.2.10-4, xmms-output-OSS-1.2.10-4, xmms-output-arts-0.7.1-1, xmms-output-crossfade-0.3.8-1, xmms-output-disk-1.2.10-4, xmms-output-esd-1.2.10-4, xmms-output-jack-0.10-1, xmms-output-lame-0.2.2-3, xmms-output-ogg-0.2-3, xmms-shell-0.99.3-2, xmms-skin-2K-1.0-7, xmms-skin-Advanced-1.0-7, xmms-skin-BlackDawn-1.0-7, xmms-skin-BlueSteel-1.0-7, xmms-skin-Bluecurve-0.117-2, xmms-skin-Camel-1.0-7, xmms-skin-CrystalBastard-1.0-7, xmms-skin-Digitool-1.0-7, xmms-skin-ElectroPC-1.0-7, xmms-skin-Escalate-1.0-7, xmms-skin-ForcedToBe-1.0-7, xmms-skin-Industrial-0.2.34-7, xmms-skin-Kinwashi-Auriga-1.0-7, xmms-skin-Mercury-1.0-7, xmms-skin-Merregnon-1.0-7, xmms-skin-Plastik-1.0-7, xmms-skin-Relic-1.0-7, xmms-skin-Topaz-1.0-7, xmms-skin-WinampX-1.0-7, xmms-skin-aqua-1.0-4, xmms-skin-gorilla-1.0-5, xmms-skin-nvidia-1.0b-1, xmms-skins-1.2.10-4, xmms-skins2-1.0-7, xmms-static-1.2.10-4, xmms-visualization-GL-1.2.10-4, xmms-visualization-blur-scope-max-1.3-4, xmms-visualization-blursk-1.3-0.1, xmms-visualization-dflowers-1.2.1-3, xmms-visualization-dscope-1.3.1-3, xmms-visualization-dspectogram-1.2.1-3, xmms-visualization-dspectral-1.2.1-3, xmms-visualization-infinity-0.2-4, xmms-visualization-iris-0.12-1, xmms-visualization-jess-2.0.0-4, xmms-visualization-levelmeter-0.1-2, xmms-visualization-nebulus-0.6.0-1, xmms-visualization-palace-0.2.1-3, xmms-visualization-synaesthesia-0.0.3-3, xmms-visualization-vigor-0.1.1-1, xmms-wm-1.2.10-4, xmmsfind-0.5.1-1] | ||
+ | >>> | ||
</file> | </file> | ||