From 3248443015c119ea153305386c67f1dee6383bde Mon Sep 17 00:00:00 2001 From: Deanna Garcia Date: Tue, 22 Nov 2022 15:24:41 -0800 Subject: [PATCH] Add license file to pypi wheels. Addresses https://github.com/protocolbuffers/protobuf/issues/10936. This requires updating to the newest version of rules_python to use the new py_wheel API that includes a parameter for extra distinfo files PiperOrigin-RevId: 490350846 --- WORKSPACE | 14 +++++++++++--- bazel/workspace_deps.bzl | 7 ++++--- cmake/make_cmakelists.py | 5 ++++- python/dist/BUILD.bazel | 9 +++++++++ 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 20dfc57ad3..fededcf7be 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -69,9 +69,17 @@ load("@rules_fuzzing//fuzzing:init.bzl", "rules_fuzzing_init") rules_fuzzing_init() -load("@rules_python//python:pip.bzl", "pip_install") +load("@fuzzing_py_deps//:requirements.bzl", "install_deps") -pip_install( +install_deps() + +load("@rules_python//python:pip.bzl", "pip_parse") + +pip_parse( name="pip_deps", - requirements = "@com_google_protobuf//python:requirements.txt" + requirements_lock = "@com_google_protobuf//python:requirements.txt" ) + +load("@pip_deps//:requirements.bzl", "install_deps") + +install_deps() diff --git a/bazel/workspace_deps.bzl b/bazel/workspace_deps.bzl index 2e78baf782..6be4e6c074 100644 --- a/bazel/workspace_deps.bzl +++ b/bazel/workspace_deps.bzl @@ -24,18 +24,19 @@ def upb_deps(): _github_archive, name = "com_google_protobuf", repo = "https://github.com/protocolbuffers/protobuf", - commit = "c79832bddc3931d798d31d417238e4377f869c79", + commit = "5251a448935cf5e7b52b0d793d9a819b76ff72c2", + sha256 = "5da3f1f5b2b4a5f376fedbb8c3f36d2190cd7cbc3275dc1f4d8aebef7036d42b", patches = ["@upb//bazel:protobuf.patch"], ) - rules_python_version = "0.12.0" # Latest @ August 31, 2022 + rules_python_version = "0.14.0" # Latest @ November 20, 2022 maybe( http_archive, name = "rules_python", strip_prefix = "rules_python-{}".format(rules_python_version), url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/{}.tar.gz".format(rules_python_version), - sha256 = "b593d13bb43c94ce94b483c2858e53a9b811f6f10e1e0eedc61073bd90e58d9c", + sha256 = "a868059c8c6dd6ad45a205cca04084c652cfe1852e6df2d5aca036f6e5438380", ) maybe( diff --git a/cmake/make_cmakelists.py b/cmake/make_cmakelists.py index 2d5901e100..b01cce0ab3 100755 --- a/cmake/make_cmakelists.py +++ b/cmake/make_cmakelists.py @@ -227,7 +227,7 @@ def upb_deps(self): def protobuf_deps(self): pass - def pip_install(self, **kwargs): + def pip_parse(self, **kwargs): pass def rules_fuzzing_dependencies(self): @@ -247,6 +247,9 @@ def python_source_archive(self, **kwargs): def python_nuget_package(self, **kwargs): pass + + def install_deps(self): + pass class Converter(object): diff --git a/python/dist/BUILD.bazel b/python/dist/BUILD.bazel index a8fcbf689a..06798e5c7d 100644 --- a/python/dist/BUILD.bazel +++ b/python/dist/BUILD.bazel @@ -206,6 +206,9 @@ py_wheel( "Programming Language :: Python :: 3.10", ], distribution = "protobuf", + extra_distinfo_files = { + "//:LICENSE": "LICENSE", + }, homepage = "https://developers.google.com/protocol-buffers/", license = "3-Clause BSD License", platform = select({ @@ -252,6 +255,9 @@ py_wheel( "Programming Language :: Python :: 3.10", ], distribution = "protobuf", + extra_distinfo_files = { + "//:LICENSE": "LICENSE", + }, homepage = "https://developers.google.com/protocol-buffers/", license = "3-Clause BSD License", platform = "any", @@ -273,6 +279,9 @@ py_wheel( testonly = True, abi = "none", distribution = "protobuftests", + extra_distinfo_files = { + "//:LICENSE": "LICENSE", + }, platform = "any", python_tag = "py3", strip_path_prefixes = [