rules_python icon indicating copy to clipboard operation
rules_python copied to clipboard

Spurious "directory does not exist" warnings when building py_proto_library with external proto_library

Open phst opened this issue 1 year ago • 2 comments

🐞 bug report

Affected Rule

The issue is caused by the rule: py_proto_library

Is this a regression?

I think some combinations of protobuf and rules_python didn't print this message in the past, but I'm not sure.

Description

When creating a py_proto_library rule that depends on a well-known type in the protobuf repo, building it will generate spurious warnings of the form

warning: directory does not exist

🔬 Minimal Reproduction

Create a trivial Bazel workspace

  • MODULE.bazel:

    bazel_dep(name = "protobuf", version = "23.1")
    bazel_dep(name = "rules_python", version = "0.28.0")
    
  • BUILD:

    load("@rules_python//python:proto.bzl", "py_proto_library")
    
    py_proto_library(
        name = "any_py_proto",
        deps = ["@protobuf//:any_proto"],
    )
    

🔥 Exception or Error

Output of bazel build :any_py_proto:

[...]
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/empty_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/source_context_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/any_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/duration_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/api_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/field_mask_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/struct_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/timestamp_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/type_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/wrappers_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/compiler/plugin_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
INFO: From ProtoCompile external/protobuf~23.1/python/google/protobuf/descriptor_pb2.py:
external/protobuf~23.1/.: warning: directory does not exist.
[...]

🌍 Your Environment

macOS Sonoma

Build label: 7.0.1
Build target: @@//src/main/java/com/google/devtools/build/lib/bazel:BazelServer
Build time: Thu Jan 18 18:05:58 2024 (1705601158)
Build timestamp: 1705601158
Build timestamp as int: 1705601158

Rules_python version:

0.28

Anything else relevant?

Not sure whether this is an issue with rules_python, protobuf, or Bazel itself. https://github.com/bazelbuild/bazel/issues/7157 and https://github.com/envoyproxy/envoy/issues/28479 seem related.

phst avatar Jan 19 '24 13:01 phst

https://github.com/protocolbuffers/protobuf/issues/6049 also looks related.

phst avatar Jan 19 '24 13:01 phst

this is a recurring issue - it was fixed a while back - i forget which protobuf version and has been present in the last few

phlax avatar Jan 24 '24 14:01 phlax