KDE

Alexander Neundorf neundorf at kde.org
Wed Jun 23 22:51:06 CEST 2010


SVN commit 1141934 by neundorf:

-add cache variable PYTHON_SITE_PACKAGES_INSTALL_DIR, this can be used as install destination
 for python modules, PYTHON_SITE_PACKAGES_DIR should not be used, since this most probably
 requires root permissions- The new variable can be adjusted via the cache.

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

Alex

CCMAIL: kde-buildsystem at kde.org



 M  +9 -1      kdebase/workspace/plasma/generic/scriptengines/python/CMakeLists.txt  
 M  +16 -8     kdelibs/cmake/modules/FindPythonLibrary.cmake  


--- trunk/KDE/kdebase/workspace/plasma/generic/scriptengines/python/CMakeLists.txt #1141933:1141934
@@ -8,8 +8,16 @@
 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)
 
+# remove the following three lines once we branch 4.5, they are only necessary as long
+# as people update kdebase but not yet kdelibs (PYTHON_SITE_PACKAGES_INSTALL_DIR has just
+# recently been added to FindPYthonLib.cmake and should be used as install destination). Alex
+if(NOT PYTHON_SITE_PACKAGES_INSTALL_DIR)
+  set(PYTHON_SITE_PACKAGES_INSTALL_DIR ${PYTHON_SITE_PACKAGES_DIR} )
+endif(NOT PYTHON_SITE_PACKAGES_INSTALL_DIR)
+
+PYTHON_INSTALL(plasmascript.py ${PYTHON_SITE_PACKAGES_INSTALL_DIR}/PyKDE4)
+
 install(FILES plasma-scriptengine-applet-python.desktop
         DESTINATION ${SERVICES_INSTALL_DIR})
 install(FILES plasma-scriptengine-dataengine-python.desktop
--- trunk/KDE/kdelibs/cmake/modules/FindPythonLibrary.cmake #1141933:1141934
@@ -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)


More information about the Kde-buildsystem mailing list