[PATCH] bug 174806

Michael Witten mfwitten at gmail.com
Wed Mar 25 03:21:13 GMT 2009

Hello again!

I've updated the page for the following bug:


with this attachment:


and this comment:

Sorry for getting back WAY too late on this one. I've got excuses, but
who cares... ;-)

I've attached a tarball that contains 3 pataches: kdelibs.patch,
kdebase.patch, kdebindings.patch.

The main patch is kdelibs.patch, which cleans up some cruft and adds 3
new CMake commands: PARSE_ARGS(), ADD_PYTHON(), and INSTALL_PYTHON().

If I may boast, these are very cool and they do The Right Thing.

ADD_PYTHON() creates a target for compiling python modules (as well as
whole packages) and INSTALL_PYTHON() allows for easily installing the
results. Whereas before, there was just one always-out-of-date target
to which all compilation commands (everywhere) were appended, it is
now possible to create any number of named targets with outputs that
only need to be rebuilt when necessary. More interesting is that the
handling of packages and the preservation of relative paths might
allow for a more pythonic organization of the python source code. In
short, It's Awesome.

The patches to kdebase and kdebindings simply make use of the new
commands where CURRENTLY appropriate, which---unfortunately---is not
that many places: Both kdebase and kdelibs (and probably a lot of
others) handle python modules improperly; python byte-code is specific
to each version of the python interpreter. This is why python has
interpreter-specific site-packages directories. Until many of the
python modules are converted to modules that can be properly installed
in versioned site-packages directories, you can't byte-compile the
python and feel proud about it (and more importantly, you can't make
use of the shiny new commands provided by kdelibs.patch ;-) As it is
now, the misused compilation has been converted to direct installation
of the .py files only.

Because of the large additions, the patches are kind of hard to read.
I recommend applying them and then reading the affected files. The
comments/documentation are pretty darn thorough. I would particularly
point people to read about PARSE_ARGS(), which I think could be very
helpful for further cmakery.

Also, as a very small footnote that can hopefully be disregarded, I
didn't actually test my changes to kdebindings. I've compiled my
qt-copy out of source, and my guess is that kdebindings makes a lot of
egregious assumptions to the contrary (written in lurid
tab-and-space-mixed perl, no less! Probably some emacs user). Needless
to say, I couldn't get kdebindings to compile and install, but at
least cmake ran and it's output looks suitable. Furthermore---and
perhaps worse---I imagine that there are many more projects out there
that will break, because I have thrown out the old PYTHON_INSTALL().
This is a good thing, for the path to the future is laid on the ruins
of the past!

Michael Witten

More information about the kde-core-devel mailing list