Skip to content
Open
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ END_UNRELEASED_TEMPLATE
* (pypi) Fix `importlib.metadata.files` by ensuring `RECORD` is included in
installed wheel targets, except when built from sdist
([#3024](https://github.com/bazel-contrib/rules_python/issues/3024)).
* (windows) Fix `py_test`/`py_binary` failure when the target name contains
path separators; the bootstrap stub is now declared as a sibling of the
`.exe` launcher
([#3789](https://github.com/bazel-contrib/rules_python/issues/3789)).


{#v0-0-0-added}
Expand Down
2 changes: 1 addition & 1 deletion python/private/py_executable.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ WARNING: Target: {}

# On Windows, the main executable has an "exe" extension, so
# here we re-use the un-extensioned name for the bootstrap output.
bootstrap_output = ctx.actions.declare_file(base_executable_name)
bootstrap_output = ctx.actions.declare_file(base_executable_name, sibling = executable)
Comment thread
titusfortner marked this conversation as resolved.

# The launcher looks for the non-zip executable next to
# itself, so add it to the default outputs.
Expand Down
29 changes: 29 additions & 0 deletions tests/base_rules/py_executable_base_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,35 @@ def _test_py_runtime_info_provided_impl(env, target):

_tests.append(_test_py_runtime_info_provided)

def _test_windows_target_with_path_separators(name, config):
rt_util.helper_target(
config.rule,
name = name + "/nested_subject",
srcs = ["main.py"],
main = "main.py",
)
analysis_test(
name = name,
impl = _test_windows_target_with_path_separators_impl,
target = name + "/nested_subject",
config_settings = {
"//command_line_option:cpu": "windows_x86_64",
"//command_line_option:crosstool_top": CROSSTOOL_TOP,
"//command_line_option:extra_execution_platforms": [platform_targets.WINDOWS_X86_64],
"//command_line_option:extra_toolchains": [CC_TOOLCHAIN],
"//command_line_option:platforms": [platform_targets.WINDOWS_X86_64],
},
attr_values = {},
)

def _test_windows_target_with_path_separators_impl(env, target):
target = env.expect.that_target(target)
target.runfiles().contains_predicate(matching.str_endswith(
target.meta.format_str("/{name}"),
))

_tests.append(_test_windows_target_with_path_separators)

# =====
# You were gonna add a test at the end, weren't you?
# Nope. Please keep them sorted; put it in its alphabetical location.
Expand Down