From c83fe38f4ac08ae50d5a972fe58a1151380061af Mon Sep 17 00:00:00 2001 From: databall-official Date: Tue, 11 Aug 2026 18:06:41 +0800 Subject: [PATCH] decline --- install/_local_setup_util_ps1.py | 41 ++++++++--------- install/_local_setup_util_sh.py | 45 ++++++++++--------- .../resource_index/parent_prefix_path/bcr_bot | 2 +- install/bcr_bot/share/bcr_bot/urdf/gz.xacro | 2 +- src/bcr_bot/urdf/gz.xacro | 2 +- 5 files changed, 47 insertions(+), 45 deletions(-) diff --git a/install/_local_setup_util_ps1.py b/install/_local_setup_util_ps1.py index 01cdf8b..3c6d9e8 100644 --- a/install/_local_setup_util_ps1.py +++ b/install/_local_setup_util_ps1.py @@ -193,13 +193,12 @@ def process_dsv_file( ): commands = [] if _include_comments(): - commands.append(FORMAT_STR_COMMENT_LINE.format_map({ - 'comment': dsv_path})) + commands.append(FORMAT_STR_COMMENT_LINE.format_map({'comment': dsv_path})) with open(dsv_path, 'r') as h: content = h.read() lines = content.splitlines() - basename_map = OrderedDict() + basenames = OrderedDict() for i, line in enumerate(lines): # skip over empty or whitespace-only lines if not line.strip(): @@ -224,21 +223,21 @@ def process_dsv_file( else: # group remaining source lines by basename path_without_ext, ext = os.path.splitext(remainder) - if path_without_ext not in basename_map: - basename_map[path_without_ext] = set() + if path_without_ext not in basenames: + basenames[path_without_ext] = set() assert ext.startswith('.') ext = ext[1:] if ext in (primary_extension, additional_extension): - basename_map[path_without_ext].add(ext) + basenames[path_without_ext].add(ext) # add the dsv extension to each basename if the file exists - for basename, extensions in basename_map.items(): + for basename, extensions in basenames.items(): if not os.path.isabs(basename): basename = os.path.join(prefix, basename) if os.path.exists(basename + '.dsv'): extensions.add('dsv') - for basename, extensions in basename_map.items(): + for basename, extensions in basenames.items(): if not os.path.isabs(basename): basename = os.path.join(prefix, basename) if 'dsv' in extensions: @@ -305,8 +304,8 @@ def handle_dsv_types_except_source(type_, remainder, prefix): comment = f'skip extending {env_name} with not existing ' \ f'path: {value}' if _include_comments(): - commands.append(FORMAT_STR_COMMENT_LINE.format_map({ - 'comment': comment})) + commands.append( + FORMAT_STR_COMMENT_LINE.format_map({'comment': comment})) elif type_ == DSV_TYPE_APPEND_NON_DUPLICATE: commands += _append_unique_value(env_name, value) else: @@ -321,15 +320,15 @@ env_state = {} def _append_unique_value(name, value): + global env_state if name not in env_state: if os.environ.get(name): env_state[name] = set(os.environ[name].split(os.pathsep)) else: env_state[name] = set() - # Append even if the variable has not been set yet, in case a shell script - # sets the same variable without the knowledge of this Python script. - # Later, _remove_ending_separators() will cleanup any unintentional - # leading separator. + # append even if the variable has not been set yet, in case a shell script sets the + # same variable without the knowledge of this Python script. + # later _remove_ending_separators() will cleanup any unintentional leading separator extend = FORMAT_STR_USE_ENV_VAR.format_map({'name': name}) + os.pathsep line = FORMAT_STR_SET_ENV_VAR.format_map( {'name': name, 'value': extend + value}) @@ -343,15 +342,15 @@ def _append_unique_value(name, value): def _prepend_unique_value(name, value): + global env_state if name not in env_state: if os.environ.get(name): env_state[name] = set(os.environ[name].split(os.pathsep)) else: env_state[name] = set() - # Prepend even if the variable has not been set yet, in case a shell script - # sets the same variable without the knowledge of this Python script. - # Later, _remove_ending_separators() will cleanup any unintentional - # trailing separator. + # prepend even if the variable has not been set yet, in case a shell script sets the + # same variable without the knowledge of this Python script. + # later _remove_ending_separators() will cleanup any unintentional trailing separator extend = os.pathsep + FORMAT_STR_USE_ENV_VAR.format_map({'name': name}) line = FORMAT_STR_SET_ENV_VAR.format_map( {'name': name, 'value': value + extend}) @@ -370,10 +369,10 @@ def _remove_ending_separators(): if FORMAT_STR_REMOVE_TRAILING_SEPARATOR is None: return [] + global env_state commands = [] for name in env_state: - # skip variables that already had values before this script started - # appending/prepending + # skip variables that already had values before this script started prepending if name in os.environ: continue commands += [ @@ -383,6 +382,7 @@ def _remove_ending_separators(): def _set(name, value): + global env_state env_state[name] = value line = FORMAT_STR_SET_ENV_VAR.format_map( {'name': name, 'value': value}) @@ -390,6 +390,7 @@ def _set(name, value): def _set_if_unset(name, value): + global env_state line = FORMAT_STR_SET_ENV_VAR.format_map( {'name': name, 'value': value}) if env_state.get(name, os.environ.get(name)): diff --git a/install/_local_setup_util_sh.py b/install/_local_setup_util_sh.py index e5443aa..f67eaa9 100644 --- a/install/_local_setup_util_sh.py +++ b/install/_local_setup_util_sh.py @@ -12,8 +12,8 @@ FORMAT_STR_COMMENT_LINE = '# {comment}' FORMAT_STR_SET_ENV_VAR = 'export {name}="{value}"' FORMAT_STR_USE_ENV_VAR = '${name}' FORMAT_STR_INVOKE_SCRIPT = 'COLCON_CURRENT_PREFIX="{prefix}" _colcon_prefix_sh_source_script "{script_path}"' # noqa: E501 -FORMAT_STR_REMOVE_LEADING_SEPARATOR = 'export {name}=${{{name}#:}}' # noqa: E501 -FORMAT_STR_REMOVE_TRAILING_SEPARATOR = 'export {name}=${{{name}%:}}' # noqa: E501 +FORMAT_STR_REMOVE_LEADING_SEPARATOR = 'if [ "$(echo -n ${name} | head -c 1)" = ":" ]; then export {name}=${{{name}#?}} ; fi' # noqa: E501 +FORMAT_STR_REMOVE_TRAILING_SEPARATOR = 'if [ "$(echo -n ${name} | tail -c 1)" = ":" ]; then export {name}=${{{name}%?}} ; fi' # noqa: E501 DSV_TYPE_APPEND_NON_DUPLICATE = 'append-non-duplicate' DSV_TYPE_PREPEND_NON_DUPLICATE = 'prepend-non-duplicate' @@ -193,13 +193,12 @@ def process_dsv_file( ): commands = [] if _include_comments(): - commands.append(FORMAT_STR_COMMENT_LINE.format_map({ - 'comment': dsv_path})) + commands.append(FORMAT_STR_COMMENT_LINE.format_map({'comment': dsv_path})) with open(dsv_path, 'r') as h: content = h.read() lines = content.splitlines() - basename_map = OrderedDict() + basenames = OrderedDict() for i, line in enumerate(lines): # skip over empty or whitespace-only lines if not line.strip(): @@ -224,21 +223,21 @@ def process_dsv_file( else: # group remaining source lines by basename path_without_ext, ext = os.path.splitext(remainder) - if path_without_ext not in basename_map: - basename_map[path_without_ext] = set() + if path_without_ext not in basenames: + basenames[path_without_ext] = set() assert ext.startswith('.') ext = ext[1:] if ext in (primary_extension, additional_extension): - basename_map[path_without_ext].add(ext) + basenames[path_without_ext].add(ext) # add the dsv extension to each basename if the file exists - for basename, extensions in basename_map.items(): + for basename, extensions in basenames.items(): if not os.path.isabs(basename): basename = os.path.join(prefix, basename) if os.path.exists(basename + '.dsv'): extensions.add('dsv') - for basename, extensions in basename_map.items(): + for basename, extensions in basenames.items(): if not os.path.isabs(basename): basename = os.path.join(prefix, basename) if 'dsv' in extensions: @@ -305,8 +304,8 @@ def handle_dsv_types_except_source(type_, remainder, prefix): comment = f'skip extending {env_name} with not existing ' \ f'path: {value}' if _include_comments(): - commands.append(FORMAT_STR_COMMENT_LINE.format_map({ - 'comment': comment})) + commands.append( + FORMAT_STR_COMMENT_LINE.format_map({'comment': comment})) elif type_ == DSV_TYPE_APPEND_NON_DUPLICATE: commands += _append_unique_value(env_name, value) else: @@ -321,15 +320,15 @@ env_state = {} def _append_unique_value(name, value): + global env_state if name not in env_state: if os.environ.get(name): env_state[name] = set(os.environ[name].split(os.pathsep)) else: env_state[name] = set() - # Append even if the variable has not been set yet, in case a shell script - # sets the same variable without the knowledge of this Python script. - # Later, _remove_ending_separators() will cleanup any unintentional - # leading separator. + # append even if the variable has not been set yet, in case a shell script sets the + # same variable without the knowledge of this Python script. + # later _remove_ending_separators() will cleanup any unintentional leading separator extend = FORMAT_STR_USE_ENV_VAR.format_map({'name': name}) + os.pathsep line = FORMAT_STR_SET_ENV_VAR.format_map( {'name': name, 'value': extend + value}) @@ -343,15 +342,15 @@ def _append_unique_value(name, value): def _prepend_unique_value(name, value): + global env_state if name not in env_state: if os.environ.get(name): env_state[name] = set(os.environ[name].split(os.pathsep)) else: env_state[name] = set() - # Prepend even if the variable has not been set yet, in case a shell script - # sets the same variable without the knowledge of this Python script. - # Later, _remove_ending_separators() will cleanup any unintentional - # trailing separator. + # prepend even if the variable has not been set yet, in case a shell script sets the + # same variable without the knowledge of this Python script. + # later _remove_ending_separators() will cleanup any unintentional trailing separator extend = os.pathsep + FORMAT_STR_USE_ENV_VAR.format_map({'name': name}) line = FORMAT_STR_SET_ENV_VAR.format_map( {'name': name, 'value': value + extend}) @@ -370,10 +369,10 @@ def _remove_ending_separators(): if FORMAT_STR_REMOVE_TRAILING_SEPARATOR is None: return [] + global env_state commands = [] for name in env_state: - # skip variables that already had values before this script started - # appending/prepending + # skip variables that already had values before this script started prepending if name in os.environ: continue commands += [ @@ -383,6 +382,7 @@ def _remove_ending_separators(): def _set(name, value): + global env_state env_state[name] = value line = FORMAT_STR_SET_ENV_VAR.format_map( {'name': name, 'value': value}) @@ -390,6 +390,7 @@ def _set(name, value): def _set_if_unset(name, value): + global env_state line = FORMAT_STR_SET_ENV_VAR.format_map( {'name': name, 'value': value}) if env_state.get(name, os.environ.get(name)): diff --git a/install/bcr_bot/share/ament_index/resource_index/parent_prefix_path/bcr_bot b/install/bcr_bot/share/ament_index/resource_index/parent_prefix_path/bcr_bot index 0cc7af8..6350bc1 100644 --- a/install/bcr_bot/share/ament_index/resource_index/parent_prefix_path/bcr_bot +++ b/install/bcr_bot/share/ament_index/resource_index/parent_prefix_path/bcr_bot @@ -1 +1 @@ -/workspace/install/bcr_bot:/opt/ros/humble \ No newline at end of file +/opt/ros/humble \ No newline at end of file diff --git a/install/bcr_bot/share/bcr_bot/urdf/gz.xacro b/install/bcr_bot/share/bcr_bot/urdf/gz.xacro index 9ec32c6..b1f6c84 100644 --- a/install/bcr_bot/share/bcr_bot/urdf/gz.xacro +++ b/install/bcr_bot/share/bcr_bot/urdf/gz.xacro @@ -87,7 +87,7 @@ - 30.0 + 10.0 kinect_camera kinect_camera diff --git a/src/bcr_bot/urdf/gz.xacro b/src/bcr_bot/urdf/gz.xacro index 9ec32c6..b1f6c84 100644 --- a/src/bcr_bot/urdf/gz.xacro +++ b/src/bcr_bot/urdf/gz.xacro @@ -87,7 +87,7 @@ - 30.0 + 10.0 kinect_camera kinect_camera