Skip to content
Browse files

detect KDE4 data dir using configurator

  • Loading branch information...
1 parent ce212ef commit b1befd58e7cdb6fb9934025777950dfd20ebfe9c @zaufi committed Jun 11, 2012
Showing with 63 additions and 9 deletions.
  1. +1 −1 CHANGES.md
  2. +45 −8 CMakeLists.txt
  3. +17 −0 libkatepate/ui.py
View
2 CHANGES.md
@@ -1,7 +1,7 @@
Version 0.5 (2012-06-10)
========================
-* setup script provided
+* use cmake to install package files
* fix cursor positioning after expansion (waiting for movingInterface
support in next versions of PyKDE4). '\1' replaces with '%{cursor}'
keyword in expansion text
View
53 CMakeLists.txt
@@ -1,22 +1,64 @@
#
# Copyright 2012 by Alex Trubov <i.zaufi@gmail.com>
#
+# TODO Detect that Kate and Pâté are installed!
+#
+#---------------------------------------------------------
+# Section: Init cmake
+#---------------------------------------------------------
cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0002 OLD)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
project(kate-pate-plugins NONE)
+#---------------------------------------------------------
+# Section: Find used stuff
+#---------------------------------------------------------
find_package(PythonInterp REQUIRED)
-include(PythonMacros)
+
+file(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS)
+
+# NOTE For KDE4 kde-config has been renamed to kde4-config
+find_program(
+ KDE4_KDECONFIG_EXECUTABLE
+ NAMES kde4-config
+ # the suffix must be used since KDEDIRS can be a list of directories which don't have bin/ appended
+ PATH_SUFFIXES bin
+ HINTS
+ ${_KDEDIRS}
+ /opt/kde4
+ ONLY_CMAKE_FIND_ROOT_PATH
+ )
+if(NOT KDE4_KDECONFIG_EXECUTABLE)
+ message(FATAL_ERROR "ERROR: Could not find KDE4 kde4-config")
+endif()
+execute_process(
+ COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --path data
+ OUTPUT_VARIABLE _data_dir
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+file(TO_CMAKE_PATH "${_data_dir}" _data_dir)
if(INSTALL_TYPE STREQUAL "user")
- set(CMAKE_INSTALL_PREFIX "~/.kde4/share/apps/kate/pate")
+ find_path(
+ KDE4_DATA_DIR
+ NAMES kfileplaces/bookmarks.xml kabc/std.vcf kconf_update/log/update.log
+ HINTS ${_data_dir}
+ )
else()
- set(CMAKE_INSTALL_PREFIX "/usr/share/apps/kate/pate")
+ find_path(KDE4_DATA_DIR cmake/modules/FindKDE4Internal.cmake HINTS ${_data_dir})
endif()
+set(CMAKE_INSTALL_PREFIX "${KDE4_DATA_DIR}/kate/pate")
+
+
+#---------------------------------------------------------
+# Section: Install package files
+#---------------------------------------------------------
+include(PythonMacros)
set(LIBKATEPATE_DIR libkatepate)
set(LIBKATEPATE_SOURCES ${LIBKATEPATE_DIR}/__init__.py ${LIBKATEPATE_DIR}/ui.py)
@@ -33,8 +75,3 @@ set(
expand/text_x-chdr.expand
)
python_install(${CMAKE_INSTALL_PREFIX}/${EXPAND_DIR} ${EXPAND_SOURCES})
-
-# install(
-# FILES expand/text_x-c++hdr.expand expand/text_x-chdr.expand
-# DESTINATION ${CMAKE_INSTALL_PREFIX}/${EXPAND_DIR}
-# )
View
17 libkatepate/ui.py
@@ -1,4 +1,21 @@
# -*- coding: utf-8 -*-
+#
+# Copyright 2010-2012 by Alex Trubov <i.zaufi@gmail.com>
+#
+#
+# This software is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this software. If not, see <http://www.gnu.org/licenses/>.
+#
''' Reusable code for Kate/Pâté plugins: UI elements '''

0 comments on commit b1befd5

Please sign in to comment.
Something went wrong with that request. Please try again.