aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Nathaniel Manista <nathaniel@google.com>2016-02-08 14:57:59 -0800
committerGravatar Nathaniel Manista <nathaniel@google.com>2016-02-08 14:57:59 -0800
commit757c157d861dff34bb85b4f6e10d0708fecb88ce (patch)
tree33955aa65bf961e9f0fa1db641a8cd51bc939a8d
parentd397b7a628e0d422cfb994350770be123328b000 (diff)
parent35afe4afaf2090754bdcad34835cee3a07d6e90b (diff)
Merge pull request #5134 from soltanmm/cleaners
Clean-up Python linux-binary installation.
-rw-r--r--src/python/grpcio/commands.py40
1 files changed, 23 insertions, 17 deletions
diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py
index 5de631922a..774e7ad6a1 100644
--- a/src/python/grpcio/commands.py
+++ b/src/python/grpcio/commands.py
@@ -56,6 +56,9 @@ BINARIES_REPOSITORY = os.environ.get(
'GRPC_PYTHON_BINARIES_REPOSITORY',
'https://storage.googleapis.com/grpc-precompiled-binaries/python')
+USE_GRPC_CUSTOM_BDIST = bool(int(os.environ.get(
+ 'GRPC_PYTHON_USE_CUSTOM_BDIST', '1')))
+
CONF_PY_ADDENDUM = """
extensions.append('sphinx.ext.napoleon')
napoleon_google_docstring = True
@@ -135,7 +138,7 @@ class Install(install.install, EggNameMixin):
def initialize_options(self):
install.install.initialize_options(self)
- self.use_grpc_custom_bdist = bool(int(os.environ.get('GRPC_PYTHON_USE_CUSTOM_BDIST', '1')))
+ self.use_grpc_custom_bdist = USE_GRPC_CUSTOM_BDIST
def finalize_options(self):
install.install.finalize_options(self)
@@ -143,22 +146,25 @@ class Install(install.install, EggNameMixin):
def run(self):
if self.use_grpc_custom_bdist:
try:
- egg_path = _get_grpc_custom_bdist_egg(self.egg_name(True),
- self.egg_name(False))
- except CommandError as error:
- sys.stderr.write(
- '\nWARNING: Failed to acquire grpcio prebuilt binary:\n'
- '{}.\n\n'.format(error.message))
- raise
- try:
- self._run_bdist_retrieval_install(egg_path)
- except Exception as error:
- # if anything else happens (and given how there's no way to really know
- # what's happening in setuptools here, I mean *anything*), warn the user
- # and fall back to building from source.
- sys.stderr.write(
- '{}\nWARNING: Failed to install grpcio prebuilt binary.\n\n'
- .format(traceback.format_exc()))
+ try:
+ egg_path = _get_grpc_custom_bdist_egg(self.egg_name(True),
+ self.egg_name(False))
+ except CommandError as error:
+ sys.stderr.write(
+ '\nWARNING: Failed to acquire grpcio prebuilt binary:\n'
+ '{}.\n\n'.format(error.message))
+ raise
+ try:
+ self._run_bdist_retrieval_install(egg_path)
+ except Exception as error:
+ # if anything else happens (and given how there's no way to really know
+ # what's happening in setuptools here, I mean *anything*), warn the user
+ # and fall back to building from source.
+ sys.stderr.write(
+ '{}\nWARNING: Failed to install grpcio prebuilt binary.\n\n'
+ .format(traceback.format_exc()))
+ raise
+ except Exception:
install.install.run(self)
else:
install.install.run(self)