diff options
author | Masood Malekghassemi <atash@google.com> | 2016-06-03 19:29:12 -0700 |
---|---|---|
committer | Masood Malekghassemi <atash@google.com> | 2016-07-08 12:36:04 -0700 |
commit | 586e3835fe01257299a8573df3e7540e5778bc45 (patch) | |
tree | 66f9d3f872d803c20faab14683141cc18c89473e /tools/distrib/python | |
parent | af26ce6f4383a6c0e70d4c58f276ec4f2a722dfa (diff) |
Make Python build standalone on Windows
Diffstat (limited to 'tools/distrib/python')
-rw-r--r-- | tools/distrib/python/grpcio_tools/setup.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/distrib/python/grpcio_tools/setup.py b/tools/distrib/python/grpcio_tools/setup.py index afb6063906..e025158a82 100644 --- a/tools/distrib/python/grpcio_tools/setup.py +++ b/tools/distrib/python/grpcio_tools/setup.py @@ -32,6 +32,7 @@ import errno import os import os.path import pkg_resources +import platform import shlex import shutil import sys @@ -45,6 +46,9 @@ from setuptools.command import build_ext os.chdir(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.abspath('.')) +import protoc_lib_deps +import grpc_version + PY3 = sys.version_info.major == 3 # There are some situations (like on Windows) where CC, CFLAGS, and LDFLAGS are @@ -60,8 +64,9 @@ EXTRA_LINK_ARGS = shlex.split(os.environ.get('GRPC_PYTHON_LDFLAGS', GRPC_PYTHON_TOOLS_PACKAGE = 'grpc.tools' GRPC_PYTHON_PROTO_RESOURCES_NAME = '_proto' -import protoc_lib_deps -import grpc_version +DEFINE_MACROS = (('HAVE_PTHREAD', 1),) +if "win32" in sys.platform and '64bit' in platform.architecture()[0]: + DEFINE_MACROS += (('MS_WIN64', 1),) # By default, Python3 distutils enforces compatibility of # c plugins (.so files) with the OSX version Python3 was built with. @@ -108,9 +113,9 @@ def protoc_ext_module(): protoc_lib_deps.CC_INCLUDE, ], language='c++', - define_macros=[('HAVE_PTHREAD', 1)], - extra_compile_args=EXTRA_COMPILE_ARGS, - extra_link_args=EXTRA_LINK_ARGS, + define_macros=list(DEFINE_MACROS), + extra_compile_args=list(EXTRA_COMPILE_ARGS), + extra_link_args=list(EXTRA_LINK_ARGS), ) return plugin_ext |