Merge tag 'upstream/0.7.1'
Upstream version 0.7.1
Jochen Sprickerhof
7 years ago
0 | 0 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
1 | 1 | Changelog for package catkin |
2 | 2 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
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 | |
3 | 27 | |
4 | 28 | 0.6.16 (2015-11-09) |
5 | 29 | ------------------- |
71 | 71 | |
72 | 72 | # find package component |
73 | 73 | 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} | |
75 | 76 | 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() | |
76 | 85 | elseif(catkin_FIND_QUIETLY) |
77 | 86 | find_package(${component} QUIET NO_MODULE PATHS ${paths} |
78 | 87 | NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) |
3 | 3 | # |
4 | 4 | # The signature: |
5 | 5 | # |
6 | # catkin_install_python(PROGRAMS files... DESTINATION <dir> | |
7 | # [OPTIONAL] | |
8 | # ) | |
6 | # catkin_install_python(PROGRAMS files... DESTINATION <dir> [OPTIONAL]) | |
9 | 7 | # |
10 | 8 | # See the documentation for CMake install() function for more information. |
11 | 9 | # |
25 | 23 | set(file "${CMAKE_CURRENT_SOURCE_DIR}/${file}") |
26 | 24 | endif() |
27 | 25 | if(EXISTS ${file}) |
26 | stamp(${file}) | |
28 | 27 | # read file and check shebang line |
29 | 28 | file(READ ${file} data) |
30 | 29 | set(regex "^#!/([^\r\n]+)/env python([\r\n])") |
240 | 240 | pass |
241 | 241 | |
242 | 242 | 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) | |
244 | 250 | finally: |
245 | 251 | distutils.core.setup = distutils_backup |
246 | 252 | try: |
32 | 32 | # POSSIBILITY OF SUCH DAMAGE. |
33 | 33 | |
34 | 34 | from __future__ import print_function |
35 | from collections import OrderedDict | |
35 | 36 | import sys |
36 | 37 | import argparse |
37 | 38 | |
48 | 49 | :param package: Package object |
49 | 50 | :returns: list of str, lines to output |
50 | 51 | """ |
51 | values = {} | |
52 | values = OrderedDict() | |
52 | 53 | values['VERSION'] = '"%s"' % package.version |
53 | 54 | |
54 | 55 | values['MAINTAINER'] = '"%s"' % (', '.join([str(m) for m in package.maintainers])) |
55 | 56 | |
57 | values['PACKAGE_FORMAT'] = '"%d"' % package.package_format | |
56 | 58 | values.update(_get_dependency_values('BUILD_DEPENDS', package.build_depends)) |
59 | values.update(_get_dependency_values('BUILD_EXPORT_DEPENDS', package.build_export_depends)) | |
57 | 60 | 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 | |
58 | 65 | 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)) | |
59 | 68 | |
60 | 69 | deprecated = [e.content for e in package.exports if e.tagname == 'deprecated'] |
61 | 70 | values['DEPRECATED'] = '"%s"' % ((deprecated[0] if deprecated[0] else 'TRUE') if deprecated else '') |
67 | 76 | return output |
68 | 77 | |
69 | 78 | def _get_dependency_values(key, depends): |
70 | values = {} | |
79 | values = OrderedDict() | |
71 | 80 | values[key] = ' '.join(['"%s"' % str(d) for d in depends]) |
72 | 81 | for d in depends: |
73 | 82 | comparisons = ['version_lt', 'version_lte', 'version_eq', 'version_gte', 'version_gt'] |
51 | 51 | # subfolder of workspace prepended to CMAKE_PREFIX_PATH |
52 | 52 | ENV_VAR_SUBFOLDERS = { |
53 | 53 | 'CMAKE_PREFIX_PATH': '', |
54 | 'CPATH': 'include', | |
55 | 54 | 'LD_LIBRARY_PATH' if not IS_DARWIN else 'DYLD_LIBRARY_PATH': @CATKIN_LIB_ENVIRONMENT_PATHS@, |
56 | 55 | 'PATH': '@CATKIN_GLOBAL_BIN_DESTINATION@', |
57 | 56 | 'PKG_CONFIG_PATH': @CATKIN_PKGCONFIG_ENVIRONMENT_PATHS@, |
160 | 159 | path_tmp = path |
161 | 160 | if subfolder: |
162 | 161 | path_tmp = os.path.join(path_tmp, subfolder) |
162 | # skip nonexistent paths | |
163 | if not os.path.exists(path_tmp): | |
164 | continue | |
163 | 165 | # exclude any path already in env and any path we already added |
164 | 166 | if path_tmp not in environ_paths and path_tmp not in checked_paths: |
165 | 167 | checked_paths.append(path_tmp) |
277 | 279 | # need to explicitly flush the output |
278 | 280 | sys.stdout.flush() |
279 | 281 | 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 | |
281 | 283 | # which can happen when piping the output to a file but the disk is full |
282 | 284 | if e.errno == errno.EPIPE: |
283 | 285 | print(e, file=sys.stderr) |
161 | 161 | if(${count} EQUAL 1) |
162 | 162 | # simple dependencies must only be find_package()-ed once |
163 | 163 | if(NOT ${@PROJECT_NAME@_dep}_FOUND) |
164 | find_package(${@PROJECT_NAME@_dep} REQUIRED) | |
164 | find_package(${@PROJECT_NAME@_dep} REQUIRED NO_MODULE) | |
165 | 165 | endif() |
166 | 166 | else() |
167 | 167 | # dependencies with components must be find_package()-ed again |
168 | 168 | 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}) | |
170 | 170 | endif() |
171 | 171 | _list_append_unique(@PROJECT_NAME@_INCLUDE_DIRS ${${@PROJECT_NAME@_dep}_INCLUDE_DIRS}) |
172 | 172 |
15 | 15 | |
16 | 16 | echo_and_run cd "@INSTALL_CMD_WORKING_DIRECTORY@" |
17 | 17 | |
18 | # snsure that Python install destination exists | |
19 | echo_and_run mkdir -p "$DESTDIR@CMAKE_INSTALL_PREFIX@/@PYTHON_INSTALL_DIR@" | |
20 | ||
18 | 21 | # Note that PYTHONPATH is pulled from the environment to support installing |
19 | 22 | # into one location when some dependencies were installed in another |
20 | 23 | # location, #123. |
26 | 26 | |
27 | 27 | # make sure to export all environment variables |
28 | 28 | export CMAKE_PREFIX_PATH |
29 | export CPATH | |
30 | 29 | if [ $_IS_DARWIN -eq 0 ]; then |
31 | 30 | export LD_LIBRARY_PATH |
32 | 31 | else |
7 | 7 | # .. note:: The test can be executed by calling ``nosetests`` |
8 | 8 | # directly or using: |
9 | 9 | # `` 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) | |
11 | 11 | # |
12 | 12 | # :param path: a relative or absolute directory to search for |
13 | 13 | # nosetests in or a relative or absolute file containing tests |
78 | 78 | add_custom_target(clean_test_results |
79 | 79 | COMMAND ${PYTHON_EXECUTABLE} "${catkin_EXTRAS_DIR}/test/remove_test_results.py" "${CATKIN_TEST_RESULTS_DIR}") |
80 | 80 | 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() | |
86 | 81 | |
87 | 82 | # |
88 | 83 | # Create a test target, integrate it with the run_tests infrastructure |
144 | 139 | add_custom_target(_run_tests_${PROJECT_NAME}_${type}_${name} |
145 | 140 | COMMAND ${cmd}) |
146 | 141 | 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() | |
147 | 148 | add_dependencies(_run_tests_${PROJECT_NAME}_${type}_${name} clean_test_results_${PROJECT_NAME} tests ${_testing_DEPENDENCIES}) |
148 | 149 | endfunction() |
88 | 88 | .. _`catkin_add_executable_with_gtest_ref`: |
89 | 89 | |
90 | 90 | `catkin_add_executable_with_gtest` |
91 | ---------------------------------- | |
91 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
92 | 92 | |
93 | 93 | .. cmake:macro:: catkin_add_executable_with_gtest(target) |
94 | 94 | |
171 | 171 | (default: 60) |
172 | 172 | :type TIMEOUT: integer |
173 | 173 | :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) | |
175 | 176 | :type WORKING_DIRECTORY: string |
176 | 177 | |
177 | 178 | |
275 | 276 | |
276 | 277 | The signature: |
277 | 278 | |
278 | catkin_install_python(PROGRAMS files... DESTINATION <dir> | |
279 | [OPTIONAL] | |
280 | ) | |
279 | catkin_install_python(PROGRAMS files... DESTINATION <dir> [OPTIONAL]) | |
281 | 280 | |
282 | 281 | See the documentation for CMake install() function for more information. |
283 | 282 | |
862 | 861 | .. cmake:macro:: list_insert_in_workspace_order(listname) |
863 | 862 | |
864 | 863 | *[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]* |
17 | 17 | only a few core ROS commands like ``rosrun`` and ``roslaunch`` that |
18 | 18 | install in the global ``bin/`` directory. |
19 | 19 | |
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, | |
22 | 24 | executable script names generally do not include a ``.py`` suffix. |
23 | 25 | Your ``CMakeLists.txt`` should install all the scripts explictly |
24 | 26 | using the special install function ``catkin_install_python``. |
25 | 27 | This will make sure that shebang lines are updated to use the |
26 | 28 | specific Python version used at configure time:: |
27 | 29 | |
28 | catkin_install_python(PROGRAMS scripts/your_node1 scripts/your_node2 | |
30 | catkin_install_python(PROGRAMS nodes/your_node scripts/another_script | |
29 | 31 | DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) |
30 | 32 | |
31 | 33 | Another good practice is to keep executable scripts very short, |
17 | 17 | only a few core ROS commands like ``rosrun`` and ``roslaunch`` that |
18 | 18 | install in the global ``bin/`` directory. |
19 | 19 | |
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, | |
22 | 24 | executable script names generally do not include a ``.py`` suffix. |
23 | 25 | Your ``CMakeLists.txt`` should install all the scripts explictly |
24 | 26 | using the special install function ``catkin_install_python``. |
25 | 27 | This will make sure that shebang lines are updated to use the |
26 | 28 | specific Python version used at configure time:: |
27 | 29 | |
28 | catkin_install_python(PROGRAMS scripts/your_node1 scripts/your_node2 | |
30 | catkin_install_python(PROGRAMS nodes/your_node scripts/another_script | |
29 | 31 | DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}) |
30 | 32 | |
31 | 33 | Another good practice is to keep executable scripts very short, |
0 | 0 | <?xml version="1.0"?> |
1 | 1 | <package format="2"> |
2 | 2 | <name>catkin</name> |
3 | <version>0.6.16</version> | |
3 | <version>0.7.1</version> | |
4 | 4 | <description>Low-level build system macros and infrastructure for ROS.</description> |
5 | 5 | <maintainer email="dthomas@osrfoundation.org">Dirk Thomas</maintainer> |
6 | 6 | <license>BSD</license> |
86 | 86 | # except for s == 'share', cand is a list of two paths: ws[0] + s + project (+ path) and ws[1] + project (+ path) |
87 | 87 | # add cand to result list if it exists |
88 | 88 | # 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): | |
90 | 90 | ''' |
91 | 91 | Find all paths which match the search criteria. |
92 | 92 | All workspaces are searched in order. |
109 | 109 | search_dirs = _get_valid_search_dirs(search_dirs, project) |
110 | 110 | if 'libexec' in search_dirs: |
111 | 111 | search_dirs.insert(search_dirs.index('libexec'), 'lib') |
112 | ||
112 | if _workspaces is None: | |
113 | _workspaces = get_workspaces() | |
113 | 114 | if workspace_to_source_spaces is None: |
114 | 115 | workspace_to_source_spaces = {} |
115 | 116 | if source_path_to_packages is None: |
32 | 32 | self.assertRaises(ValueError, _get_valid_search_dirs, ['libexec'], None) |
33 | 33 | |
34 | 34 | def test_find_in_workspaces(self): |
35 | existing = find_in_workspaces([], _workspaces=None) | |
35 | existing = find_in_workspaces([], _workspaces=[]) | |
36 | 36 | self.assertEqual([], existing) |
37 | existing = find_in_workspaces([], 'foo', _workspaces=None) | |
37 | existing = find_in_workspaces([], 'foo', _workspaces=[]) | |
38 | 38 | self.assertEqual([], existing) |
39 | existing = find_in_workspaces([], 'foo', 'foopath', _workspaces=None) | |
39 | existing = find_in_workspaces([], 'foo', 'foopath', _workspaces=[]) | |
40 | 40 | self.assertEqual([], existing) |
41 | 41 | |
42 | existing = find_in_workspaces(['include'], 'foo', 'foopath', _workspaces=None) | |
42 | existing = find_in_workspaces(['include'], 'foo', 'foopath', _workspaces=[]) | |
43 | 43 | self.assertEqual([], existing) |
44 | 44 | |
45 | 45 | checked = [] |
15 | 15 | |
16 | 16 | def test_get_output(self): |
17 | 17 | pack = Mock() |
18 | pack.package_format = 2 | |
18 | 19 | pack.name = 'foopack' |
19 | 20 | pack.version = '0.1.2' |
20 | 21 | pack.maintainers = ['m1', 'm2'] |
21 | 22 | pack.build_depends = ['bd1', 'bd2'] |
22 | 23 | pack.buildtool_depends = ['catkin'] |
24 | pack.build_export_depends = ['bed1', 'bed2'] | |
25 | pack.buildtool_export_depends = ['bted1', 'bted2'] | |
26 | pack.exec_depends = ['ed1', 'ed2'] | |
23 | 27 | pack.run_depends = ['rd1', 'rd2'] |
28 | pack.test_depends = ['td1', 'td2'] | |
29 | pack.doc_depends = ['dd1', 'dd2'] | |
24 | 30 | pack.exports = [] |
25 | 31 | 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)) | |
33 | 49 | |
34 | 50 | def test_main(self): |
35 | 51 | try: |
52 | 68 | self.assertTrue(os.path.isfile(check_file)) |
53 | 69 | with open(check_file, 'r') as fhand: |
54 | 70 | 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())) | |
62 | 88 | finally: |
63 | 89 | shutil.rmtree(rootdir) |
51 | 51 | shutil.rmtree(rootdir) |
52 | 52 | |
53 | 53 | 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) | |
66 | 79 | |
67 | 80 | def test_remove_from_env(self): |
68 | 81 | altsep = os.path.altsep |