Skip to content

py_wheel fails to correctly set file permissions #1711

@UebelAndre

Description

@UebelAndre

🐞 bug report

Affected Rule

py_wheel

Is this a regression?

This is a regression introduced after #1453

Description

Any executable files added to py_wheel targets lose their executable bit when they're installed via python (notably not when you manually unzip it)

🔬 Minimal Reproduction

load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@rules_python//python:packaging.bzl", "py_wheel")

write_file(
    name = "executable",
    out = "executable.sh",
    content = [
        "#!/bin/bash",
        "echo hello",
    ],
    is_executable = True,
)

py_wheel(
    name = "broken_permissions",
    distribution = "broken_permissions",
    python_tag = "py3",
    version = "0.0.1",
    deps = [
        "executable",
    ],
)

If you build the broken_permissions wheel and install it in a venv you'll find that executable.sh is not executable.

🌍 Your Environment

Operating System:

  
Linux
MacOS
  

Output of bazel version:

  
Bazelisk version: development
Build label: 7.0.0
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Mon Dec 11 16:52:42 2023 (1702313562)
Build timestamp: 1702313562
Build timestamp as int: 1702313562
  

Rules_python version:

  
0.28.0
  

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions