Use start /machine in multi-output's script_interpreter - #6080
Conversation
| if not dest_file.endswith((".sh", ".bat", ".ps1")): | ||
| # Check whether the interpreter comes from BUILD_PREFIX or not | ||
| executable = shutil.which(args[0]) | ||
| if executable is not None and not executable.startswith( | ||
| metadata.config.build_prefix | ||
| ): | ||
| log.warning( | ||
| "If the output script (%s) is not .sh, .bat or .ps1, " | ||
| "its script_interpreter field must be set to a tool installed in BUILD_PREFIX.", | ||
| output["script"], | ||
| ) |
There was a problem hiding this comment.
This is to get closer to rattler-build's behavior. Just a warning for now.
There was a problem hiding this comment.
Oops, will rebase, sorry
| def wrap_script_with_machine(m, script: str | Path, pre_script: str = "") -> str: | ||
| from .build import INTERPRETER_BAT | ||
|
|
||
| # See docstring of _cmd_machine_flag() |
There was a problem hiding this comment.
What is _cmd_machine_flag?
There was a problem hiding this comment.
Oops, meant _build_arch().
There was a problem hiding this comment.
Probably worth bringing the docstring here though.
|
|
||
| # See docstring of _cmd_machine_flag() | ||
| script = Path(script) | ||
| wrapper = script.parent / (script.stem + ".wrapper" + script.suffix) |
There was a problem hiding this comment.
The input script could be .bat, .cmd, .ps1, etc. but the wrapper script is batch, shouldn't we just use .bat then?
There was a problem hiding this comment.
Oof yes, excellent catch, thanks.
| # See conda_build.windows._build_arch for more info. | ||
| args_to_run = [ | ||
| *INTERPRETER_BAT, | ||
| wrap_script_with_machine(metadata, dest_file, " ".join(args)), |
There was a problem hiding this comment.
if dest_file/script ends in .bat/.cmd wrap_script_with_machine will ignore args/pre_script, is that intended?
There was a problem hiding this comment.
Oops I think I was missing an if not pre_script and bit there.
5f1bce5 to
ff42df2
Compare
Co-authored-by: Ken Odegard <kodegard@anaconda.com>
ff42df2 to
d6a5508
Compare
Description
Follow up for #6047
Checklist - did you ...
newsdirectory (using the template) for the next release's release notes?