Trac is being migrated to new services! Issues can be found in our new YouTrack instance and WIKI pages can be found on our website.

Changes between Initial Version and Version 1 of PythonHowTo


Ignore:
Timestamp:
Dec 20, 2008, 5:26:51 PM (15 years ago)
Author:
brunoabinader
Comment:

Initial version. Ported from http://briglia.net/wiki/tiki-index.php?page=Python-purple+Howto

Legend:

Unmodified
Added
Removed
Modified
  • PythonHowTo

    v1 v1  
     1= Python-purple !HowTo =
     2
     3== Introduction ==
     4
     5'''Python-purple''' is a python bind for libpurple. It was written using [http://www.cython.org Cython] extension. As the Cython's website says: ''"Cython is a language that makes writing C extensions for the Python language as easy as Python itself. Cython is based on the well-known Pyrex, but supports more cutting edge functionality and optimizations."''.
     6
     7'''Python-purple''' provides fully access to libpurple functions from python programs. You only need to import purple.so module (e.g. ''import purple'' from python shell) to start using python-purple. This HOWTO is not about modifying/extending python-purple bind itself, but how to write a python application using python-purple.
     8
     9== Downloading python-purple ==
     10
     11Python-purple source code is part of Carman's project. To download from SVN repository, issue the following command:
     12
     13{{{
     14svn checkout https://garage.maemo.org/svn/carman
     15}}}
     16
     17You will find python-purple source code inside ''carman/python-purple'' directory.
     18
     19== Building and installing python-purple ==
     20
     21In order to build python-purple, you need the following packages:
     22
     23 * cdbs
     24 * debhelper
     25 * libpurple-dev
     26 * libglib2.0-dev
     27 * python2.5-dev
     28 * python2.5-distutils
     29 * cython (optional)
     30
     31NOTE: Although it's not dependent, cython should also needed if you want to re-create purple.c file (generated from cython using ''purple.pyx'').
     32
     33Building cython-generated ''purple.c'' file (optional):
     34
     35{{{
     36$ cython purple.pyx -I libpurple/
     37}}}
     38
     39This is also done by ''setup.py'' when running:
     40
     41{{{
     42$ python2.5 setup.py build
     43}}}
     44
     45If you don't need to generate ''purple.c'' file, you can use ''setup_dist.py'':
     46
     47{{{
     48$ python2.5 setup_dist.py build
     49}}}
     50
     51Both setups generates ''purple.so'' inside ''build/'' directory. The difference is that ''setup.py'' also generates ''purple.c'' file, if it doesn't exists.
     52
     53To install files inside your system:
     54
     55{{{
     56$ sudo python2.5 setup.py install --root=/usr
     57}}}
     58
     59You can also create a debian package of it:
     60
     61{{{
     62$ dpkg-buildpackage -rfakeroot
     63}}}
     64
     65== Run python-purple module ==
     66
     67To import ''purple'' module inside a python program, you need to call python interpreter and/or run the python script with '''LD_PRELOAD''' tag attached. For example:
     68
     69{{{
     70$ LD_PRELOAD=/usr/lib/libpurple.so.0 python2.5 nullclient.py
     71}}}
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!