From efbc721202db25231e5b14962c2c5f867b9453f8 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 17 Feb 2023 20:14:22 +0100 Subject: [PATCH 1/3] Fix the default value for create_hook_set_value() 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. --- colcon_core/shell/bat.py | 2 +- colcon_core/shell/sh.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/colcon_core/shell/bat.py b/colcon_core/shell/bat.py index 5f2463eb..2ae4bc76 100644 --- a/colcon_core/shell/bat.py +++ b/colcon_core/shell/bat.py @@ -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}) diff --git a/colcon_core/shell/sh.py b/colcon_core/shell/sh.py index e46840f8..64005512 100644 --- a/colcon_core/shell/sh.py +++ b/colcon_core/shell/sh.py @@ -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}) From 61724cdaac97be20eb795a41560160dbd37ab6d8 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 18 Aug 2023 10:23:57 +0200 Subject: [PATCH 2/3] Clarify the documentation for the parameter value of ShellExtensionPoint.create_hook_set_value() for the case an empty string is passed --- colcon_core/shell/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/colcon_core/shell/__init__.py b/colcon_core/shell/__init__.py index 1e1eaeaa..4f8b4da6 100644 --- a/colcon_core/shell/__init__.py +++ b/colcon_core/shell/__init__.py @@ -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 from the value of argument prefix_path, + where the hook has originally been installed to. :returns: The relative path to the created hook script :rtype: Path """ From b65c797ba1216ce96daa694002bd77fe312fa7a4 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Fri, 18 Aug 2023 09:34:24 -0700 Subject: [PATCH 3/3] Update colcon_core/shell/__init__.py --- colcon_core/shell/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colcon_core/shell/__init__.py b/colcon_core/shell/__init__.py index 4f8b4da6..faa103ff 100644 --- a/colcon_core/shell/__init__.py +++ b/colcon_core/shell/__init__.py @@ -191,8 +191,8 @@ def create_hook_set_value( 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 from the value of argument prefix_path, - where the hook has originally been installed to. + 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 """