[packages/python-grpcio] - last version of grpcio module supporting python2 (based on grpc.spec)
qboosh
qboosh at pld-linux.org
Wed Feb 16 18:40:16 CET 2022
commit 96f27e53ab9fcc18fd14ffad65bbc0afcc84eac6
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Wed Feb 16 18:41:35 2022 +0100
- last version of grpcio module supporting python2 (based on grpc.spec)
grpc-libdir.patch | 12 +++++
grpc-sphinx.patch | 22 ++++++++
grpc-system-absl.patch | 49 ++++++++++++++++++
grpc-system-openssl.patch | 11 ++++
grpc-system-re2.patch | 32 ++++++++++++
grpc-x32.patch | 11 ++++
python-grpcio.spec | 129 ++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 266 insertions(+)
---
diff --git a/python-grpcio.spec b/python-grpcio.spec
new file mode 100644
index 0000000..249f4d9
--- /dev/null
+++ b/python-grpcio.spec
@@ -0,0 +1,129 @@
+# TODO:
+# - system address_sorting and upb?
+#
+# Conditional build:
+%bcond_without apidocs # (Python) API docs build
+#
+Summary: HTTP/2 based RPC framework
+Summary(pl.UTF-8): Szkielet RPC oparty na HTTP/2
+Name: python-grpcio
+Version: 1.39.0
+Release: 1
+License: Apache v2.0
+Group: Libraries/Python
+#Source0Download: https://github.com/grpc/grpc/releases
+Source0: https://github.com/grpc/grpc/archive/v%{version}/grpc-%{version}.tar.gz
+# Source0-md5: eafdc98790db2c85a5e5e79231ad875c
+Patch0: grpc-system-absl.patch
+Patch1: grpc-sphinx.patch
+Patch2: grpc-x32.patch
+Patch3: grpc-libdir.patch
+Patch4: grpc-system-openssl.patch
+URL: https://grpc.io/
+BuildRequires: abseil-cpp-devel
+BuildRequires: c-ares-devel >= 1.13.0
+BuildRequires: cmake >= 3.5.1
+BuildRequires: libstdc++-devel >= 6:4.7
+BuildRequires: openssl-devel
+BuildRequires: protobuf-devel >= 3.12
+BuildRequires: python-Cython >= 0.23
+BuildRequires: python-modules >= 1:2.7
+# with re2Config for cmake
+BuildRequires: re2-devel >= 20200801
+BuildRequires: rpm-build >= 4.6
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+BuildRequires: zlib-devel
+%if %{with apidocs}
+BuildRequires: python-Sphinx >= 1.8.1
+BuildRequires: python-six >= 1.10
+%endif
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+gRPC is a modern, open source, high-performance remote procedure call
+(RPC) framework that can run anywhere. gRPC enables client and server
+applications to communicate transparently, and simplifies the building
+of connected systems.
+
+%description -l pl.UTF-8
+gRPC to nowoczesny, mający otwarty źródła, wydajny szkielet zdalnych
+wywołań procedur (RPC - Remote Procedure Call). Pozwala na
+przezroczystą komunikację klienta i serwera, upraszcza tworzenie
+systemów połączonych.
+
+%package apidocs
+Summary: API documentation for Python gRPC library
+Summary(pl.UTF-8): Dokumentacja API biblioteki Pythona gRPC
+Group: Documentation
+BuildArch: noarch
+
+%description apidocs
+API documentation for Python gRPC library.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API biblioteki Pythona gRPC.
+
+%prep
+%setup -q -n grpc-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+
+%build
+export GRPC_PYTHON_BUILD_SYSTEM_ABSL=1
+export GRPC_PYTHON_BUILD_SYSTEM_CARES=1
+export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
+export GRPC_PYTHON_BUILD_SYSTEM_RE2=1
+export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1
+
+%if %{with apidocs}
+export GRPC_PYTHON_ENABLE_DOCUMENTATION_BUILD=1
+%endif
+%py_build
+
+%if %{with apidocs}
+sphinx-build-2 -b html doc/python/sphinx doc/python/sphinx/_build/html
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+export GRPC_PYTHON_BUILD_SYSTEM_ABSL=1
+export GRPC_PYTHON_BUILD_SYSTEM_CARES=1
+export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
+export GRPC_PYTHON_BUILD_SYSTEM_RE2=1
+export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1
+
+%py_install
+
+%py_postclean
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%dir %{py_sitedir}/grpc
+%{py_sitedir}/grpc/*.py[co]
+%dir %{py_sitedir}/grpc/_cython
+%attr(755,root,root) %{py_sitedir}/grpc/_cython/cygrpc.so
+%{py_sitedir}/grpc/_cython/__init__.py[co]
+%{py_sitedir}/grpc/_cython/_credentials
+%{py_sitedir}/grpc/_cython/_cygrpc
+%{py_sitedir}/grpc/aio
+%{py_sitedir}/grpc/beta
+%{py_sitedir}/grpc/experimental
+%{py_sitedir}/grpc/framework
+%{py_sitedir}/grpcio-%{version}-py*.egg-info
+
+%if %{with apidocs}
+%files -n python-grpcio-apidocs
+%defattr(644,root,root,755)
+%doc doc/python/sphinx/_build/html/{_static,*.html,*.js}
+%endif
diff --git a/grpc-libdir.patch b/grpc-libdir.patch
new file mode 100644
index 0000000..4854aef
--- /dev/null
+++ b/grpc-libdir.patch
@@ -0,0 +1,12 @@
+diff -urNp -x '*.orig' grpc-1.32.0.org/CMakeLists.txt grpc-1.32.0/CMakeLists.txt
+--- grpc-1.32.0.org/CMakeLists.txt 2020-09-08 23:00:06.000000000 +0200
++++ grpc-1.32.0/CMakeLists.txt 2021-03-04 23:29:28.754072089 +0100
+@@ -15666,7 +15666,7 @@ function(generate_pkgconfig name descrip
+ "${output_filepath}"
+ @ONLY)
+ install(FILES "${output_filepath}"
+- DESTINATION "lib/pkgconfig/")
++ DESTINATION "lib${LIB_SUFFIX}/pkgconfig/")
+ endfunction()
+
+ # gpr .pc file
diff --git a/grpc-sphinx.patch b/grpc-sphinx.patch
new file mode 100644
index 0000000..221ced0
--- /dev/null
+++ b/grpc-sphinx.patch
@@ -0,0 +1,22 @@
+diff -urNp -x '*.orig' grpc-1.32.0.org/setup.py grpc-1.32.0/setup.py
+--- grpc-1.32.0.org/setup.py 2021-03-04 23:29:27.074067442 +0100
++++ grpc-1.32.0/setup.py 2021-03-04 23:29:27.300734736 +0100
+@@ -415,7 +415,7 @@ EXTRAS_REQUIRES = {
+ }
+
+ SETUP_REQUIRES = INSTALL_REQUIRES + (
+- 'Sphinx~=1.8.1',
++ 'Sphinx>=1.8.1',
+ 'six>=1.10',
+ ) if ENABLE_DOCUMENTATION_BUILD else ()
+
+--- grpc-1.39.0/doc/python/sphinx/conf.py.orig 2021-07-21 00:39:39.000000000 +0200
++++ grpc-1.39.0/doc/python/sphinx/conf.py 2022-02-15 18:47:25.485810968 +0100
+@@ -57,7 +57,6 @@ extensions = [
+ 'sphinx.ext.todo',
+ 'sphinx.ext.napoleon',
+ 'sphinx.ext.coverage',
+- 'sphinx.ext.autodoc.typehints',
+ ]
+
+ napoleon_google_docstring = True
diff --git a/grpc-system-absl.patch b/grpc-system-absl.patch
new file mode 100644
index 0000000..71dd701
--- /dev/null
+++ b/grpc-system-absl.patch
@@ -0,0 +1,49 @@
+--- grpc-1.39.0/setup.py.orig 2021-07-21 00:39:39.000000000 +0200
++++ grpc-1.39.0/setup.py 2022-02-15 18:06:14.182592092 +0100
+@@ -156,6 +156,8 @@ BUILD_WITH_SYSTEM_CARES = _env_bool_valu
+ # runtime, the shared library must be installed
+ BUILD_WITH_SYSTEM_RE2 = _env_bool_value('GRPC_PYTHON_BUILD_SYSTEM_RE2', 'False')
+
++BUILD_WITH_SYSTEM_ABSL = _env_bool_value('GRPC_PYTHON_BUILD_SYSTEM_ABSL', 'False')
++
+ # Export this variable to force building the python extension with a statically linked libstdc++.
+ # At least on linux, this is normally not needed as we can build manylinux-compatible wheels on linux just fine
+ # without statically linking libstdc++ (which leads to a slight increase in the wheel size).
+@@ -229,7 +231,7 @@ def check_linker_need_libatomic():
+ EXTRA_ENV_COMPILE_ARGS = os.environ.get('GRPC_PYTHON_CFLAGS', None)
+ EXTRA_ENV_LINK_ARGS = os.environ.get('GRPC_PYTHON_LDFLAGS', None)
+ if EXTRA_ENV_COMPILE_ARGS is None:
+- EXTRA_ENV_COMPILE_ARGS = ' -std=c++11'
++ EXTRA_ENV_COMPILE_ARGS = ' -std=c++17'
+ if 'win32' in sys.platform:
+ if sys.version_info < (3, 5):
+ EXTRA_ENV_COMPILE_ARGS += ' -D_hypot=hypot'
+@@ -298,6 +300,10 @@ if BUILD_WITH_SYSTEM_RE2:
+ CORE_C_FILES = filter(lambda x: 'third_party/re2' not in x, CORE_C_FILES)
+ RE2_INCLUDE = (os.path.join('/usr', 'include', 're2'),)
+
++if BUILD_WITH_SYSTEM_ABSL:
++ CORE_C_FILES = filter(lambda x: 'third_party/abseil-cpp' not in x, CORE_C_FILES)
++ ABSL_INCLUDE = (os.path.join('/usr', 'include'),)
++
+ EXTENSION_INCLUDE_DIRECTORIES = ((PYTHON_STEM,) + CORE_INCLUDE + ABSL_INCLUDE +
+ ADDRESS_SORTING_INCLUDE + CARES_INCLUDE +
+ RE2_INCLUDE + SSL_INCLUDE + UPB_INCLUDE +
+@@ -327,6 +333,17 @@ if BUILD_WITH_SYSTEM_CARES:
+ EXTENSION_LIBRARIES += ('cares',)
+ if BUILD_WITH_SYSTEM_RE2:
+ EXTENSION_LIBRARIES += ('re2',)
++if BUILD_WITH_SYSTEM_ABSL:
++ EXTENSION_LIBRARIES += ('absl_bad_optional_access', 'absl_bad_variant_access', 'absl_base',
++ 'absl_civil_time', 'absl_cord', 'absl_cord_internal',
++ 'absl_cordz_functions', 'absl_cordz_handle', 'absl_cordz_info',
++ 'absl_debugging_internal', 'absl_demangle_internal',
++ 'absl_exponential_biased', 'absl_graphcycles_internal', 'absl_int128',
++ 'absl_log_severity', 'absl_malloc_internal', 'absl_raw_logging_internal',
++ 'absl_spinlock_wait', 'absl_stacktrace', 'absl_status', 'absl_statusor',
++ 'absl_str_format_internal', 'absl_strings', 'absl_strings_internal',
++ 'absl_symbolize', 'absl_synchronization', 'absl_throw_delegate',
++ 'absl_time', 'absl_time_zone')
+
+ DEFINE_MACROS = (('_WIN32_WINNT', 0x600),)
+ asm_files = []
diff --git a/grpc-system-openssl.patch b/grpc-system-openssl.patch
new file mode 100644
index 0000000..32e5c0a
--- /dev/null
+++ b/grpc-system-openssl.patch
@@ -0,0 +1,11 @@
+--- grpc-1.39.0/setup.py.orig 2022-02-15 07:57:52.802003651 +0100
++++ grpc-1.39.0/setup.py 2022-02-15 18:04:13.841293750 +0100
+@@ -116,7 +116,7 @@ def _env_bool_value(env_name, default):
+
+
+ BUILD_WITH_BORING_SSL_ASM = _env_bool_value('GRPC_BUILD_WITH_BORING_SSL_ASM',
+- 'True')
++ 'False')
+
+ # Export this environment variable to override the platform variant that will
+ # be chosen for boringssl assembly optimizations. This option is useful when
diff --git a/grpc-system-re2.patch b/grpc-system-re2.patch
new file mode 100644
index 0000000..859e42e
--- /dev/null
+++ b/grpc-system-re2.patch
@@ -0,0 +1,32 @@
+diff -urNp -x '*.orig' grpc-1.32.0.org/setup.py grpc-1.32.0/setup.py
+--- grpc-1.32.0.org/setup.py 2021-03-04 23:29:29.267406836 +0100
++++ grpc-1.32.0/setup.py 2021-03-04 23:29:29.490740783 +0100
+@@ -134,6 +134,8 @@ BUILD_WITH_SYSTEM_CARES = os.environ.get
+
+ BUILD_WITH_SYSTEM_ABSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ABSL', False)
+
++BUILD_WITH_SYSTEM_RE2 = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_RE2', False)
++
+ # For local development use only: This skips building gRPC Core and its
+ # dependencies, including protobuf and boringssl. This allows "incremental"
+ # compilation by first building gRPC Core using make, then building only the
+@@ -252,6 +254,10 @@ if BUILD_WITH_SYSTEM_ABSL:
+ CORE_C_FILES = filter(lambda x: 'third_party/abseil-cpp' not in x, CORE_C_FILES)
+ ABSL_INCLUDE = (os.path.join('/usr', 'include'),)
+
++if BUILD_WITH_SYSTEM_RE2:
++ CORE_C_FILES = filter(lambda x: 'third_party/re2' not in x, CORE_C_FILES)
++ RE2_INCLUDE = (os.path.join('/usr', 'include'),)
++
+ EXTENSION_INCLUDE_DIRECTORIES = ((PYTHON_STEM,) + CORE_INCLUDE + ABSL_INCLUDE +
+ ADDRESS_SORTING_INCLUDE + CARES_INCLUDE +
+ RE2_INCLUDE + SSL_INCLUDE + UPB_INCLUDE +
+@@ -288,6 +294,8 @@ if BUILD_WITH_SYSTEM_ABSL:
+ 'absl_str_format_internal', 'absl_synchronization', 'absl_time',
+ 'absl_civil_time', 'absl_time_zone', 'absl_bad_optional_access',
+ 'absl_bad_variant_access')
++if BUILD_WITH_SYSTEM_RE2:
++ EXTENSION_LIBRARIES += ('re2',)
+
+ DEFINE_MACROS = (('_WIN32_WINNT', 0x600),)
+ asm_files = []
diff --git a/grpc-x32.patch b/grpc-x32.patch
new file mode 100644
index 0000000..2a64155
--- /dev/null
+++ b/grpc-x32.patch
@@ -0,0 +1,11 @@
+--- grpc-1.39.0/src/core/lib/gpr/wrap_memcpy.cc.orig 2022-02-15 17:56:37.812321632 +0100
++++ grpc-1.39.0/src/core/lib/gpr/wrap_memcpy.cc 2022-02-15 17:57:36.515336944 +0100
+@@ -29,7 +29,7 @@
+ extern "C" {
+ #ifdef __linux__
+ #if defined(__x86_64__) && !defined(GPR_MUSL_LIBC_COMPAT) && \
+- !defined(__ANDROID__)
++ !defined(__ANDROID__) && !defined(__ILP32__)
+ __asm__(".symver memcpy,memcpy at GLIBC_2.2.5");
+ void* __wrap_memcpy(void* destination, const void* source, size_t num) {
+ return memcpy(destination, source, num);
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-grpcio.git/commitdiff/96f27e53ab9fcc18fd14ffad65bbc0afcc84eac6
More information about the pld-cvs-commit
mailing list