From 1a688982a424b849c7fb5702a3357d9789cbaa54 Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 28 Jan 2019 11:33:19 -0800 Subject: [PATCH 1/2] Cast the str type if it is unicode --- src/python/grpcio/_parallel_compile_patch.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/python/grpcio/_parallel_compile_patch.py b/src/python/grpcio/_parallel_compile_patch.py index 4d03ef49ba0..de48a4099b5 100644 --- a/src/python/grpcio/_parallel_compile_patch.py +++ b/src/python/grpcio/_parallel_compile_patch.py @@ -19,6 +19,7 @@ Enabling parallel build helps a lot. import distutils.ccompiler import os +import six try: BUILD_EXT_COMPILER_JOBS = int( @@ -37,6 +38,8 @@ def _parallel_compile(self, extra_preargs=None, extra_postargs=None, depends=None): + if isinstance(output_dir, six.text_type): + output_dir = str(output_dir) # setup the same way as distutils.ccompiler.CCompiler # https://github.com/python/cpython/blob/31368a4f0e531c19affe2a1becd25fc316bc7501/Lib/distutils/ccompiler.py#L564 macros, objects, extra_postargs, pp_opts, build = self._setup_compile( From 91fde06b12c0bda8da88141f5ae756b526e039ee Mon Sep 17 00:00:00 2001 From: Lidi Zheng Date: Mon, 28 Jan 2019 12:12:06 -0800 Subject: [PATCH 2/2] Remove the dependency of 'six' --- src/python/grpcio/_parallel_compile_patch.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/python/grpcio/_parallel_compile_patch.py b/src/python/grpcio/_parallel_compile_patch.py index de48a4099b5..b34aa17fd0b 100644 --- a/src/python/grpcio/_parallel_compile_patch.py +++ b/src/python/grpcio/_parallel_compile_patch.py @@ -19,7 +19,6 @@ Enabling parallel build helps a lot. import distutils.ccompiler import os -import six try: BUILD_EXT_COMPILER_JOBS = int( @@ -38,12 +37,10 @@ def _parallel_compile(self, extra_preargs=None, extra_postargs=None, depends=None): - if isinstance(output_dir, six.text_type): - output_dir = str(output_dir) # setup the same way as distutils.ccompiler.CCompiler # https://github.com/python/cpython/blob/31368a4f0e531c19affe2a1becd25fc316bc7501/Lib/distutils/ccompiler.py#L564 macros, objects, extra_postargs, pp_opts, build = self._setup_compile( - output_dir, macros, include_dirs, sources, depends, extra_postargs) + str(output_dir), macros, include_dirs, sources, depends, extra_postargs) cc_args = self._get_cc_args(pp_opts, debug, extra_preargs) def _compile_single_file(obj):