Skip to content

Commit

Permalink
Directly generate scripts into install location
Browse files Browse the repository at this point in the history
This avoids the problem of empty install folders as setup.py
generates the target folder only if needed.

Signed-off-by: Robert Haschke <rhaschke@techfak.uni-bielefeld.de>
  • Loading branch information
rhaschke committed Jan 6, 2022
1 parent a786aa2 commit 321105d
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions ament_cmake_python/cmake/ament_python_install_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -160,25 +160,10 @@ setup(
DESTINATION "${ARG_DESTINATION}/${egg_install_name}.egg-info"
)

# generate entry-point console scripts
set(_scripts_dir "${build_dir}/scripts")
add_custom_target(
ament_cmake_python_build_${package_name}_scripts ALL
# cleanup any scripts from a previous run
COMMAND ${CMAKE_COMMAND} -E remove_directory "${_scripts_dir}"
# (re)create scripts build directory
COMMAND ${CMAKE_COMMAND} -E make_directory "${_scripts_dir}"
# generate scripts
COMMAND ${python_interpreter} setup.py install_scripts -d scripts
WORKING_DIRECTORY "${build_dir}"
DEPENDS ${egg_dependencies}
COMMENT "Generating python console scripts"
)
install(
DIRECTORY "${build_dir}/scripts/"
DESTINATION "${ARG_SCRIPTS_DESTINATION}/"
USE_SOURCE_PERMISSIONS
)
# generate/install entry-point console scripts
get_filename_component(ABS_SCRIPTS_DESTINATION "${ARG_SCRIPTS_DESTINATION}" ABSOLUTE BASE_DIR "${CMAKE_INSTALL_PREFIX}")
install(CODE "execute_process(COMMAND ${python_interpreter} setup.py install_scripts --install-dir \"${ABS_SCRIPTS_DESTINATION}\"
WORKING_DIRECTORY \"${build_dir}\")")

install(
DIRECTORY "${ARG_PACKAGE_DIR}/"
Expand Down

0 comments on commit 321105d

Please sign in to comment.