From 83c98487fbd02a6c953aa7de7772c6822481c6fa Mon Sep 17 00:00:00 2001 From: AlexV Date: Thu, 10 Aug 2017 16:32:29 +0900 Subject: [PATCH 1/4] adding install rules to verify catkin variables. --- test/CMakeLists.txt | 2 ++ test/distutils-setup/CMakeLists.txt | 8 ++++++++ test/distutils-setup/extra_installs/bin.txt | 2 ++ test/distutils-setup/extra_installs/etc.txt | 2 ++ test/distutils-setup/extra_installs/include.txt | 2 ++ test/distutils-setup/extra_installs/lib.txt | 2 ++ test/distutils-setup/extra_installs/python.txt | 2 ++ test/distutils-setup/extra_installs/share.txt | 2 ++ test/setuptools-setup/CMakeLists.txt | 8 ++++++++ test/setuptools-setup/extra_installs/bin.txt | 2 ++ test/setuptools-setup/extra_installs/etc.txt | 2 ++ test/setuptools-setup/extra_installs/include.txt | 2 ++ test/setuptools-setup/extra_installs/lib.txt | 2 ++ test/setuptools-setup/extra_installs/python.txt | 2 ++ test/setuptools-setup/extra_installs/share.txt | 2 ++ 15 files changed, 42 insertions(+) create mode 100644 test/distutils-setup/extra_installs/bin.txt create mode 100644 test/distutils-setup/extra_installs/etc.txt create mode 100644 test/distutils-setup/extra_installs/include.txt create mode 100644 test/distutils-setup/extra_installs/lib.txt create mode 100644 test/distutils-setup/extra_installs/python.txt create mode 100644 test/distutils-setup/extra_installs/share.txt create mode 100644 test/setuptools-setup/extra_installs/bin.txt create mode 100644 test/setuptools-setup/extra_installs/etc.txt create mode 100644 test/setuptools-setup/extra_installs/include.txt create mode 100644 test/setuptools-setup/extra_installs/lib.txt create mode 100644 test/setuptools-setup/extra_installs/python.txt create mode 100644 test/setuptools-setup/extra_installs/share.txt diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 384b9b9..87538a3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -150,4 +150,6 @@ if (CATKIN_ENABLE_TESTING) ${cookiecutter_pypackage_minimal_PIP_TARGET} # from pypackage-minimal ) + #TODO : a way to verified installed files from cmake ??? + endif() \ No newline at end of file diff --git a/test/distutils-setup/CMakeLists.txt b/test/distutils-setup/CMakeLists.txt index adb49c3..2ae9d39 100644 --- a/test/distutils-setup/CMakeLists.txt +++ b/test/distutils-setup/CMakeLists.txt @@ -13,6 +13,14 @@ catkin_pip_package(dstest ${PIP_PROJECT_DIR}) # CAREFUL : all projects for test here will share the same workspace. pip might have conflicts... +# Testing potential extra files installation +install(FILES extra_installs/bin.txt DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) +install(FILES extra_installs/etc.txt DESTINATION ${CATKIN_PACKAGE_ETC_DESTINATION}) +install(FILES extra_installs/include.txt DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}) +install(FILES extra_installs/lib.txt DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}) +install(FILES extra_installs/python.txt DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}) +install(FILES extra_installs/share.txt DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) + ## Unit tests if (CATKIN_ENABLE_TESTING) catkin_add_nosetests(${PIP_PROJECT_DIR}/test DEPENDENCIES dstest) diff --git a/test/distutils-setup/extra_installs/bin.txt b/test/distutils-setup/extra_installs/bin.txt new file mode 100644 index 0000000..e5543e6 --- /dev/null +++ b/test/distutils-setup/extra_installs/bin.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_BIN_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html \ No newline at end of file diff --git a/test/distutils-setup/extra_installs/etc.txt b/test/distutils-setup/extra_installs/etc.txt new file mode 100644 index 0000000..cc0d3cd --- /dev/null +++ b/test/distutils-setup/extra_installs/etc.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_ETC_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html \ No newline at end of file diff --git a/test/distutils-setup/extra_installs/include.txt b/test/distutils-setup/extra_installs/include.txt new file mode 100644 index 0000000..8e7ba3f --- /dev/null +++ b/test/distutils-setup/extra_installs/include.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_INCLUDE_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html diff --git a/test/distutils-setup/extra_installs/lib.txt b/test/distutils-setup/extra_installs/lib.txt new file mode 100644 index 0000000..8fc803b --- /dev/null +++ b/test/distutils-setup/extra_installs/lib.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_LIB_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html \ No newline at end of file diff --git a/test/distutils-setup/extra_installs/python.txt b/test/distutils-setup/extra_installs/python.txt new file mode 100644 index 0000000..8a84185 --- /dev/null +++ b/test/distutils-setup/extra_installs/python.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_PYTHON_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html \ No newline at end of file diff --git a/test/distutils-setup/extra_installs/share.txt b/test/distutils-setup/extra_installs/share.txt new file mode 100644 index 0000000..6070c98 --- /dev/null +++ b/test/distutils-setup/extra_installs/share.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_SHARE_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html \ No newline at end of file diff --git a/test/setuptools-setup/CMakeLists.txt b/test/setuptools-setup/CMakeLists.txt index 7dffd6e..8dec817 100644 --- a/test/setuptools-setup/CMakeLists.txt +++ b/test/setuptools-setup/CMakeLists.txt @@ -13,6 +13,14 @@ catkin_pip_package(sstest ${PIP_PROJECT_DIR}) # CAREFUL : all projects for test here will share the same workspace. pip might have conflicts... +# Testing potential extra files installation +install(FILES extra_installs/bin.txt DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) +install(FILES extra_installs/etc.txt DESTINATION ${CATKIN_PACKAGE_ETC_DESTINATION}) +install(FILES extra_installs/include.txt DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}) +install(FILES extra_installs/lib.txt DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}) +install(FILES extra_installs/python.txt DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}) +install(FILES extra_installs/share.txt DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}) + ## Unit tests if (CATKIN_ENABLE_TESTING) catkin_add_nosetests(${PIP_PROJECT_DIR}/test DEPENDENCIES sstest) diff --git a/test/setuptools-setup/extra_installs/bin.txt b/test/setuptools-setup/extra_installs/bin.txt new file mode 100644 index 0000000..e5543e6 --- /dev/null +++ b/test/setuptools-setup/extra_installs/bin.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_BIN_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html \ No newline at end of file diff --git a/test/setuptools-setup/extra_installs/etc.txt b/test/setuptools-setup/extra_installs/etc.txt new file mode 100644 index 0000000..cc0d3cd --- /dev/null +++ b/test/setuptools-setup/extra_installs/etc.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_ETC_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html \ No newline at end of file diff --git a/test/setuptools-setup/extra_installs/include.txt b/test/setuptools-setup/extra_installs/include.txt new file mode 100644 index 0000000..8e7ba3f --- /dev/null +++ b/test/setuptools-setup/extra_installs/include.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_INCLUDE_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html diff --git a/test/setuptools-setup/extra_installs/lib.txt b/test/setuptools-setup/extra_installs/lib.txt new file mode 100644 index 0000000..8fc803b --- /dev/null +++ b/test/setuptools-setup/extra_installs/lib.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_LIB_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html \ No newline at end of file diff --git a/test/setuptools-setup/extra_installs/python.txt b/test/setuptools-setup/extra_installs/python.txt new file mode 100644 index 0000000..8a84185 --- /dev/null +++ b/test/setuptools-setup/extra_installs/python.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_PYTHON_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html \ No newline at end of file diff --git a/test/setuptools-setup/extra_installs/share.txt b/test/setuptools-setup/extra_installs/share.txt new file mode 100644 index 0000000..6070c98 --- /dev/null +++ b/test/setuptools-setup/extra_installs/share.txt @@ -0,0 +1,2 @@ +# Test file that should be installed in ${CATKIN_PACKAGE_SHARE_DESTINATION} +# Ref : http://docs.ros.org/kinetic/api/catkin/html/user_guide/variables.html \ No newline at end of file From 7409d7d21be3b87206ccadeb557982f5c6fdea0a Mon Sep 17 00:00:00 2001 From: AlexV Date: Thu, 10 Aug 2017 17:11:37 +0900 Subject: [PATCH 2/4] splitting catkin_pip_package in function and macro to expose the catkin_destinations variables set in the scope. --- cmake/catkin-pip-package.cmake.in | 37 +++++++++++++++++---------- test/catkin_pip_pytest/test_import.py | 2 +- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/cmake/catkin-pip-package.cmake.in b/cmake/catkin-pip-package.cmake.in index bee9d6b..7897013 100644 --- a/cmake/catkin-pip-package.cmake.in +++ b/cmake/catkin-pip-package.cmake.in @@ -76,21 +76,10 @@ function(catkin_pip_python_setup) endfunction() -# TODO : we now create an actual cmake target -> rename to catkin_pip_target ? -function(catkin_pip_package package_name) - - set(${PROJECT_NAME}_PIP_TARGET ${package_name} CACHE STRING "Make target generated to install this pip package as --editable for development") - set (extra_macro_args ${ARGN}) +function(_catkin_pip_package package_name package_path) - # Did we get any optional args? - list(LENGTH extra_macro_args num_extra_args) - if (${num_extra_args} GREATER 0) - list(GET extra_macro_args 0 package_path) - #message ("Got package_path: ${package_path}") - else() - set(package_path ${CMAKE_CURRENT_SOURCE_DIR}) - endif() + set(${PROJECT_NAME}_PIP_TARGET ${package_name} CACHE STRING "Make target generated to install this pip package as --editable for development") # Note : environment should already be setup at configure time for devel @@ -114,10 +103,30 @@ function(catkin_pip_package package_name) # TODO : we might want to generate a package.xml on the fly from setup.py contents... +endfunction() + + +# TODO : we now create an actual cmake target -> rename to catkin_pip_target ? +macro(catkin_pip_package package_name) + + set (extra_macro_args ${ARGN}) + + # Did we get any optional args? + list(LENGTH extra_macro_args num_extra_args) + if (${num_extra_args} GREATER 0) + list(GET extra_macro_args 0 package_path) + #message ("Got package_path: ${package_path}") + else() + set(package_path ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + _catkin_pip_package(${package_name} ${package_path}) + # Hijacking catkin scripts again #set(_PACKAGE_XML_DIRECTORY ${package_path}) # Here we plug back into usual catkin package build flow + # CAREFUL : this will set variables into current scope. catkin_package() -endfunction() +endmacro() diff --git a/test/catkin_pip_pytest/test_import.py b/test/catkin_pip_pytest/test_import.py index 8e0fc53..63e2478 100644 --- a/test/catkin_pip_pytest/test_import.py +++ b/test/catkin_pip_pytest/test_import.py @@ -12,7 +12,7 @@ def test_dynamic_import_devel_space_pkgs(): # If all packages are in the sys.path, we can import them -def test_dynamic_import_vedel_pkg(): +def test_dynamic_import_devel_pkg(): importlib.import_module('mypippkg') importlib.import_module('nameless') importlib.import_module('python_boilerplate') From 5b799e94b8f31050ceee377e32fda54adec27f65 Mon Sep 17 00:00:00 2001 From: AlexV Date: Thu, 10 Aug 2017 17:24:06 +0900 Subject: [PATCH 3/4] adding catkin_pip_target to API, to allow the user to call catkin_package how he wants. --- cmake/catkin-pip-package.cmake.in | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/cmake/catkin-pip-package.cmake.in b/cmake/catkin-pip-package.cmake.in index 7897013..b3e30e3 100644 --- a/cmake/catkin-pip-package.cmake.in +++ b/cmake/catkin-pip-package.cmake.in @@ -77,7 +77,18 @@ function(catkin_pip_python_setup) endfunction() -function(_catkin_pip_package package_name package_path) +function(catkin_pip_target package_name) + + set (extra_macro_args ${ARGN}) + + # Did we get any optional args? + list(LENGTH extra_macro_args num_extra_args) + if (${num_extra_args} GREATER 0) + list(GET extra_macro_args 0 package_path) + #message ("Got package_path: ${package_path}") + else() + set(package_path ${CMAKE_CURRENT_SOURCE_DIR}) + endif() set(${PROJECT_NAME}_PIP_TARGET ${package_name} CACHE STRING "Make target generated to install this pip package as --editable for development") @@ -106,24 +117,10 @@ function(_catkin_pip_package package_name package_path) endfunction() -# TODO : we now create an actual cmake target -> rename to catkin_pip_target ? +# BWCOMPAT : eventually get rid of that... macro(catkin_pip_package package_name) - set (extra_macro_args ${ARGN}) - - # Did we get any optional args? - list(LENGTH extra_macro_args num_extra_args) - if (${num_extra_args} GREATER 0) - list(GET extra_macro_args 0 package_path) - #message ("Got package_path: ${package_path}") - else() - set(package_path ${CMAKE_CURRENT_SOURCE_DIR}) - endif() - - _catkin_pip_package(${package_name} ${package_path}) - - # Hijacking catkin scripts again - #set(_PACKAGE_XML_DIRECTORY ${package_path}) + catkin_pip_target(${package_name} ${ARGN}) # Here we plug back into usual catkin package build flow # CAREFUL : this will set variables into current scope. From 02f8b3afa86661d02fde86110af01df1bf2b69fb Mon Sep 17 00:00:00 2001 From: AlexV Date: Thu, 10 Aug 2017 17:44:08 +0900 Subject: [PATCH 4/4] tests are now using the new catkin_pip_target and calling catkin_package directly. --- test/distutils-setup/CMakeLists.txt | 6 ++++-- test/pipproject/CMakeLists.txt | 6 ++++-- test/pylibrary/CMakeLists.txt | 6 ++++-- test/pypackage-minimal/CMakeLists.txt | 6 ++++-- test/pypackage/CMakeLists.txt | 6 ++++-- test/setuptools-setup/CMakeLists.txt | 6 ++++-- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/test/distutils-setup/CMakeLists.txt b/test/distutils-setup/CMakeLists.txt index 2ae9d39..07c7522 100644 --- a/test/distutils-setup/CMakeLists.txt +++ b/test/distutils-setup/CMakeLists.txt @@ -6,10 +6,12 @@ set (PIP_PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/distutils_setup) find_package(catkin REQUIRED COMPONENTS catkin_pip) -# This replace both catkin_python_setup() and catkin_package() +# This replace catkin_python_setup() # For devel, this will install all your unsatisfied pip dependencies. # Upon install, this will bark if some dependencies are not already satisfied (by ROS). -catkin_pip_package(dstest ${PIP_PROJECT_DIR}) +catkin_pip_target(dstest ${PIP_PROJECT_DIR}) + +catkin_package() # CAREFUL : all projects for test here will share the same workspace. pip might have conflicts... diff --git a/test/pipproject/CMakeLists.txt b/test/pipproject/CMakeLists.txt index 862d198..aa6a034 100644 --- a/test/pipproject/CMakeLists.txt +++ b/test/pipproject/CMakeLists.txt @@ -15,10 +15,12 @@ catkin_pip_requirements(${PIP_PROJECT_DIR}/requirements.txt --ignore-installed) # However this also means that existing packages in the workspace will not be used to satisfy requirements, # and will be reinstalled everytime... -# This replace both catkin_python_setup() and catkin_package() +# This replace catkin_python_setup() # For devel, this will install all your unsatisfied pip dependencies. # Upon install, this will bark if some dependencies are not already satisfied (by ROS). -catkin_pip_package(mypippkg ${PIP_PROJECT_DIR}) +catkin_pip_target(mypippkg ${PIP_PROJECT_DIR}) + +catkin_package() # CAREFUL : all projects for test here will share the same workspace. pip might have conflicts... diff --git a/test/pylibrary/CMakeLists.txt b/test/pylibrary/CMakeLists.txt index b9f5922..af85b54 100644 --- a/test/pylibrary/CMakeLists.txt +++ b/test/pylibrary/CMakeLists.txt @@ -11,10 +11,12 @@ find_package(catkin REQUIRED COMPONENTS catkin_pip) # no requirements file in this project template -# This replace both catkin_python_setup() and catkin_package() +# This replace catkin_python_setup() # For devel, this will install all your unsatisfied pip dependencies. # Upon install, this will bark if some dependencies are not already satisfied (by ROS). -catkin_pip_package(nameless ${PIP_PROJECT_DIR}) +catkin_pip_target(nameless ${PIP_PROJECT_DIR}) + +catkin_package() # CAREFUL : all projects for test here will share the same workspace. pip might have conflicts... diff --git a/test/pypackage-minimal/CMakeLists.txt b/test/pypackage-minimal/CMakeLists.txt index 88f028e..e61b1fe 100644 --- a/test/pypackage-minimal/CMakeLists.txt +++ b/test/pypackage-minimal/CMakeLists.txt @@ -11,10 +11,12 @@ find_package(catkin REQUIRED COMPONENTS catkin_pip) # no requirements file here -# This replace both catkin_python_setup() and catkin_package() +# This replace catkin_python_setup() # For devel, this will install all your unsatisfied pip dependencies. # Upon install, this will bark if some dependencies are not already satisfied (by ROS). -catkin_pip_package(cookiecutter_pypackage_minimal ${PIP_PROJECT_DIR}) +catkin_pip_target(cookiecutter_pypackage_minimal ${PIP_PROJECT_DIR}) + +catkin_package() # CAREFUL : all projects for test here will share the same workspace. pip might have conflicts... diff --git a/test/pypackage/CMakeLists.txt b/test/pypackage/CMakeLists.txt index 9a08c05..71dea0f 100644 --- a/test/pypackage/CMakeLists.txt +++ b/test/pypackage/CMakeLists.txt @@ -18,10 +18,12 @@ catkin_pip_requirements(${PIP_PROJECT_DIR}/requirements_dev.txt --ignore-install # However this also means that existing packages in the workspace will not be used to satisfy requirements, # and will be reinstalled everytime... -# This replace both catkin_python_setup() and catkin_package() +# This replace catkin_python_setup() # For devel, this will install all your unsatisfied pip dependencies. # Upon install, this will bark if some dependencies are not already satisfied (by ROS). -catkin_pip_package(python_boilerplate ${PIP_PROJECT_DIR}) +catkin_pip_target(python_boilerplate ${PIP_PROJECT_DIR}) + +catkin_package() # CAREFUL : all projects for test here will share the same workspace. pip might have conflicts... diff --git a/test/setuptools-setup/CMakeLists.txt b/test/setuptools-setup/CMakeLists.txt index 8dec817..8aa708c 100644 --- a/test/setuptools-setup/CMakeLists.txt +++ b/test/setuptools-setup/CMakeLists.txt @@ -6,10 +6,12 @@ set (PIP_PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/setuptools_setup) find_package(catkin REQUIRED COMPONENTS catkin_pip) -# This replace both catkin_python_setup() and catkin_package() +# This replace catkin_python_setup() # For devel, this will install all your unsatisfied pip dependencies. # Upon install, this will bark if some dependencies are not already satisfied (by ROS). -catkin_pip_package(sstest ${PIP_PROJECT_DIR}) +catkin_pip_target(sstest ${PIP_PROJECT_DIR}) + +catkin_package() # CAREFUL : all projects for test here will share the same workspace. pip might have conflicts...