Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bazel/py] Omit google/__init__.py from the Protobuf runtime. #7908

Merged
merged 1 commit into from Sep 23, 2020

Commits on Sep 23, 2020

  1. [bazel/py] Omit google/__init__.py from the Protobuf runtime.

    Since `google` is a Python namespace package, the google/__init__.py
    file should be omitted to avoid collisions. For example, its presence
    may cause other Pip packages in the google namespace not to be found.
    
    This change narrows which __init__.py files are included in the
    `//:protobuf_runtime` target to include only those under
    `google/protobuf`. It also moves their canonical inclusion to the
    internal `//:python_srcs` rule, eliminating the dual specification in
    `python_protobuf.extra_srcs`.
    
    This is the difference in files, lexicographically ordered:
    
    ```
    $ bazel cquery 'labels(srcs, kind(py_library, deps(:protobuf_python)))' | sort > /tmp/deps-{before,after}.txt
    $ diff /tmp/deps-{before,after}.txt
    1,5d0
    < //:python/compatibility_tests/v2.5.0/tests/__init__.py (null)
    < //:python/compatibility_tests/v2.5.0/tests/google/__init__.py (null)
    < //:python/compatibility_tests/v2.5.0/tests/google/protobuf/__init__.py (null)
    < //:python/compatibility_tests/v2.5.0/tests/google/protobuf/internal/__init__.py (null)
    < //:python/google/__init__.py (null)
    51d45
    < //:python/protobuf_distutils/protobuf_distutils/__init__.py (null)
    ```
    
    This seems like a desirable change, since it avoids polluting other
    packages, too.
    dlj-NaN committed Sep 23, 2020
    Configuration menu
    Copy the full SHA
    c0c7c59 View commit details
    Browse the repository at this point in the history