aspect-build/rules_py

[Bug]: venv activation script is broken for windows

stwarr opened this issue · 1 comments

What happened?

C:\dev\test>bazel run :script

ERROR: C:/dev/test/BUILD.bazel:5:10: Creating virtual environment for //:script failed: (Exit -1073741515): bash.exe failed: error executing CreateVenv command (from target //:script)

bazel-out/x64_windows-fastbuild/bin/script.venv_venv.sh: line 72: bazel-out/x64_windows-fastbuild/bin/script.venv.source/bin/activate: No such file or directory

Problem details:
python -m venv venv places the activation scripts in venv\Scripts\ on windows rather than venv\bin\ and so are not found by the .sh script.

Version

Development (host) and target OS/architectures:
win10/x64

Output of bazel --version:
bazel 7.0.0 with msys2

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:
aspect_rules_py, version: 0.5.0
rules_python, version: 0.22.0

How to reproduce

# MODULE.bazel
module(
    name = "test",
    version = "0.0.0"
)

bazel_dep(name = "aspect_rules_py", version = "0.5.0")
bazel_dep(name = "rules_python", version = "0.22.0", dev_dependency = True)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
    name = "python3",
    configure_coverage_tool = True,
    python_version = "3.11",
)
use_repo(python, "python3_toolchains")

register_toolchains(
    "@python3_toolchains//:all",
)
# BUILD
load("@aspect_rules_py//py:defs.bzl", "py_binary")

py_binary(
    name = "script",
    srcs = ["script.py"],
    main = "script.py",
)

Run with: bazel build //:script



### Any other information?

_No response_

I think Windows support in general will require funding the development. Please consider donating to the project either in time or via Aspect's Open Collective https://opencollective.com/aspect-build