Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions bindings/pyroot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ endif()
file(GLOB pyfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
foreach(pyfile ${pyfiles})
install(FILES ${pyfile} DESTINATION ${runtimedir})
install(CODE "execute_process(COMMAND python -m py_compile \$ENV{DESTDIR}${runtimedir}/${pyfile})")
install(CODE "execute_process(COMMAND python -O -m py_compile \$ENV{DESTDIR}${runtimedir}/${pyfile})")
if(IS_ABSOLUTE ${runtimedir})
set(absruntimedir ${runtimedir})
else()
set(absruntimedir ${CMAKE_INSTALL_PREFIX}/${runtimedir})
endif()
install(CODE "execute_process(COMMAND python -m py_compile \$ENV{DESTDIR}${absruntimedir}/${pyfile})")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly related to the patch, but shouldn't this also be ${PYTHON_EXECUTABLE} as below?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely we should use ${PYTHON_EXECUTABLE}, specially for python3 :-)

install(CODE "execute_process(COMMAND python -O -m py_compile \$ENV{DESTDIR}${absruntimedir}/${pyfile})")
file(COPY ${pyfile} DESTINATION ${localruntimedir})
endforeach()

Expand Down
9 changes: 7 additions & 2 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ if(python)
endforeach()

install(FILES python/cmdLineUtils.py DESTINATION ${runtimedir})
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m py_compile \$ENV{DESTDIR}${runtimedir}/cmdLineUtils.py)")
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -O -m py_compile \$ENV{DESTDIR}${runtimedir}/cmdLineUtils.py)")
if(IS_ABSOLUTE ${runtimedir})
set(absruntimedir ${runtimedir})
else()
set(absruntimedir ${CMAKE_INSTALL_PREFIX}/${runtimedir})
endif()
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m py_compile \$ENV{DESTDIR}${absruntimedir}/cmdLineUtils.py)")
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -O -m py_compile \$ENV{DESTDIR}${absruntimedir}/cmdLineUtils.py)")
configure_file(python/cmdLineUtils.py ${localruntimedir}/cmdLineUtils.py @ONLY)
endif()

Expand Down