Skip to content

BUILD_ENV_INPUT: rootpath instead of location#16

Open
matoubidou wants to merge 1 commit intocedarai:mainfrom
mercedes-benz:dep-location-fix
Open

BUILD_ENV_INPUT: rootpath instead of location#16
matoubidou wants to merge 1 commit intocedarai:mainfrom
mercedes-benz:dep-location-fix

Conversation

@matoubidou
Copy link
Copy Markdown

@matoubidou matoubidou commented May 6, 2024

Thanks for this easy-to-use bazel rules for creating python virtual envs. When I was trying to use your rules from rules_multirun, i.e.

py_venv(
    name = "venv",
    venv_location = "venv",
    deps = all_requirements,
)

multirun(
    name = "install",
    commands = [
        ":venv",
        ...
    ],
)

, I ran into

Running @//devtools:venv
Traceback (most recent call last):
  File "/home/mgoeppe/.cache/bazel/_bazel_mgoeppe/f2e51ebbf887ec6078fbe8751b948440/execroot/ci/bazel-out/k8-fastbuild/bin/devtools/install.bash.runfiles/rules_pyvenv/build_env.py", line 278, in <module>
    main()
  File "/home/mgoeppe/.cache/bazel/_bazel_mgoeppe/f2e51ebbf887ec6078fbe8751b948440/execroot/ci/bazel-out/k8-fastbuild/bin/devtools/install.bash.runfiles/rules_pyvenv/build_env.py", line 251, in main
    with open(os.environ["BUILD_ENV_INPUT"]) as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'bazel-out/k8-fastbuild/bin/devtools/_venv_deps.json'

. This is caused by the funny behavior of location, see make variable documentation for details. I now fixed things by using rootpath instead. When I get things right this fix won't work on windows or when doing cross-compilation builds - but I doubt that this is needed for a venv.

For me things are working using it wrapped by multienv as well as invoking it directly.

Mathias Zeller mathias.zeller@mercedes-benz.com Mercedes-Benz Tech Innovation GmbH (ProviderInformation)

@matoubidou matoubidou changed the title rootpath instead of location BUILD_ENV_INPUT: rootpath instead of location May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants