Add Python xDS user agent (#26191)

* Add cpp macro to append wrapped language info to xDS user agent

* Add Python xDS user agent

* fix redefinition error and add macro for wrapped lang version

* clang-format

* Revert xds_api.cc changes

* Use two separate macros

* Yapf

* Regenerate projects

* Include _metadata.py in source distributions

* Attempt to fix quote escaping on Windows

Co-authored-by: Mark D. Roth <roth@google.com>
reviewable/pr26471/r3^2
Richard Belleville 3 years ago committed by GitHub
parent 1e2f19b286
commit f90716a821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      PYTHON-MANIFEST.in
  2. 17
      _metadata.py
  3. 5
      setup.py
  4. 19
      templates/_metadata.py.template

@ -24,3 +24,4 @@ include requirements.txt
include etc/roots.pem include etc/roots.pem
include Makefile include Makefile
include LICENSE include LICENSE
include _metadata.py

@ -0,0 +1,17 @@
# Copyright 2021 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# AUTO-GENERATED FROM `$REPO_ROOT/templates/_metadata.py.template`!!!
__version__ = """1.39.0.dev0"""

@ -41,6 +41,8 @@ from setuptools.command import egg_info
import subprocess import subprocess
from subprocess import PIPE from subprocess import PIPE
import _metadata
# Redirect the manifest template from MANIFEST.in to PYTHON-MANIFEST.in. # Redirect the manifest template from MANIFEST.in to PYTHON-MANIFEST.in.
egg_info.manifest_maker.template = 'PYTHON-MANIFEST.in' egg_info.manifest_maker.template = 'PYTHON-MANIFEST.in'
@ -228,6 +230,9 @@ EXTRA_ENV_COMPILE_ARGS = os.environ.get('GRPC_PYTHON_CFLAGS', None)
EXTRA_ENV_LINK_ARGS = os.environ.get('GRPC_PYTHON_LDFLAGS', None) EXTRA_ENV_LINK_ARGS = os.environ.get('GRPC_PYTHON_LDFLAGS', None)
if EXTRA_ENV_COMPILE_ARGS is None: if EXTRA_ENV_COMPILE_ARGS is None:
EXTRA_ENV_COMPILE_ARGS = ' -std=c++11' EXTRA_ENV_COMPILE_ARGS = ' -std=c++11'
EXTRA_ENV_COMPILE_ARGS += ' \'-DGRPC_XDS_USER_AGENT_NAME_SUFFIX=\"\\\"Python\\\"\"\''
EXTRA_ENV_COMPILE_ARGS += ' \'-DGRPC_XDS_USER_AGENT_VERSION_SUFFIX=\"\\\"{}\\\"\"\''.format(
_metadata.__version__)
if 'win32' in sys.platform: if 'win32' in sys.platform:
if sys.version_info < (3, 5): if sys.version_info < (3, 5):
EXTRA_ENV_COMPILE_ARGS += ' -D_hypot=hypot' EXTRA_ENV_COMPILE_ARGS += ' -D_hypot=hypot'

@ -0,0 +1,19 @@
%YAML 1.2
--- |
# Copyright 2021 The gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# AUTO-GENERATED FROM `$REPO_ROOT/templates/_metadata.py.template`!!!
__version__ = """${settings.python_version.pep440()}"""
Loading…
Cancel
Save