juergbi commented on code in PR #2147:
URL: https://github.com/apache/buildstream/pull/2147#discussion_r3989808035
##########
src/buildstream/_stream.py:
##########
@@ -235,6 +240,65 @@ def query_cache(self, elements, *,
sources_of_cached_elements=False, only_source
task.add_current_progress()
+ # shell_with()
+ #
+ # Run a shell with other targets.
+ #
+ # Automatically creates a temporary target based on 'target' with
'other_targets' as runtime or build dependencies.
+ #
+ # Note: Method will build the temporary target, before entering into it's
shell.
+ #
+ # Args:
+ # target (str): The name of the element to run the shell for
+ # other_targets: (Iterable[str]): The name of the other elements to run
the shell with.
+ # scope: _Scope: Either BUILD or RUN
+ # *args, **kwargs: Passed to shell() untouched.
+ #
+ # Returns:
+ # (int): The exit code of the launched shell
+ #
+ def shell_with(self, target: str, other_targets: Iterable[str], scope:
_Scope, *args, **kwargs):
+
+ assert self._project, "Must have a project"
+ assert self._project.loader, "Project must have loader"
+
+ _, target_name, target_loader =
self._project.loader._parse_name(target, MappingNode.from_dict({}))
+
+ target_path = os.path.join(target_loader._basedir, target_name)
Review Comment:
We shouldn't be using the private members `_parse_name()` and `_basedir`.
They should either be public/internal, or we need some new public/internal
Loader API as alternative.
A possible option could be to add a `Loader` context manager method that
takes care of `_parse_name()`, `os.path.join()`, ` _yaml.roundtrip_load()`,
creating the temporary file, `_yaml.roundtrip_dump()` and
`_set_fullpath_overrides()`. Leaving only the actual YAML manipulation logic in
this method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]