Ported api_implementation to py_extension().

pull/13171/head
Joshua Haberman 3 years ago
parent 711885db8f
commit 1e75fbf2c2
  1. 2
      bazel/py_extension.bzl
  2. 34
      python/BUILD

@ -4,7 +4,7 @@ load(
"UPB_DEFAULT_COPTS",
)
def py_extension(name, srcs, deps):
def py_extension(name, srcs, deps=[]):
version_script = name + "_version_script.lds"
symbol = "PyInit_" + name
native.genrule(

@ -23,22 +23,9 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
load(
"//bazel:build_defs.bzl",
"UPB_DEFAULT_COPTS",
)
load(
"//bazel:py_proto_library.bzl",
"py_proto_library",
)
load(
"//bazel:py_extension.bzl",
"py_extension",
)
load(
"@rules_python//python:packaging.bzl",
"py_wheel",
)
load("//bazel:py_proto_library.bzl", "py_proto_library")
load("//bazel:py_extension.bzl", "py_extension") # copybara:strip_for_google3_begin
load("@rules_python//python:packaging.bzl", "py_wheel")
licenses(["notice"])
@ -76,16 +63,9 @@ py_extension(
],
)
cc_binary(
name = "api_implementation",
srcs = [
"api_implementation.c",
],
linkshared = True,
linkstatic = True,
# Enable once linker script is available.
#copts = ["-fvisibility=hidden"],
deps = ["@system_python//:python_headers"],
py_extension(
name = "_api_implementation",
srcs = ["api_implementation.c"],
)
# Copy the extensions into the location recognized by Python.
@ -101,7 +81,7 @@ genrule(
genrule(
name = "copy_api_implementation",
srcs = [":api_implementation"],
srcs = [":_api_implementation"],
outs = ["google/protobuf/internal/_api_implementation" + EXT_SUFFIX],
cmd = "cp $< $@",
visibility = ["//python:__subpackages__"],

Loading…
Cancel
Save