Codebase list ros-catkin / 54b23fc
Merge tag 'upstream/0.7.1' Upstream version 0.7.1 Jochen Sprickerhof 7 years ago
19 changed file(s) with 175 addition(s) and 62 deletion(s). Raw diff Collapse all Expand all
00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 Changelog for package catkin
22 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3
4 0.7.1 (2016-03-18)
5 ------------------
6 * expose format 2 style dependencies as CMake variables (`#787 <https://github.com/ros/catkin/issues/787>`_)
7
8 0.7.0 (2016-03-04)
9 ------------------
10 * remove CPATH from setup files (`#783 <https://github.com/ros/catkin/issues/783>`_)
11 * use NO_MODULE to find exported catkin dependencies (`#760 <https://github.com/ros/catkin/issues/760>`_)
12
13 0.6.17 (2016-03-03)
14 -------------------
15 * fix docs: nosetest target names use periods (`#781 <https://github.com/ros/catkin/issues/781>`_)
16 * add custom message explaining CMake find_package error messages (`#780 <https://github.com/ros/catkin/issues/780>`_)
17 * fix regression with DESTDIR introduced in 0.6.16 (`#755 <https://github.com/ros/catkin/issues/755>`_)
18 * avoid adding nonexistent paths to environment variables (`#777 <https://github.com/ros/catkin/issues/777>`_)
19 * ensure that Python install destination exists (`#775 <https://github.com/ros/catkin/issues/775>`_, https://github.com/ros/catkin/issues/776)
20 * set commonly predefines attributes when interrogating setup.py files (`#770 <https://github.com/ros/catkin/issues/770>`_)
21 * align Python script directory recommendations with REP-0008 (`#769 <https://github.com/ros/catkin/issues/769>`_)
22 * fix default value for _workspaces in find_in_workspaces (`#768 <https://github.com/ros/catkin/issues/768>`_)
23 * improve robustness of exec call interogating setup.py files (`#766 <https://github.com/ros/catkin/issues/766>`)
24 * fix reinstalling Python files installed by catkin_install_python after modifying them (`#764 <https://github.com/ros/catkin/issues/764>`_)
25 * fix project specific clean_test_results targets (`#762 <https://github.com/ros/catkin/issues/762>`_)
26 * update generated CMake API
327
428 0.6.16 (2015-11-09)
529 -------------------
7171
7272 # find package component
7373 if(catkin_FIND_REQUIRED)
74 find_package(${component} REQUIRED NO_MODULE PATHS ${paths}
74 # try without REQUIRED first
75 find_package(${component} NO_MODULE PATHS ${paths}
7576 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
77 if(NOT ${component}_FOUND)
78 # show better message to help users with the CMake error message coming up
79 message(STATUS "Could not find the required component '${component}'. "
80 "The following CMake error indicates that you either need to install the package "
81 "with the same name or change your environment so that it can be found.")
82 find_package(${component} REQUIRED NO_MODULE PATHS ${paths}
83 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
84 endif()
7685 elseif(catkin_FIND_QUIETLY)
7786 find_package(${component} QUIET NO_MODULE PATHS ${paths}
7887 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
33 #
44 # The signature:
55 #
6 # catkin_install_python(PROGRAMS files... DESTINATION <dir>
7 # [OPTIONAL]
8 # )
6 # catkin_install_python(PROGRAMS files... DESTINATION <dir> [OPTIONAL])
97 #
108 # See the documentation for CMake install() function for more information.
119 #
2523 set(file "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
2624 endif()
2725 if(EXISTS ${file})
26 stamp(${file})
2827 # read file and check shebang line
2928 file(READ ${file} data)
3029 set(regex "^#!/([^\r\n]+)/env python([\r\n])")
240240 pass
241241
242242 with open(args.setupfile_path, 'r') as fh:
243 exec(fh.read())
243 local_vars = {
244 '__doc__': None,
245 '__file__': os.path.abspath(args.setupfile_path),
246 '__name__': '__main__',
247 '__package__': None,
248 }
249 exec(fh.read(), {}, local_vars)
244250 finally:
245251 distutils.core.setup = distutils_backup
246252 try:
3232 # POSSIBILITY OF SUCH DAMAGE.
3333
3434 from __future__ import print_function
35 from collections import OrderedDict
3536 import sys
3637 import argparse
3738
4849 :param package: Package object
4950 :returns: list of str, lines to output
5051 """
51 values = {}
52 values = OrderedDict()
5253 values['VERSION'] = '"%s"' % package.version
5354
5455 values['MAINTAINER'] = '"%s"' % (', '.join([str(m) for m in package.maintainers]))
5556
57 values['PACKAGE_FORMAT'] = '"%d"' % package.package_format
5658 values.update(_get_dependency_values('BUILD_DEPENDS', package.build_depends))
59 values.update(_get_dependency_values('BUILD_EXPORT_DEPENDS', package.build_export_depends))
5760 values.update(_get_dependency_values('BUILDTOOL_DEPENDS', package.buildtool_depends))
61 values.update(_get_dependency_values('BUILDTOOL_EXPORT_DEPENDS', package.buildtool_export_depends))
62 values.update(_get_dependency_values('EXEC_DEPENDS', package.exec_depends))
63 # the run dependencies are a convenience property to mimick format one like dependencies
64 # it contains the build export and exec_dependendcies
5865 values.update(_get_dependency_values('RUN_DEPENDS', package.run_depends))
66 values.update(_get_dependency_values('TEST_DEPENDS', package.test_depends))
67 values.update(_get_dependency_values('DOC_DEPENDS', package.doc_depends))
5968
6069 deprecated = [e.content for e in package.exports if e.tagname == 'deprecated']
6170 values['DEPRECATED'] = '"%s"' % ((deprecated[0] if deprecated[0] else 'TRUE') if deprecated else '')
6776 return output
6877
6978 def _get_dependency_values(key, depends):
70 values = {}
79 values = OrderedDict()
7180 values[key] = ' '.join(['"%s"' % str(d) for d in depends])
7281 for d in depends:
7382 comparisons = ['version_lt', 'version_lte', 'version_eq', 'version_gte', 'version_gt']
5151 # subfolder of workspace prepended to CMAKE_PREFIX_PATH
5252 ENV_VAR_SUBFOLDERS = {
5353 'CMAKE_PREFIX_PATH': '',
54 'CPATH': 'include',
5554 'LD_LIBRARY_PATH' if not IS_DARWIN else 'DYLD_LIBRARY_PATH': @CATKIN_LIB_ENVIRONMENT_PATHS@,
5655 'PATH': '@CATKIN_GLOBAL_BIN_DESTINATION@',
5756 'PKG_CONFIG_PATH': @CATKIN_PKGCONFIG_ENVIRONMENT_PATHS@,
160159 path_tmp = path
161160 if subfolder:
162161 path_tmp = os.path.join(path_tmp, subfolder)
162 # skip nonexistent paths
163 if not os.path.exists(path_tmp):
164 continue
163165 # exclude any path already in env and any path we already added
164166 if path_tmp not in environ_paths and path_tmp not in checked_paths:
165167 checked_paths.append(path_tmp)
277279 # need to explicitly flush the output
278280 sys.stdout.flush()
279281 except IOError as e:
280 # and catch potantial "broken pipe" if stdout is not writable
282 # and catch potential "broken pipe" if stdout is not writable
281283 # which can happen when piping the output to a file but the disk is full
282284 if e.errno == errno.EPIPE:
283285 print(e, file=sys.stderr)
161161 if(${count} EQUAL 1)
162162 # simple dependencies must only be find_package()-ed once
163163 if(NOT ${@PROJECT_NAME@_dep}_FOUND)
164 find_package(${@PROJECT_NAME@_dep} REQUIRED)
164 find_package(${@PROJECT_NAME@_dep} REQUIRED NO_MODULE)
165165 endif()
166166 else()
167167 # dependencies with components must be find_package()-ed again
168168 list(REMOVE_AT depend_list 0)
169 find_package(${@PROJECT_NAME@_dep} REQUIRED ${depend_list})
169 find_package(${@PROJECT_NAME@_dep} REQUIRED NO_MODULE ${depend_list})
170170 endif()
171171 _list_append_unique(@PROJECT_NAME@_INCLUDE_DIRS ${${@PROJECT_NAME@_dep}_INCLUDE_DIRS})
172172
1515
1616 echo_and_run cd "@INSTALL_CMD_WORKING_DIRECTORY@"
1717
18 # snsure that Python install destination exists
19 echo_and_run mkdir -p "$DESTDIR@CMAKE_INSTALL_PREFIX@/@PYTHON_INSTALL_DIR@"
20
1821 # Note that PYTHONPATH is pulled from the environment to support installing
1922 # into one location when some dependencies were installed in another
2023 # location, #123.
2626
2727 # make sure to export all environment variables
2828 export CMAKE_PREFIX_PATH
29 export CPATH
3029 if [ $_IS_DARWIN -eq 0 ]; then
3130 export LD_LIBRARY_PATH
3231 else
77 # .. note:: The test can be executed by calling ``nosetests``
88 # directly or using:
99 # `` make run_tests_${PROJECT_NAME}_nosetests_${dir}``
10 # (where slashes in the ``dir`` are replaced with underscores)
10 # (where slashes in the ``dir`` are replaced with periods)
1111 #
1212 # :param path: a relative or absolute directory to search for
1313 # nosetests in or a relative or absolute file containing tests
7878 add_custom_target(clean_test_results
7979 COMMAND ${PYTHON_EXECUTABLE} "${catkin_EXTRAS_DIR}/test/remove_test_results.py" "${CATKIN_TEST_RESULTS_DIR}")
8080 endif()
81 # create target to clean project specific test results
82 if(NOT TARGET clean_test_results_${PROJECT_NAME})
83 add_custom_target(clean_test_results_${PROJECT_NAME}
84 COMMAND ${PYTHON_EXECUTABLE} "${catkin_EXTRAS_DIR}/test/remove_test_results.py" "${CATKIN_TEST_RESULTS_DIR}/${PROJECT_NAME}")
85 endif()
8681
8782 #
8883 # Create a test target, integrate it with the run_tests infrastructure
144139 add_custom_target(_run_tests_${PROJECT_NAME}_${type}_${name}
145140 COMMAND ${cmd})
146141 add_dependencies(_run_tests_${PROJECT_NAME}_${type} _run_tests_${PROJECT_NAME}_${type}_${name})
142
143 # create target to clean project specific test results
144 if(NOT TARGET clean_test_results_${PROJECT_NAME})
145 add_custom_target(clean_test_results_${PROJECT_NAME}
146 COMMAND ${PYTHON_EXECUTABLE} "${catkin_EXTRAS_DIR}/test/remove_test_results.py" "${CATKIN_TEST_RESULTS_DIR}/${PROJECT_NAME}")
147 endif()
147148 add_dependencies(_run_tests_${PROJECT_NAME}_${type}_${name} clean_test_results_${PROJECT_NAME} tests ${_testing_DEPENDENCIES})
148149 endfunction()
8888 .. _`catkin_add_executable_with_gtest_ref`:
8989
9090 `catkin_add_executable_with_gtest`
91 ----------------------------------
91 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9292
9393 .. cmake:macro:: catkin_add_executable_with_gtest(target)
9494
171171 (default: 60)
172172 :type TIMEOUT: integer
173173 :param WORKING_DIRECTORY: the working directory when executing the
174 tests
174 tests (this option can only be used when the ``path`` argument is a
175 file but not when it is a directory)
175176 :type WORKING_DIRECTORY: string
176177
177178
275276
276277 The signature:
277278
278 catkin_install_python(PROGRAMS files... DESTINATION <dir>
279 [OPTIONAL]
280 )
279 catkin_install_python(PROGRAMS files... DESTINATION <dir> [OPTIONAL])
281280
282281 See the documentation for CMake install() function for more information.
283282
862861 .. cmake:macro:: list_insert_in_workspace_order(listname)
863862
864863 *[macro defined in list_insert_in_workspace_order.cmake]*
864
865 .. _`safe_execute_process_ref`:
866
867 `safe_execute_process`
868 ~~~~~~~~~~~~~~~~~~~~~~
869
870 .. cmake:macro:: safe_execute_process(cmd_keyword, arg1)
871
872 *[macro defined in safe_execute_process.cmake]*
873
874 .. _`shell_ref`:
875
876 `shell`
877 ~~~~~~~
878
879 .. cmake:macro:: shell(arg1)
880
881 *[function defined in shell.cmake]*
1717 only a few core ROS commands like ``rosrun`` and ``roslaunch`` that
1818 install in the global ``bin/`` directory.
1919
20 Standard ROS practice is to place all your executable Python programs
21 in a ``scripts/`` subdirectory. To keep the user API clean,
20 Standard ROS practice is to place all executable Python programs in a
21 package subdirectory named ``nodes/`` or ``scripts/``. Their usage is
22 the same, the two names distinguish ROS nodes from other executable
23 Python scripts. To keep the user API clean,
2224 executable script names generally do not include a ``.py`` suffix.
2325 Your ``CMakeLists.txt`` should install all the scripts explictly
2426 using the special install function ``catkin_install_python``.
2527 This will make sure that shebang lines are updated to use the
2628 specific Python version used at configure time::
2729
28 catkin_install_python(PROGRAMS scripts/your_node1 scripts/your_node2
30 catkin_install_python(PROGRAMS nodes/your_node scripts/another_script
2931 DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
3032
3133 Another good practice is to keep executable scripts very short,
1717 only a few core ROS commands like ``rosrun`` and ``roslaunch`` that
1818 install in the global ``bin/`` directory.
1919
20 Standard ROS practice is to place all your executable Python programs
21 in a ``scripts/`` subdirectory. To keep the user API clean,
20 Standard ROS practice is to place all executable Python programs in a
21 package subdirectory named ``nodes/`` or ``scripts/``. Their usage is
22 the same, the two names distinguish ROS nodes from other executable
23 Python scripts. To keep the user API clean,
2224 executable script names generally do not include a ``.py`` suffix.
2325 Your ``CMakeLists.txt`` should install all the scripts explictly
2426 using the special install function ``catkin_install_python``.
2527 This will make sure that shebang lines are updated to use the
2628 specific Python version used at configure time::
2729
28 catkin_install_python(PROGRAMS scripts/your_node1 scripts/your_node2
30 catkin_install_python(PROGRAMS nodes/your_node scripts/another_script
2931 DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
3032
3133 Another good practice is to keep executable scripts very short,
00 <?xml version="1.0"?>
11 <package format="2">
22 <name>catkin</name>
3 <version>0.6.16</version>
3 <version>0.7.1</version>
44 <description>Low-level build system macros and infrastructure for ROS.</description>
55 <maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer>
66 <license>BSD</license>
8686 # except for s == 'share', cand is a list of two paths: ws[0] + s + project (+ path) and ws[1] + project (+ path)
8787 # add cand to result list if it exists
8888 # is not defined for s in ['bin', 'lib'], bailing out
89 def find_in_workspaces(search_dirs=None, project=None, path=None, _workspaces=get_workspaces(), considered_paths=None, first_matching_workspace_only=False, first_match_only=False, workspace_to_source_spaces=None, source_path_to_packages=None):
89 def find_in_workspaces(search_dirs=None, project=None, path=None, _workspaces=None, considered_paths=None, first_matching_workspace_only=False, first_match_only=False, workspace_to_source_spaces=None, source_path_to_packages=None):
9090 '''
9191 Find all paths which match the search criteria.
9292 All workspaces are searched in order.
109109 search_dirs = _get_valid_search_dirs(search_dirs, project)
110110 if 'libexec' in search_dirs:
111111 search_dirs.insert(search_dirs.index('libexec'), 'lib')
112
112 if _workspaces is None:
113 _workspaces = get_workspaces()
113114 if workspace_to_source_spaces is None:
114115 workspace_to_source_spaces = {}
115116 if source_path_to_packages is None:
3232 self.assertRaises(ValueError, _get_valid_search_dirs, ['libexec'], None)
3333
3434 def test_find_in_workspaces(self):
35 existing = find_in_workspaces([], _workspaces=None)
35 existing = find_in_workspaces([], _workspaces=[])
3636 self.assertEqual([], existing)
37 existing = find_in_workspaces([], 'foo', _workspaces=None)
37 existing = find_in_workspaces([], 'foo', _workspaces=[])
3838 self.assertEqual([], existing)
39 existing = find_in_workspaces([], 'foo', 'foopath', _workspaces=None)
39 existing = find_in_workspaces([], 'foo', 'foopath', _workspaces=[])
4040 self.assertEqual([], existing)
4141
42 existing = find_in_workspaces(['include'], 'foo', 'foopath', _workspaces=None)
42 existing = find_in_workspaces(['include'], 'foo', 'foopath', _workspaces=[])
4343 self.assertEqual([], existing)
4444
4545 checked = []
1515
1616 def test_get_output(self):
1717 pack = Mock()
18 pack.package_format = 2
1819 pack.name = 'foopack'
1920 pack.version = '0.1.2'
2021 pack.maintainers = ['m1', 'm2']
2122 pack.build_depends = ['bd1', 'bd2']
2223 pack.buildtool_depends = ['catkin']
24 pack.build_export_depends = ['bed1', 'bed2']
25 pack.buildtool_export_depends = ['bted1', 'bted2']
26 pack.exec_depends = ['ed1', 'ed2']
2327 pack.run_depends = ['rd1', 'rd2']
28 pack.test_depends = ['td1', 'td2']
29 pack.doc_depends = ['dd1', 'dd2']
2430 pack.exports = []
2531 result = _get_output(pack)
26 self.assertEqual(set(['set(_CATKIN_CURRENT_PACKAGE "foopack")',
27 'set(foopack_MAINTAINER "m1, m2")',
28 'set(foopack_DEPRECATED "")',
29 'set(foopack_VERSION "0.1.2")',
30 'set(foopack_BUILD_DEPENDS "bd1" "bd2")',
31 'set(foopack_RUN_DEPENDS "rd1" "rd2")',
32 'set(foopack_BUILDTOOL_DEPENDS "catkin")']), set(result))
32 self.assertEqual(
33 set([
34 'set(_CATKIN_CURRENT_PACKAGE "foopack")',
35 'set(foopack_MAINTAINER "m1, m2")',
36 'set(foopack_PACKAGE_FORMAT "2")',
37 'set(foopack_DEPRECATED "")',
38 'set(foopack_VERSION "0.1.2")',
39 'set(foopack_BUILD_DEPENDS "bd1" "bd2")',
40 'set(foopack_BUILDTOOL_DEPENDS "catkin")',
41 'set(foopack_BUILD_EXPORT_DEPENDS "bed1" "bed2")',
42 'set(foopack_BUILDTOOL_EXPORT_DEPENDS "bted1" "bted2")',
43 'set(foopack_EXEC_DEPENDS "ed1" "ed2")',
44 'set(foopack_RUN_DEPENDS "rd1" "rd2")',
45 'set(foopack_TEST_DEPENDS "td1" "td2")',
46 'set(foopack_DOC_DEPENDS "dd1" "dd2")',
47 ]),
48 set(result))
3349
3450 def test_main(self):
3551 try:
5268 self.assertTrue(os.path.isfile(check_file))
5369 with open(check_file, 'r') as fhand:
5470 contents = fhand.read()
55 self.assertEqual(set(['set(_CATKIN_CURRENT_PACKAGE "foopack")',
56 'set(foopack_MAINTAINER "foo <foo@bar.com>")',
57 'set(foopack_DEPRECATED "")',
58 'set(foopack_VERSION "0.1.2")',
59 'set(foopack_BUILD_DEPENDS "bd1" "bd2")',
60 'set(foopack_RUN_DEPENDS "rd1" "rd2")',
61 'set(foopack_BUILDTOOL_DEPENDS )']), set(contents.splitlines()))
71 self.assertEqual(
72 set([
73 'set(_CATKIN_CURRENT_PACKAGE "foopack")',
74 'set(foopack_MAINTAINER "foo <foo@bar.com>")',
75 'set(foopack_PACKAGE_FORMAT "1")',
76 'set(foopack_DEPRECATED "")',
77 'set(foopack_VERSION "0.1.2")',
78 'set(foopack_BUILD_DEPENDS "bd1" "bd2")',
79 'set(foopack_BUILDTOOL_DEPENDS )',
80 'set(foopack_BUILD_EXPORT_DEPENDS "rd1" "rd2")',
81 'set(foopack_BUILDTOOL_EXPORT_DEPENDS )',
82 'set(foopack_EXEC_DEPENDS "rd1" "rd2")',
83 'set(foopack_RUN_DEPENDS "rd1" "rd2")',
84 'set(foopack_TEST_DEPENDS )',
85 'set(foopack_DOC_DEPENDS )',
86 ]),
87 set(contents.splitlines()))
6288 finally:
6389 shutil.rmtree(rootdir)
5151 shutil.rmtree(rootdir)
5252
5353 def test_prefix_env(self):
54 mock_env = {}
55 self.assertEqual('',
56 _prefix_env_variable(mock_env, 'varname', [], ''))
57 self.assertEqual(os.pathsep.join(['foo', 'bar']),
58 _prefix_env_variable(mock_env, 'varname', ['foo', 'bar'], ''))
59 mock_env = {'varname': os.pathsep.join(['baz', 'bar', 'bam'])}
60 self.assertEqual('',
61 _prefix_env_variable(mock_env, 'varname', [], ''))
62 self.assertEqual('foo' + os.pathsep,
63 _prefix_env_variable(mock_env, 'varname', ['foo', 'bar'], ''))
64 self.assertEqual(os.pathsep.join(['foo', 'lim']) + os.pathsep,
65 _prefix_env_variable(mock_env, 'varname', ['foo', 'lim', 'foo', 'lim'], ''))
54 try:
55 rootdir = tempfile.mkdtemp()
56 foo_path = os.path.join(rootdir, 'foo')
57 os.makedirs(foo_path)
58 bar_path = os.path.join(rootdir, 'bar')
59 os.makedirs(bar_path)
60 baz_path = os.path.join(rootdir, 'baz')
61 bam_path = os.path.join(rootdir, 'bam')
62 lim_path = os.path.join(rootdir, 'lim')
63 os.makedirs(lim_path)
64
65 mock_env = {}
66 self.assertEqual('',
67 _prefix_env_variable(mock_env, 'varname', [], ''))
68 self.assertEqual(os.pathsep.join([foo_path, bar_path]),
69 _prefix_env_variable(mock_env, 'varname', [foo_path, bar_path, baz_path], ''))
70 mock_env = {'varname': os.pathsep.join([baz_path, bar_path, bam_path])}
71 self.assertEqual('',
72 _prefix_env_variable(mock_env, 'varname', [], ''))
73 self.assertEqual(foo_path + os.pathsep,
74 _prefix_env_variable(mock_env, 'varname', [foo_path, bar_path], ''))
75 self.assertEqual(os.pathsep.join([foo_path, lim_path]) + os.pathsep,
76 _prefix_env_variable(mock_env, 'varname', [foo_path, lim_path, foo_path, lim_path], ''))
77 finally:
78 shutil.rmtree(rootdir)
6679
6780 def test_remove_from_env(self):
6881 altsep = os.path.altsep