diff options
Diffstat (limited to 'src/python/grpcio/commands.py')
-rw-r--r-- | src/python/grpcio/commands.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/python/grpcio/commands.py b/src/python/grpcio/commands.py index e50ccbe23e..4f072809c4 100644 --- a/src/python/grpcio/commands.py +++ b/src/python/grpcio/commands.py @@ -260,12 +260,36 @@ class BuildExt(build_ext.build_ext): """Custom build_ext command to enable compiler-specific flags.""" C_OPTIONS = { - 'unix': ('-pthread', '-std=gnu99'), + 'unix': ('-pthread',), 'msvc': (), } LINK_OPTIONS = {} def build_extensions(self): + if "darwin" in sys.platform: + config = os.environ.get('CONFIG', 'opt') + target_path = os.path.abspath( + os.path.join( + os.path.dirname(os.path.realpath(__file__)), '..', '..', + '..', 'libs', config)) + targets = [ + os.path.join(target_path, 'libboringssl.a'), + os.path.join(target_path, 'libares.a'), + os.path.join(target_path, 'libgpr.a'), + os.path.join(target_path, 'libgrpc.a') + ] + make_process = subprocess.Popen( + ['make'] + targets, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + make_out, make_err = make_process.communicate() + if make_out and make_process.returncode != 0: + sys.stdout.write(make_out + '\n') + if make_err: + sys.stderr.write(make_err + '\n') + if make_process.returncode != 0: + raise Exception("make command failed!") + compiler = self.compiler.compiler_type if compiler in BuildExt.C_OPTIONS: for extension in self.extensions: |