Skip to content

Commit

Permalink
Fix the default value for create_hook_set_value() (#549)
Browse files Browse the repository at this point in the history
The default value is supposed to be the current prefix only, COLCON_CURRENT_PREFIX,
and not the concatenated list of all prefixes, COLCON_PREFIX_PATH.
  • Loading branch information
meyerj authored Aug 18, 2023
1 parent fef4643 commit 4a70c62
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion colcon_core/shell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ def create_hook_set_value(
:param str pkg_name: The package name
:param str name: The name of the environment variable
:param str value: The value to be set. If an empty string is passed the
environment variable should be set to the prefix path.
environment variable should be set to the prefix path at the time the
hook is sourced (from COLCON_CURRENT_PREFIX).
Note that the install-space may have been relocated, and the final
value may differ from the value of argument prefix_path, where
the hook was originally installed to.
:returns: The relative path to the created hook script
:rtype: Path
"""
Expand Down
2 changes: 1 addition & 1 deletion colcon_core/shell/bat.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def create_hook_set_value( # noqa: D102
('%s.bat' % env_hook_name)
logger.info("Creating environment hook '%s'" % hook_path)
if value == '':
value = '%COLCON_PREFIX_PATH%'
value = '%COLCON_CURRENT_PREFIX%'
expand_template(
Path(__file__).parent / 'template' / 'hook_set_value.bat.em',
hook_path, {'name': name, 'value': value})
Expand Down
2 changes: 1 addition & 1 deletion colcon_core/shell/sh.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def create_hook_set_value( # noqa: D102
('%s.sh' % env_hook_name)
logger.info("Creating environment hook '%s'" % hook_path)
if value == '':
value = '$COLCON_PREFIX_PATH'
value = '$COLCON_CURRENT_PREFIX'
expand_template(
Path(__file__).parent / 'template' / 'hook_set_value.sh.em',
hook_path, {'name': name, 'value': value})
Expand Down

0 comments on commit 4a70c62

Please sign in to comment.