Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the default value for create_hook_set_value() #549

Merged
merged 3 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
('%s.bat' % env_hook_name)
logger.info("Creating environment hook '%s'" % hook_path)
if value == '':
value = '%COLCON_PREFIX_PATH%'
value = '%COLCON_CURRENT_PREFIX%'

Check warning on line 98 in colcon_core/shell/bat.py

View check run for this annotation

Codecov / codecov/patch

colcon_core/shell/bat.py#L98

Added line #L98 was not covered by tests
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 @@
('%s.sh' % env_hook_name)
logger.info("Creating environment hook '%s'" % hook_path)
if value == '':
value = '$COLCON_PREFIX_PATH'
value = '$COLCON_CURRENT_PREFIX'

Check warning on line 100 in colcon_core/shell/sh.py

View check run for this annotation

Codecov / codecov/patch

colcon_core/shell/sh.py#L100

Added line #L100 was not covered by tests
expand_template(
Path(__file__).parent / 'template' / 'hook_set_value.sh.em',
hook_path, {'name': name, 'value': value})
Expand Down