[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-buildsystem
Subject:    Re: can't install kdebase, needs root
From:       Alexander Neundorf <neundorf () kde ! org>
Date:       2010-06-22 20:39:02
Message-ID: 201006222239.03134.neundorf () kde ! org
[Download RAW message or body]

On Monday 21 June 2010, Andreas Pakulat wrote:
> On 21.06.10 21:36:13, Alexander Neundorf wrote:
> > On Saturday 12 June 2010, Michael Jansen wrote:
> > > On Samstag 12 Juni 2010 00:49:56 Ben Cooksley wrote:
> > > > On Sat, Jun 12, 2010 at 10:41 AM, Matthew Woehlke
> > > >
> > > > <mw_triad@users.sourceforge.net> wrote:
> > > > > I've started getting this the last two days:
> > > > >
> > > > > CMake Error at
> > > > > workspace/plasma/generic/scriptengines/python/cmake_install.cmake:7
> > > > >6 (FILE): file cannot create directory:
> > > > > /usr/lib64/python2.6/site-packages/PyKDE4. Maybe need
> > > > > administrative privileges.
> > > > >
> > > > > The line in question (trying to install to
> > > > > ${PYTHON_SITE_PACKAGES_DIR}) seems to have been there for some
> > > > > time, so I am not sure what has changed (I think, though, PyKDE was
> > > > > not being built before on my system, though again, I don't know why
> > > > > that would have changed).
> > > >
> > > > Passing the following argument to CMake when configuring kdebase
> > > > should be sufficient..
> > > >
> > > > -DPYTHON_SITE_PACKAGES_DIR=$KDEDIR/lib/python2.6/site-packages
> > >
> > > OR -DPYTHON_LIBS_WITH_KDE_LIBS=True
> > >
> > > Which is defined in FindPythonLibrary.cmake (kdelibs/cmake/modules) and
> > > makes sure everything is installed into PREFIX according to the used
> > > python version. But is hard to find because it is not documented and
> > > cached in CMakeCache.txt.
> >
> > Uh, yeah, and it's somewhat ugly too.
> > Can we find a better solution to this ?
> > I think the last time we discussed some python stuff on kde-buildsystem I
> > didn't recognize a real conclusion, I was mostly confused at the end.
> >
> > So, if we install python modules, where should they go by default ?
>
> Well, thats the problem, either they're installed in a way such that
> python finds them (and that usually means installing needs root-rights)
> or the buildsystem obeys the prefix thats set for the project
> (implicitly or by cmake-variable) in which case the user will have to
> tell its python to look in an additional place. Its very similar to
> installing libraries outside a directory thats mentioned in
> /etc/ld.so.conf, you can do that but you'll have to set an envvar at
> least to give the linker a clue where to look. With shared libs on Linux
> you have a bit better way using RPATH/RUNPATH, but that doesn't really
> exist for Python.

What about the attached patch ?

It removes the PYTHON_LIBS_WITH_KDE_LIBS switch, this was undocumented, and 
anything with "KDE" in the name shouldn't appear 
in "FindPythonLibrary.cmake".

It adds a cache variable PYTHON_SITE_PACKAGES_INSTALL_DIR, which is relative 
by default, so it will be inside CMAKE_INSTALL_PREFIX.
Additionally it makes PYTHON_SITE_PACKAGES_DIR a FORCED cache variable, it is 
not intended to be changed. But by having it in the cache, it can be seen by 
the user.
Additionally it puts PYTHON_INCLUDE_DIR in the cache.

Then the new variable is used in kdebase (...which makes kdebase/workspace/ 
require this version of kdelibs then).

What do you think ?

Alex



["python_package_install.patch" (text/x-diff)]

Index: kdelibs/cmake/modules/FindPythonLibrary.cmake
===================================================================
--- kdelibs/cmake/modules/FindPythonLibrary.cmake	(revision 1141467)
+++ kdelibs/cmake/modules/FindPythonLibrary.cmake	(working copy)
@@ -12,6 +12,11 @@
 # PYTHON_LONG_VERSION - The version of the Python interpreter found as a human
 #     readable string.
 #
+# PYTHON_SITE_PACKAGES_INSTALL_DIR - this cache variable can be used for installing 
+#                              own python modules. You may want to adjust this to be \
the +#                              same as ${PYTHON_SITE_PACKAGES_DIR}, but then \
admin +#                              privileges may be required for installation.
+#
 # PYTHON_SITE_PACKAGES_DIR - Location of the Python site-packages directory.
 #
 # PYTHON_INCLUDE_PATH - Directory holding the python.h include file.
@@ -46,14 +51,17 @@
       string(REGEX REPLACE ".*exec_prefix:([^\n]+).*$" "\\1" PYTHON_PREFIX \
                ${python_config})
       string(REGEX REPLACE ".*\nshort_version:([^\n]+).*$" "\\1" \
                PYTHON_SHORT_VERSION ${python_config})
       string(REGEX REPLACE ".*\nlong_version:([^\n]+).*$" "\\1" PYTHON_LONG_VERSION \
                ${python_config})
-      string(REGEX REPLACE ".*\npy_inc_dir:([^\n]+).*$" "\\1" PYTHON_INCLUDE_PATH \
                ${python_config})
-      if(NOT PYTHON_SITE_PACKAGES_DIR)
-        if(NOT PYTHON_LIBS_WITH_KDE_LIBS)
-          string(REGEX REPLACE ".*\nsite_packages_dir:([^\n]+).*$" "\\1" \
                PYTHON_SITE_PACKAGES_DIR ${python_config})
-        else(NOT PYTHON_LIBS_WITH_KDE_LIBS)
-          set(PYTHON_SITE_PACKAGES_DIR \
                ${KDE4_LIB_INSTALL_DIR}/python${PYTHON_SHORT_VERSION}/site-packages)
-        endif(NOT PYTHON_LIBS_WITH_KDE_LIBS)
-      endif(NOT PYTHON_SITE_PACKAGES_DIR)
+
+      string(REGEX REPLACE ".*\npy_inc_dir:([^\n]+).*$" "\\1" \
_TMP_PYTHON_INCLUDE_PATH ${python_config}) +      string(REGEX REPLACE \
".*\nsite_packages_dir:([^\n]+).*$" "\\1" _TMP_PYTHON_SITE_PACKAGES_DIR \
${python_config}) +
+      # Put these two variables in the cache so they are visible for the user, but \
read-only: +      set(PYTHON_INCLUDE_PATH "${_TMP_PYTHON_INCLUDE_PATH}" CACHE PATH \
"The python include directory" FORCE) +      set(PYTHON_SITE_PACKAGES_DIR \
"${_TMP_PYTHON_SITE_PACKAGES_DIR}" CACHE PATH "The python site packages dir" FORCE) +
+      # This one is intended to be used and changed by the user for installing own \
modules: +      set(PYTHON_SITE_PACKAGES_INSTALL_DIR \
lib/python${PYTHON_SHORT_VERSION}/site-packages CACHE PATH "The directory where \
python modules will be installed to.") +
       string(REGEX REPLACE "([0-9]+).([0-9]+)" "\\1\\2" PYTHON_SHORT_VERSION_NO_DOT \
                ${PYTHON_SHORT_VERSION})
       set(PYTHON_LIBRARY_NAMES python${PYTHON_SHORT_VERSION} \
python${PYTHON_SHORT_VERSION_NO_DOT})  if(WIN32)
Index: kdebase/workspace/plasma/generic/scriptengines/python/CMakeLists.txt
===================================================================
--- kdebase/workspace/plasma/generic/scriptengines/python/CMakeLists.txt	(revision \
                1141467)
+++ kdebase/workspace/plasma/generic/scriptengines/python/CMakeLists.txt	(working \
copy) @@ -8,7 +8,7 @@
 PYTHON_INSTALL(pydataengine.py ${DATA_INSTALL_DIR}/plasma_scriptengine_python)
 PYTHON_INSTALL(pyrunner.py ${DATA_INSTALL_DIR}/plasma_scriptengine_python)
 PYTHON_INSTALL(pywallpaper.py ${DATA_INSTALL_DIR}/plasma_scriptengine_python)
-PYTHON_INSTALL(plasmascript.py ${PYTHON_SITE_PACKAGES_DIR}/PyKDE4)
+PYTHON_INSTALL(plasmascript.py ${PYTHON_SITE_PACKAGES_INSTALL_DIR}/PyKDE4)
 
 install(FILES plasma-scriptengine-applet-python.desktop
         DESTINATION ${SERVICES_INSTALL_DIR})



_______________________________________________
Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic