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: 493060514
pull/13171/head
Deanna Garcia 2 years ago committed by Copybara-Service
parent b747edb830
commit 92dbe4b8bb
  1. 10
      WORKSPACE
  2. 10
      bazel/system_python.bzl
  3. 4
      bazel/workspace_deps.bzl
  4. 10
      cmake/make_cmakelists.py
  5. 9
      python/dist/BUILD.bazel

@ -80,11 +80,17 @@ system_python(
load("@system_python//:register.bzl", "register_system_python")
register_system_python()
load("@system_python//:pip.bzl", "pip_install")
pip_install(
load("@system_python//:pip.bzl", "pip_parse", "fuzzing_py_install_deps")
pip_parse(
name="pip_deps",
requirements = "//python:requirements.txt",
requirements_overrides = {
"3.11": "//python:requirements_311.txt",
},
)
load("@pip_deps//:requirements.bzl", "install_deps")
install_deps()
fuzzing_py_install_deps()

@ -27,6 +27,9 @@
# Mock out rules_python's pip.bzl for cases where no system python is found.
_mock_pip = """
def fuzzing_py_install_deps():
print("WARNING: could not install fuzzing_py dependencies")
def _pip_install_impl(repository_ctx):
repository_ctx.file("BUILD.bazel", '''
py_library(
@ -52,9 +55,11 @@ pip_install = repository_rule(
pip_parse = pip_install
"""
# Alias rules_python's pip.bzl for cases where a system pythong is found.
# Alias rules_python's pip.bzl for cases where a system python is found.
_alias_pip = """
load("@rules_python//python:pip.bzl", _pip_install = "pip_install", _pip_parse = "pip_parse")
load("@fuzzing_py_deps//:requirements.bzl", _fuzzing_py_install_deps = "install_deps")
def _get_requirements(requirements, requirements_overrides):
for version, override in requirements_overrides.items():
if version in "{python_version}":
@ -74,6 +79,9 @@ def pip_parse(requirements, requirements_overrides={{}}, **kwargs):
requirements = _get_requirements(requirements, requirements_overrides),
**kwargs,
)
def fuzzing_py_install_deps():
_fuzzing_py_install_deps()
"""
_build_file = """

@ -36,14 +36,14 @@ def upb_deps():
sha256 = "5da960e5e5d92394c809629a03af3c7709d2d3d0ca731dacb3a9fb4bf28f7702",
)
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(

@ -202,7 +202,7 @@ class WorkspaceFileFunctions(object):
def __init__(self, converter):
self.converter = converter
def load(self, *args):
def load(self, *args, **kwargs):
pass
def workspace(self, **kwargs):
@ -232,7 +232,7 @@ class WorkspaceFileFunctions(object):
def utf8_range_deps(self):
pass
def pip_install(self, **kwargs):
def pip_parse(self, **kwargs):
pass
def rules_fuzzing_dependencies(self):
@ -256,6 +256,12 @@ class WorkspaceFileFunctions(object):
def python_nuget_package(self, **kwargs):
pass
def install_deps(self):
pass
def fuzzing_py_install_deps(self):
pass
class Converter(object):
def __init__(self):

@ -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({
@ -256,6 +259,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",
@ -281,6 +287,9 @@ py_wheel(
testonly = True,
abi = "none",
distribution = "protobuftests",
extra_distinfo_files = {
"//:LICENSE": "LICENSE",
},
platform = "any",
python_tag = "py3",
strip_path_prefixes = [

Loading…
Cancel
Save