Build python bindings

This commit is contained in:
2026-09-04 17:22:07 +03:00
parent c4494d7285
commit a705821885
2 changed files with 25 additions and 2 deletions
+15
View File
@@ -14,10 +14,25 @@ depends:
- glibc
- zlib
make_depends:
- bazelisk
- cmake
- googletest
- python-build
- python-installer
- python-setuptools
- python-wheel
check_depends:
- python-numpy
- python-pytest
downloads:
- url: https://github.com/protocolbuffers/protobuf/archive/refs/tags/v${BPM_PKG_VERSION}.tar.gz
extract_to: ${BPM_SOURCE}
extract_strip_components: 1
checksum: d120933b88a2857c1b5fb6dafe387cca1b96762c2263cb53d945dcae34e88a3f
split_packages:
- name: protobuf-compiler
- name: python-protobuf
description: Python 3 bindings for Google Protocol Buffers
depends:
- protobuf-compiler
- python3=3.14.*
+9 -1
View File
@@ -7,6 +7,8 @@
build() {
cmake -B build -DCMAKE_INSTALL_PREFIX=/usr -Dprotobuf_BUILD_SHARED_LIBS=ON -Dprotobuf_USE_EXTERNAL_GTEST=ON -Dprotobuf_ABSL_PROVIDER=package -Wno-dev
cmake --build build
bazel build //python/dist:binary_wheel "${bazel_options[@]}"
}
# The check function is executed in the source directory
@@ -17,7 +19,7 @@ check() {
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
package_protobuf-compiler() {
DESTDIR="$BPM_OUTPUT" cmake --install build
install -Dm644 "$BPM_SOURCE"/editors/protobuf-mode.el -t "$BPM_OUTPUT/usr/share/emacs/site-lisp/protobuf-mode.el"
@@ -25,5 +27,11 @@ package() {
# Install package license
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/protobuf-compiler/LICENSE
}
package_python-protobuf() {
python -m installer --destdir="$BPM_OUTPUT" bazel-bin/python/dist/*.whl
# Install package license
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/python-protobuf/LICENSE
}