[PATCH] bug 174806

Michael Witten mfwitten at gmail.com
Mon Mar 16 19:39:42 CET 2009


As a solution to the following bug:

    http://bugs.kde.org/show_bug.cgi?id=174806

I have 2 patches. One for kdelibs (it involves some
cleanup/streamlining for the affected code):

    http://bugsfiles.kde.org/attachment.cgi?id=32117

and one for kdebase:

    http://bugs.kde.org/attachment.cgi?id=32118

The patches apply to revision 939041 (trunk).

Here is the comment:

I've got *2* patch[es] that [try] to make this whole enterprise as
transparent as possible.

The crux of the problem is that KDE developers like to configure
CMAKE_INSTALL_PREFIX so that it points to some directory under
${HOME}, while python has traditinally dictated that modules be
installed to a system-wide site-packages directory. This causes a
clash of permissions: `make install' can't install to this system-wide
site-packages directory without special priveleges (for instance,
`sudo make install').

For those with python>=2.6, the attached patches provides a complete
fix. For those with python<2.6 installed, the attached patches provide
help via cmake control.

Python>2.6 implements PEP 370, which provides for a per-user
site-packages directory. Here's how the patches make use of this new
functionality:

If the user has configured CMAKE_INSTALL_PREFIX such that it points to
a directory that is not underneath ${HOME}, then cmake selects the
system-wide site-packages directories for installing the python
modules; this behavior is the same as it has always been.

If the user has configured CMAKE_INSTALL_PREFIX such that it points to
a directory underneath the user's ${HOME}, then cmake assumes the user
is a KDE developer and therefore intends to run `make install' without
special priveleges, so cmake asks python for a path to the user's
site-packages directory. If this succeeds, then everything is
installed as expected, and the whole process is transparent.

However, if cmake finds that python doesn't know about user-specific
site-packages directories, then cmake will message the user to explain
the situation and to offer a partial solution: The user can force a
directory to be used as the user's site-packages directory by
specifying -DPYTHON_SITE_PACKAGES_INSTALL_DIR=$some_path on the
command line.

The attached patches preserve PYTHON_SITE_PACKAGES_DIR and add 2 new
variables: PYTHON_USER_SITE_PACKAGES_DIR to hold the user-specific
site-packages directory of the user configuring KDE, and
PYTHON_SITE_PACKAGES_INSTALL_DIR to multiplex between those 2
variables (it can always be overridden on the command line).

I have tested every scenario but 2: (1) systems without python and (2)
systems with python<2.6. However, I'm fairly sure the code will work
perfectly ;-)

Sincerely,
Michael Witten

P.S.
The use of $ENV{HOME} may not work for Windows. Input?


More information about the Kde-buildsystem mailing list