diff --git a/BUILD b/BUILD index fba37786e9..743b438318 100644 --- a/BUILD +++ b/BUILD @@ -36,6 +36,7 @@ load( "upb_proto_library_copts", "upb_proto_reflection_library", ) +load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix") # begin:google_only # load( @@ -1129,6 +1130,19 @@ filegroup( visibility = ["//cmake:__pkg__"], ) +pkg_files( + name = "upb_source_files", + srcs = glob( + [ + "upb/**/*.c", + "upb/**/*.h", + "upb/**/*.hpp", + "upb/**/*.inc", + ], exclude = ["upb/conformance_upb.c"]), + visibility = ["//python/dist:__pkg__"], + strip_prefix = "", +) + # end:github_only # begin:google_only diff --git a/python/dist/BUILD.bazel b/python/dist/BUILD.bazel index c0b017be1d..87b6fbe1fd 100644 --- a/python/dist/BUILD.bazel +++ b/python/dist/BUILD.bazel @@ -197,6 +197,8 @@ pkg_files( name = "generated_wkt", srcs = [ ":well_known_proto_py_pb2", + "//:descriptor_upb_proto", + "//:descriptor_upb_proto_reflection", ], prefix = "google/protobuf", ) @@ -209,6 +211,12 @@ pkg_files( prefix = "google/protobuf/compiler", ) +pkg_files( + name = "utf8_range_source_files", + srcs = ["@utf8_range//:utf8_range_srcs"], + prefix = "utf8_range", +) + pkg_tar( name = "source_wheel", extension = "tar.gz", @@ -216,8 +224,11 @@ pkg_tar( ":generated_wkt", ":generated_wkt_compiler", "setup.py", + ":utf8_range_source_files", "MANIFEST.in", "//:LICENSE", + "//:upb_source_files", + "//upb/util:util_source_files", "//python:message_extension", "@com_google_protobuf//python:python_source_files", ], diff --git a/python/dist/MANIFEST.in b/python/dist/MANIFEST.in index ad58140a3c..21eee24fe6 100644 --- a/python/dist/MANIFEST.in +++ b/python/dist/MANIFEST.in @@ -1 +1,4 @@ include python/*.h +include upb/*.h +include upb/**/*.h +include utf8_range/*.h diff --git a/python/dist/setup.py b/python/dist/setup.py index 970cbd0943..06143cc214 100755 --- a/python/dist/setup.py +++ b/python/dist/setup.py @@ -33,6 +33,7 @@ import glob import os +import sysconfig # We must use setuptools, not distutils, because we need to use the # namespace_packages option for the "google" package. @@ -52,8 +53,7 @@ def GetVersion(): exec(version_file.read(), globals()) # pylint:disable=exec-used return __version__ # pylint:disable=undefined-variable -# Keep this list of dependencies in sync with tox.ini. -install_requires = [] +current_dir = os.path.dirname(os.path.abspath(__file__)) setup( name='protobuf', @@ -68,6 +68,7 @@ setup( maintainer='protobuf@googlegroups.com', maintainer_email='protobuf@googlegroups.com', license='BSD-3-Clause', + package_data = {'protobuf': ['python/*.h']}, classifiers=[ 'Programming Language :: Python', 'Programming Language :: Python :: 3', @@ -78,7 +79,8 @@ setup( ], namespace_packages=['google'], packages=find_packages(), - install_requires=install_requires, - ext_modules= [Extension('google._upb._message', glob.glob('python/*.c'), include_dirs=['python'])], + install_requires=[], + ext_modules= [Extension('google._upb._message', glob.glob('google/protobuf/*.c') + glob.glob('python/*.c') + glob.glob('upb/*.c') + glob.glob('upb/**/*.c') + glob.glob('utf8_range/*.c'), include_dirs=[current_dir, os.path.join(current_dir, 'utf8_range')])], python_requires='>=3.7', + headers = ['python/*.h', 'upb/*.h', 'upb/**/*.h', 'utf8_range/*.h', 'google/protobuf/*.h'], ) diff --git a/upb/util/BUILD b/upb/util/BUILD index 2776132f78..56afe3373a 100644 --- a/upb/util/BUILD +++ b/upb/util/BUILD @@ -1,3 +1,4 @@ +load("@rules_pkg//:mappings.bzl", "pkg_files") load( "//bazel:upb_proto_library.bzl", "upb_proto_library", @@ -128,3 +129,17 @@ cc_test( "@com_google_googletest//:gtest_main", ], ) + +pkg_files( + name = "util_source_files", + srcs = [ + "compare.c", + "compare.h", + "def_to_proto.c", + "def_to_proto.h", + "required_fields.c", + "required_fields.h", + ], + visibility = ["//visibility:public"], + prefix = "upb/util", +)