diff options
Diffstat (limited to 'libre/kdelibs-libre/use-pythondontwritebytecode.patch')
-rwxr-xr-x | libre/kdelibs-libre/use-pythondontwritebytecode.patch | 105 |
1 files changed, 69 insertions, 36 deletions
diff --git a/libre/kdelibs-libre/use-pythondontwritebytecode.patch b/libre/kdelibs-libre/use-pythondontwritebytecode.patch index e221e939a..9b5d92042 100755 --- a/libre/kdelibs-libre/use-pythondontwritebytecode.patch +++ b/libre/kdelibs-libre/use-pythondontwritebytecode.patch @@ -1,26 +1,66 @@ ---- cmake/modules/PythonMacros.cmake -+++ cmake/modules/PythonMacros.cmake -@@ -23,40 +23,42 @@ +From: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> +Date: Wed, 07 Nov 2012 19:08:01 +0000 +Subject: Respect PYTHONDONTWRITEBYTECODE environmental variable. +X-Git-Url: http://quickgit.kde.org/?p=kdelibs.git&a=commitdiff&h=5a3cedacdb6485f7551090467cffb2cdf150b05a +--- +Respect PYTHONDONTWRITEBYTECODE environmental variable. + +BUG: 276151 +REVIEW: 107228 +--- + + +--- a/cmake/modules/PythonMacros.cmake ++++ b/cmake/modules/PythonMacros.cmake +@@ -23,54 +23,56 @@ # Install the source file. - INSTALL(FILES ${SOURCE_FILE} DESTINATION ${DESINATION_DIR}) + INSTALL(FILES ${SOURCE_FILE} DESTINATION ${DESTINATION_DIR}) - # Byte compile and install the .pyc file. - GET_FILENAME_COMPONENT(_absfilename ${SOURCE_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(_filename ${SOURCE_FILE} NAME) - GET_FILENAME_COMPONENT(_filenamebase ${SOURCE_FILE} NAME_WE) - GET_FILENAME_COMPONENT(_basepath ${SOURCE_FILE} PATH) -- ++ # Byte compile and install the .pyc file. ++ IF("$ENV{PYTHONDONTWRITEBYTECODE}" STREQUAL "") ++ GET_FILENAME_COMPONENT(_absfilename ${SOURCE_FILE} ABSOLUTE) ++ GET_FILENAME_COMPONENT(_filename ${SOURCE_FILE} NAME) ++ GET_FILENAME_COMPONENT(_filenamebase ${SOURCE_FILE} NAME_WE) ++ GET_FILENAME_COMPONENT(_basepath ${SOURCE_FILE} PATH) + - if(WIN32) - string(REGEX REPLACE ".:/" "/" _basepath "${_basepath}") - endif(WIN32) -- ++ if(WIN32) ++ string(REGEX REPLACE ".:/" "/" _basepath "${_basepath}") ++ endif(WIN32) + - SET(_bin_py ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filename}) -- SET(_bin_pyc ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filenamebase}.pyc) -- ++ SET(_bin_py ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filename}) + +- # Python 3.2 changed the pyc file location +- IF(PYTHON_SHORT_VERSION GREATER 3.1) +- # To get the right version for suffix +- STRING(REPLACE "." "" _suffix ${PYTHON_SHORT_VERSION}) +- SET(_bin_pyc ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/__pycache__/${_filenamebase}.cpython-${_suffix}.pyc) +- ELSE(PYTHON_SHORT_VERSION GREATER 3.1) +- SET(_bin_pyc ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filenamebase}.pyc) +- ENDIF(PYTHON_SHORT_VERSION GREATER 3.1) ++ # Python 3.2 changed the pyc file location ++ IF(PYTHON_SHORT_VERSION GREATER 3.1) ++ # To get the right version for suffix ++ STRING(REPLACE "." "" _suffix ${PYTHON_SHORT_VERSION}) ++ SET(_bin_pyc ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/__pycache__/${_filenamebase}.cpython-${_suffix}.pyc) ++ ELSE(PYTHON_SHORT_VERSION GREATER 3.1) ++ SET(_bin_pyc ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filenamebase}.pyc) ++ ENDIF(PYTHON_SHORT_VERSION GREATER 3.1) + - FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}) -- -- SET(_message "-DMESSAGE=Byte-compiling ${_bin_py}") -- ++ FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}) + +- SET(_message "Byte-compiling ${_bin_py}") ++ SET(_message "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( @@ -38,43 +78,36 @@ - DEPENDS ${_absfilename} - ) - ENDIF(_abs_bin_py STREQUAL ${_absfilename}) -+ # Byte compile and install the .pyc file. -+ IF("$ENV{PYTHONDONTWRITEBYTECODE}" STREQUAL "") -+ GET_FILENAME_COMPONENT(_absfilename ${SOURCE_FILE} ABSOLUTE) -+ GET_FILENAME_COMPONENT(_filename ${SOURCE_FILE} NAME) -+ GET_FILENAME_COMPONENT(_filenamebase ${SOURCE_FILE} NAME_WE) -+ GET_FILENAME_COMPONENT(_basepath ${SOURCE_FILE} PATH) -+ -+ if(WIN32) -+ string(REGEX REPLACE ".:/" "/" _basepath "${_basepath}") -+ endif(WIN32) -+ -+ SET(_bin_py ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filename}) -+ SET(_bin_pyc ${CMAKE_CURRENT_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( ++ ADD_CUSTOM_COMMAND( + TARGET compile_python_files + COMMAND ${CMAKE_COMMAND} -E echo ${_message} + COMMAND ${PYTHON_EXECUTABLE} ${_python_compile_py} ${_bin_py} + DEPENDS ${_absfilename} -+ ) ++ ) + ELSE(_abs_bin_py STREQUAL ${_absfilename}) -+ ADD_CUSTOM_COMMAND( ++ ADD_CUSTOM_COMMAND( + TARGET compile_python_files -+ COMMAND ${CMAKE_COMMAND} -E echo ${_message} ++ COMMAND ${CMAKE_COMMAND} -E echo ${_message} + COMMAND ${CMAKE_COMMAND} -E copy ${_absfilename} ${_bin_py} + COMMAND ${PYTHON_EXECUTABLE} ${_python_compile_py} ${_bin_py} + DEPENDS ${_absfilename} -+ ) ++ ) + ENDIF(_abs_bin_py STREQUAL ${_absfilename}) -- INSTALL(FILES ${_bin_pyc} DESTINATION ${DESINATION_DIR}) -+ INSTALL(FILES ${_bin_pyc} DESTINATION ${DESINATION_DIR}) +- IF(PYTHON_SHORT_VERSION GREATER 3.1) +- INSTALL(FILES ${_bin_pyc} DESTINATION ${DESTINATION_DIR}/__pycache__/) +- ELSE (PYTHON_SHORT_VERSION GREATER 3.1) +- INSTALL(FILES ${_bin_pyc} DESTINATION ${DESTINATION_DIR}) +- ENDIF (PYTHON_SHORT_VERSION GREATER 3.1) ++ IF(PYTHON_SHORT_VERSION GREATER 3.1) ++ INSTALL(FILES ${_bin_pyc} DESTINATION ${DESTINATION_DIR}/__pycache__/) ++ ELSE (PYTHON_SHORT_VERSION GREATER 3.1) ++ INSTALL(FILES ${_bin_pyc} DESTINATION ${DESTINATION_DIR}) ++ ENDIF (PYTHON_SHORT_VERSION GREATER 3.1) + ENDIF("$ENV{PYTHONDONTWRITEBYTECODE}" STREQUAL "") + ENDMACRO(PYTHON_INSTALL) + + |