Merge pull request #56 from kpayson64/working_mac_py_cpp

Working mac py cpp
pull/10427/head
Craig Tiller 8 years ago committed by GitHub
commit c88094d64b
  1. 3
      setup.py
  2. 30
      src/python/grpcio/commands.py

@ -104,6 +104,7 @@ EXTRA_ENV_LINK_ARGS = os.environ.get('GRPC_PYTHON_LDFLAGS', None)
if EXTRA_ENV_COMPILE_ARGS is None:
EXTRA_ENV_COMPILE_ARGS = ''
if 'win32' in sys.platform and sys.version_info < (3, 5):
EXTRA_ENV_COMPILE_ARGS += ' -std=c++11'
# We use define flags here and don't directly add to DEFINE_MACROS below to
# ensure that the expert user/builder has a way of turning it off (via the
# envvars) without adding yet more GRPC-specific envvars.
@ -113,7 +114,7 @@ if EXTRA_ENV_COMPILE_ARGS is None:
else:
EXTRA_ENV_COMPILE_ARGS += ' -D_ftime=_ftime64 -D_timeb=__timeb64'
elif 'win32' in sys.platform:
EXTRA_ENV_COMPILE_ARGS += ' -D_PYTHON_MSVC -std=c++11'
EXTRA_ENV_COMPILE_ARGS += ' -D_PYTHON_MSVC'
elif "linux" in sys.platform:
EXTRA_ENV_COMPILE_ARGS += ' -std=c++11 -fvisibility=hidden -fno-wrapv'
elif "darwin" in sys.platform:

@ -267,24 +267,28 @@ class BuildExt(build_ext.build_ext):
def build_extensions(self):
if "darwin" in sys.platform:
config = os.environ.get('CONFIG', opt)
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)
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')
sys.stdout.write(make_out + '\n')
if make_err:
sys.stderr.write(make_err + '\n')
sys.stderr.write(make_err + '\n')
if make_process.returncode != 0:
raise Exception("make command failed!")
raise Exception("make command failed!")
compiler = self.compiler.compiler_type
if compiler in BuildExt.C_OPTIONS:

Loading…
Cancel
Save