aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python
diff options
context:
space:
mode:
authorGravatar Julien Boeuf <jboeuf@google.com>2016-05-10 15:26:17 -0700
committerGravatar Julien Boeuf <jboeuf@google.com>2016-05-10 15:26:17 -0700
commitbae6a4cb43db9afd0868cdb66f34a5449156a3e5 (patch)
tree344498f33e1583b4f35ad3e06655afeecdd26fdb /src/python
parent8ca294e417217e1577609052f18df84be437c03c (diff)
parente28415bdec34a9f4b19981d9d5d5d3df92eb8e5c (diff)
Merge branch 'master' of https://github.com/grpc/grpc into credentials_refactoring
Diffstat (limited to 'src/python')
-rw-r--r--src/python/grpcio/README.rst1
-rw-r--r--src/python/grpcio/grpc/__init__.py3
-rw-r--r--src/python/grpcio/grpc_core_dependencies.py2
-rw-r--r--src/python/grpcio/grpc_version.py2
-rw-r--r--src/python/grpcio/precompiled.py114
-rw-r--r--src/python/grpcio/tests/stress/client.py5
-rw-r--r--src/python/grpcio/tests/unit/_cython/_channel_test.py5
7 files changed, 11 insertions, 121 deletions
diff --git a/src/python/grpcio/README.rst b/src/python/grpcio/README.rst
index cb3f6b87fe..afc4fe6a37 100644
--- a/src/python/grpcio/README.rst
+++ b/src/python/grpcio/README.rst
@@ -48,6 +48,7 @@ package named :code:`python-dev`).
$ export REPO_ROOT=grpc # REPO_ROOT can be any directory of your choice
$ git clone https://github.com/grpc/grpc.git $REPO_ROOT
$ cd $REPO_ROOT
+ $ git submodule update --init
# For the next two commands do `sudo pip install` if you get permission-denied errors
$ pip install -rrequirements.txt
diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py
index 7086519106..b844a14c48 100644
--- a/src/python/grpcio/grpc/__init__.py
+++ b/src/python/grpcio/grpc/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,4 +27,5 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index 0f0678a2cd..a411f45bbd 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -231,7 +231,7 @@ CORE_SOURCE_FILES = [
'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c',
'src/core/ext/transport/chttp2/client/insecure/channel_create.c',
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
- 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c',
+ 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c',
'third_party/nanopb/pb_common.c',
'third_party/nanopb/pb_decode.c',
'third_party/nanopb/pb_encode.c',
diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py
index 873b4e2a91..0c13104d9d 100644
--- a/src/python/grpcio/grpc_version.py
+++ b/src/python/grpcio/grpc_version.py
@@ -29,4 +29,4 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!!
-VERSION='0.14.0.dev0'
+VERSION='0.15.0.dev0'
diff --git a/src/python/grpcio/precompiled.py b/src/python/grpcio/precompiled.py
deleted file mode 100644
index b6aa7fc90e..0000000000
--- a/src/python/grpcio/precompiled.py
+++ /dev/null
@@ -1,114 +0,0 @@
-# Copyright 2015, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-import os
-import platform
-import shutil
-import sys
-import sysconfig
-
-import setuptools
-
-import commands
-import grpc_version
-
-try:
- from urllib2 import urlopen
-except ImportError:
- from urllib.request import urlopen
-
-PYTHON_STEM = os.path.dirname(os.path.abspath(__file__))
-BINARIES_REPOSITORY = os.environ.get(
- 'GRPC_PYTHON_BINARIES_REPOSITORY',
- 'https://storage.googleapis.com/grpc-precompiled-binaries/python')
-USE_PRECOMPILED_BINARIES = bool(int(os.environ.get(
- 'GRPC_PYTHON_USE_PRECOMPILED_BINARIES', '1')))
-
-def _tagged_ext_name(base):
- uname = platform.uname()
- tags = (
- grpc_version.VERSION,
- 'py{}'.format(sysconfig.get_python_version()),
- uname[0],
- uname[4],
- )
- ucs = 'ucs{}'.format(sysconfig.get_config_var('Py_UNICODE_SIZE'))
- return '{base}-{tags}-{ucs}'.format(
- base=base, tags='-'.join(tags), ucs=ucs)
-
-
-class BuildTaggedExt(setuptools.Command):
-
- description = 'build the gRPC tagged extensions'
- user_options = []
-
- def initialize_options(self):
- # distutils requires this override.
- pass
-
- def finalize_options(self):
- # distutils requires this override.
- pass
-
- def run(self):
- if 'linux' in sys.platform:
- self.run_command('build_ext')
- try:
- os.makedirs('dist/')
- except OSError:
- pass
- shutil.copyfile(
- os.path.join(PYTHON_STEM, 'grpc/_cython/cygrpc.so'),
- 'dist/{}.so'.format(_tagged_ext_name('cygrpc')))
- else:
- sys.stderr.write('nothing to do for build_tagged_ext\n')
-
-
-def update_setup_arguments(setup_arguments):
- if not USE_PRECOMPILED_BINARIES:
- sys.stderr.write('not using precompiled extension')
- return
- url = '{}/{}.so'.format(BINARIES_REPOSITORY, _tagged_ext_name('cygrpc'))
- target_path = os.path.join(PYTHON_STEM, 'grpc/_cython/cygrpc.so')
- try:
- extension = urlopen(url).read()
- except:
- sys.stderr.write(
- 'could not download precompiled extension: {}\n'.format(url))
- return
- try:
- with open(target_path, 'w') as target:
- target.write(extension)
- setup_arguments['ext_modules'] = []
- except:
- sys.stderr.write(
- 'could not write precompiled extension to directory: {} -> {}\n'
- .format(url, target_path))
- return
- setup_arguments['package_data']['grpc._cython'].append('cygrpc.so')
diff --git a/src/python/grpcio/tests/stress/client.py b/src/python/grpcio/tests/stress/client.py
index a733741b73..e2e016760c 100644
--- a/src/python/grpcio/tests/stress/client.py
+++ b/src/python/grpcio/tests/stress/client.py
@@ -117,7 +117,10 @@ def run_test(args):
for runner in runners:
runner.start()
try:
- raise exception_queue.get(block=True, timeout=args.test_duration_secs)
+ timeout_secs = args.test_duration_secs
+ if timeout_secs < 0:
+ timeout_secs = None
+ raise exception_queue.get(block=True, timeout=timeout_secs)
except Queue.Empty:
# No exceptions thrown, success
pass
diff --git a/src/python/grpcio/tests/unit/_cython/_channel_test.py b/src/python/grpcio/tests/unit/_cython/_channel_test.py
index b414f8e6f6..931cd9083e 100644
--- a/src/python/grpcio/tests/unit/_cython/_channel_test.py
+++ b/src/python/grpcio/tests/unit/_cython/_channel_test.py
@@ -33,8 +33,7 @@ import unittest
from grpc._cython import cygrpc
-# TODO(nathaniel): This should be at least one hundred. Why not one thousand?
-_PARALLELISM = 4
+from tests.unit.framework.common import test_constants
def _channel_and_completion_queue():
@@ -61,7 +60,7 @@ def _create_loop_destroy():
def _in_parallel(behavior, arguments):
threads = tuple(
threading.Thread(target=behavior, args=arguments)
- for _ in range(_PARALLELISM))
+ for _ in range(test_constants.PARALLELISM))
for thread in threads:
thread.start()
for thread in threads: