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

List:       kde-commits
Subject:    [kdelibs/KDE/4.14] cmake/modules: FindPyKDE4: Make PYKDE4_INSTALL_PYTHON_FILES use PYTHON_INSTALL.
From:       Raphael Kubo da Costa <rakuco () FreeBSD ! org>
Date:       2015-12-18 13:02:39
Message-ID: E1a9ugB-0006Jr-Ab () scm ! kde ! org
[Download RAW message or body]

Git commit 016841aeb0b180981122085e9b1d49ae66951670 by Raphael Kubo da Costa.
Committed on 18/12/2015 at 12:36.
Pushed by rkcosta into branch 'KDE/4.14'.

FindPyKDE4: Make PYKDE4_INSTALL_PYTHON_FILES use PYTHON_INSTALL.

Commit 94f1d2f ("PythonMacros: specify destination directory in
byte-compiled files") broke Kajongg's build because it uses the
PYKDE4_INSTALL_PYTHON_FILES() macro, whose use of PythonCompile.py had
not been updated.

Instead of just passing --destination-dir in FindPyKDE4.cmake, rewrite
the PYKDE4_INSTALL_PYTHON_FILES() macro to use PythonMacros's
PYTHON_INSTALL(). Not only does this fix Kajongg's build, but it also
removes a lot of code duplication and makes
PYKDE4_INSTALL_PYTHON_FILES() work with Python 3.2+'s different .pyc
location.

REVIEW:		126413

M  +2    -38   cmake/modules/FindPyKDE4.cmake

http://commits.kde.org/kdelibs/016841aeb0b180981122085e9b1d49ae66951670

diff --git a/cmake/modules/FindPyKDE4.cmake b/cmake/modules/FindPyKDE4.cmake
index 3b87963..9b13794 100644
--- a/cmake/modules/FindPyKDE4.cmake
+++ b/cmake/modules/FindPyKDE4.cmake
@@ -9,6 +9,7 @@
 # This file is in the public domain.
 
 INCLUDE(FindPythonInterp)
+include(PythonMacros)
 
 SET(PYKDE4_FOUND FALSE)
 
@@ -104,45 +105,8 @@ ENDIF(PYTHONINTERP_FOUND)
 # project..
 #
 MACRO(PYKDE4_INSTALL_PYTHON_FILES)
-
-    ADD_CUSTOM_TARGET(pysupport ALL)
     FOREACH (_current_file ${ARGN})
-
-        # Install the source file.
-        INSTALL(FILES ${_current_file} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
-
-        # Byte compile and install the .pyc file.        
-        GET_FILENAME_COMPONENT(_absfilename ${_current_file} ABSOLUTE)
-        GET_FILENAME_COMPONENT(_filename ${_current_file} NAME)
-        GET_FILENAME_COMPONENT(_filenamebase ${_current_file} NAME_WE)
-        GET_FILENAME_COMPONENT(_basepath ${_current_file} PATH)
-        SET(_bin_py ${CMAKE_BINARY_DIR}/${_basepath}/${_filename})
-        SET(_bin_pyc ${CMAKE_BINARY_DIR}/${_basepath}/${_filenamebase}.pyc)
-
-        FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_basepath})
-
-        SET(_message "-DMESSAGE=Byte-compiling ${_bin_py}")
-
-        GET_FILENAME_COMPONENT(_abs_bin_py ${_bin_py} ABSOLUTE)
-        IF(_abs_bin_py STREQUAL ${_absfilename})    # Don't copy the file onto itself.
-            ADD_CUSTOM_COMMAND(
-                TARGET pysupport
-                COMMAND ${CMAKE_COMMAND} -E echo ${message}
-                COMMAND ${PYTHON_EXECUTABLE} ${current_module_dir}/PythonCompile.py ${_bin_py}
-                DEPENDS ${_absfilename}
-            )
-        ELSE(_abs_bin_py STREQUAL ${_absfilename})
-            ADD_CUSTOM_COMMAND(
-                TARGET pysupport
-                COMMAND ${CMAKE_COMMAND} -E echo ${message}
-                COMMAND ${CMAKE_COMMAND} -E copy ${_absfilename} ${_bin_py}
-                COMMAND ${PYTHON_EXECUTABLE} ${current_module_dir}/PythonCompile.py ${_bin_py}
-                DEPENDS ${_absfilename}
-            )
-        ENDIF(_abs_bin_py STREQUAL ${_absfilename})
-
-        INSTALL(FILES ${_bin_pyc} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
-
+        python_install(${_current_file} ${DATA_INSTALL_DIR}/${PROJECT_NAME})
     ENDFOREACH (_current_file)
 ENDMACRO(PYKDE4_INSTALL_PYTHON_FILES)
 
[prev in list] [next in list] [prev in thread] [next in thread] 

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