Skip to content

Commit

Permalink
Add license file to pypi wheels.
Browse files Browse the repository at this point in the history
Addresses protocolbuffers/protobuf#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
  • Loading branch information
deannagarcia authored and copybara-github committed Nov 23, 2022
1 parent efb166b commit 3248443
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
14 changes: 11 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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()
7 changes: 4 additions & 3 deletions bazel/workspace_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
5 changes: 4 additions & 1 deletion cmake/make_cmakelists.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
9 changes: 9 additions & 0 deletions python/dist/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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",
Expand All @@ -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 = [
Expand Down

0 comments on commit 3248443

Please sign in to comment.