From dc88538e80c2de28a4b92cad18d5487afcab38e7 Mon Sep 17 00:00:00 2001 From: iarspider Date: Sat, 11 Dec 2021 22:35:07 +0100 Subject: [PATCH] New package: py-grpcio-tools; add new version of py-grpcio (#27907) --- .../packages/py-grpcio-tools/package.py | 60 +++++++++++++++++++ .../builtin/packages/py-grpcio/package.py | 1 + 2 files changed, 61 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-grpcio-tools/package.py diff --git a/var/spack/repos/builtin/packages/py-grpcio-tools/package.py b/var/spack/repos/builtin/packages/py-grpcio-tools/package.py new file mode 100644 index 0000000000..1ebc9b2ac9 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-grpcio-tools/package.py @@ -0,0 +1,60 @@ +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class PyGrpcioTools(PythonPackage): + """Protobuf code generator for gRPC""" + + homepage = "https://grpc.io/" + pypi = "grpcio-tools/grpcio-tools-1.42.0.tar.gz" + + version('1.42.0', sha256='d0a0daa82eb2c2fb8e12b82a458d1b7c5516fe1135551da92b1a02e2cba93422') + version('1.39.0', sha256='39dfe7415bc0d3860fdb8dd90607594b046b88b57dbe64284efa4820f951c805') + + depends_on('python@3.6:', type=('build', 'run')) + depends_on('py-setuptools', type='build') + depends_on('py-protobuf@3.5.0.post1:3', type=('build', 'run')) + depends_on('py-grpcio@1.42.0:', type=('build', 'run'), when='@1.42.0:') + depends_on('py-grpcio@1.39.0:', type=('build', 'run'), when='@1.39.0:1.41') + depends_on('py-cython@0.23:', type='build') + depends_on('openssl') + depends_on('zlib') + depends_on('c-ares') + depends_on('re2+shared') + + def setup_build_environment(self, env): + env.set('GRPC_PYTHON_BUILD_WITH_CYTHON', True) + env.set('GRPC_PYTHON_BUILD_SYSTEM_OPENSSL', True) + env.set('GRPC_PYTHON_BUILD_SYSTEM_ZLIB', True) + env.set('GRPC_PYTHON_BUILD_SYSTEM_CARES', True) + env.set('GRPC_PYTHON_BUILD_SYSTEM_RE2', True) + # https://github.com/grpc/grpc/pull/24449 + env.set('GRPC_BUILD_WITH_BORING_SSL_ASM', '') + env.set('GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS', str(make_jobs)) + + for dep in self.spec.dependencies(deptype='link'): + query = self.spec[dep.name] + env.prepend_path('LIBRARY_PATH', query.libs.directories[0]) + env.prepend_path('CPATH', query.headers.directories[0]) + + def patch(self): + if self.spec.satisfies('%fj'): + filter_file("-std=gnu99", "", "setup.py") + + # use the spack packages + filter_file(r'(\s+SSL_INCLUDE = ).*', + r"\1('{0}',)".format(self.spec['openssl'].prefix.include), + 'setup.py') + filter_file(r'(\s+ZLIB_INCLUDE = ).*', + r"\1('{0}',)".format(self.spec['zlib'].prefix.include), + 'setup.py') + filter_file(r'(\s+CARES_INCLUDE = ).*', + r"\1('{0}',)".format(self.spec['c-ares'].prefix.include), + 'setup.py') + filter_file(r'(\s+RE2_INCLUDE = ).*', + r"\1('{0}',)".format(self.spec['re2'].prefix.include), + 'setup.py') diff --git a/var/spack/repos/builtin/packages/py-grpcio/package.py b/var/spack/repos/builtin/packages/py-grpcio/package.py index 6975e15b86..0159a69255 100644 --- a/var/spack/repos/builtin/packages/py-grpcio/package.py +++ b/var/spack/repos/builtin/packages/py-grpcio/package.py @@ -12,6 +12,7 @@ class PyGrpcio(PythonPackage): homepage = "https://grpc.io/" pypi = "grpcio/grpcio-1.32.0.tar.gz" + version('1.42.0', sha256='4a8f2c7490fe3696e0cdd566e2f099fb91b51bc75446125175c55581c2f7bc11') version('1.39.0', sha256='57974361a459d6fe04c9ae0af1845974606612249f467bbd2062d963cb90f407') version('1.38.1', sha256='1f79d8a24261e3c12ec3a6c25945ff799ae09874fd24815bc17c2dc37715ef6c') version('1.38.0', sha256='abbf9c8c3df4d5233d5888c6cfa85c1bb68a6923749bd4dd1abc6e1e93986f17')