blob: d5897fa3a0d69ea4b95601fc1150d4d84a8f772a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
commit 016841aeb0b180981122085e9b1d49ae66951670
Author: Raphael Kubo da Costa <rakuco@FreeBSD.org>
Date: Fri Dec 18 13:35:35 2015 +0100
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
Required for PR 200018.
--- cmake/modules/FindPyKDE4.cmake
+++ 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)
|