Getting Started/Build/KDE4/Python Support

From KDE TechBase
Revision as of 19:17, 22 October 2008 by Sedwards (talk | contribs) (Document about building Python support from KDE trunk.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: This page refers to building and installing KDE Python support from KDE subversion trunk during the KDE 4.2 development cycle and may not apply to other versions of KDE. (Situation from 23 October 2008)

Installing Python bindings and support directly from KDE trunk in subversion is a little bit tricky, mainly due to the stack of dependencies which need to be built up first.

Please note that most of the time there is little reason to install and run the Python bindings and support directly from subversion. If you are an application developer then just use the packages from your distribution. Running from subversion generally doesn't get you early access to new functionality in kdelibs etc because the bindings are only updated around the end of KDE's development cycle. That being said, running from subversion will get you access to the new Python support in Plasma and also the new bindings for Marble.

Short version:

  • Install and setup KDE from subversion.
  • Build everything needed up to and including kdelibs.
  • Install Python into your kde svn install directory.
  • Install SIP. (use a snapshot from Riverbank)
  • Install PyQt4. (use a snapshot from Riverbank)

First step, get your KDE subversion install / environment setup and build and install kdelibs.

The standard Python interpreter has a site-packages directory inside its installation directory which is where system wide Python modules are installed. This is how Python finds modules when you import them in your program. Unfortunately Python traditionally does not have a per-user site-packages directory where private copies of modules can be installed, although I believe support for this has been added in the new 2.6 release. This means to we need our own Python installation into which we can install PyQt, PyKDE and friends.

Grab and install Python 2.5 into the same install prefix as your KDE trunk install. After building and installation, the new python should be the first one on your $PATH.

A couple of important bugs have been fixed in SIP. Grab the SIP snapshot from Riverbank Computing and unpack the archive somewhere. Running "python configure.py", answering 'yes' or something and then letting run, and then running "make" and "make install" should be enough to get it installed.

Grab a PyQt4 snapshot from Riverbank Computing and do the same things a SIP to build and install it. A snapshot is needed to fix at least one bug which affects Plasma.

With those dependencies in place building kdebindings is a matter of checking out the code and running your 'cmakekde' command. It should then find Python, build and install.

Now you have a working PyKDE4 install which supports kdelibs and a whole bunch of other related libraries like soprano, nepomuk etc.

Now you can check out and build kdebase. It should detect the KDE Python support and automatically build the Python script engine.