Skip to content

Commit bcb37d7

Browse files
committed
depend on ament_cmake; specify --build-base and --install-base
Signed-off-by: R Kent James <[email protected]>
1 parent a9387ae commit bcb37d7

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

ament_cmake_python_test/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<buildtool_depend>ament_cmake_core</buildtool_depend>
1313
<build_depend>ament_cmake_pytest</build_depend>
1414
<build_depend>ament_cmake_python</build_depend>
15+
<build_depend>ament_cmake</build_depend>
1516

1617
<test_depend>python3-jinja2</test_depend>
1718

ament_cmake_python_test/test/build_with_colcon.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
PYTHON_INSTALL_DIR = Path(os.environ.get('PYTHON_INSTALL_DIR'))
1616
PYEGG_VERSION = os.environ.get('PYEGG_VERSION')
1717

18+
INSTALL_BASE = 'install_test'
19+
BUILD_BASE = 'build_test'
20+
1821
DEFAULT_OPTIONS = {
1922
'name': 'SET_ME',
2023
'version': None,
@@ -146,8 +149,8 @@ def do_build_package(package_name, options=None, base_prefix=SOURCE_DIR / 'test'
146149
print(f"Building package {package_name} with colcon options: {build_options}")
147150
build_command = ['colcon', 'build',
148151
'--base-paths', base_prefix / 'packages' / package_name,
149-
'--build-base', 'build_test',
150-
'--install-base', 'install_test']
152+
'--build-base', BUILD_BASE,
153+
'--install-base', INSTALL_BASE]
151154
if build_options:
152155
build_command.append(build_options)
153156
result = subprocess.run(build_command, capture_output=True, text=True)
@@ -160,9 +163,9 @@ def do_test_package(package_name, options):
160163
print(f"Testing package {package_name} PWD tree:")
161164
list_files(str(PWD))
162165
if options['destination']:
163-
install_path = PWD / 'install' / package_name / options['destination'] / package_name
166+
install_path = PWD / INSTALL_BASE / package_name / options['destination'] / package_name
164167
else:
165-
install_path = PWD / 'install' / package_name / PYTHON_INSTALL_DIR / package_name
168+
install_path = PWD / INSTALL_BASE / package_name / PYTHON_INSTALL_DIR / package_name
166169
print(f"install_path for package {package_name}: {install_path}")
167170
assert install_path.exists(), f"install path does not exist for {package_name}: {install_path}"
168171
assert (install_path / '__init__.py').exists(), f"missing __init__.py in {install_path}"
@@ -181,7 +184,7 @@ def do_test_package(package_name, options):
181184
if options['version']:
182185
print(f"Testing version: {options['version']} IN EGG-INFO in package {package_name}")
183186
version = options['version']
184-
egg_info_dir = PWD / 'install' / package_name / PYTHON_INSTALL_DIR / f'{package_name}-{version}-{PYEGG_VERSION}.egg-info'
187+
egg_info_dir = PWD / INSTALL_BASE / package_name / PYTHON_INSTALL_DIR / f'{package_name}-{version}-{PYEGG_VERSION}.egg-info'
185188
assert egg_info_dir.exists(), f"egg-info dir does not exist for {package_name}: {egg_info_dir}"
186189
egg_info_file = egg_info_dir / 'PKG-INFO'
187190
assert Path.read_text(egg_info_file).find(f"Version: {version}") != -1, \
@@ -199,7 +202,7 @@ def do_test_package(package_name, options):
199202

200203
if options['scripts_destination']:
201204
print(f"Testing script installed in package {package_name}")
202-
script_path = PWD / 'install' / package_name / options['scripts_destination'] / 'do_something'
205+
script_path = PWD / INSTALL_BASE / package_name / options['scripts_destination'] / 'do_something'
203206
assert script_path.exists(), f"script do_something does not exist for {package_name}: {script_path}"
204207

205208
# If we got this far, the test passed, but we want to see output.

0 commit comments

Comments
 (0)