From 398b06e8432e5e9007349b7c89ae6b67e02c1035 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Fri, 15 Jul 2016 23:17:41 -0700 Subject: [PATCH] Force the Python host version on Mac OS X --- setup.py | 6 ++++++ tools/distrib/python/grpcio_tools/setup.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/setup.py b/setup.py index 24414457cd5..b43ec9ae3d4 100644 --- a/setup.py +++ b/setup.py @@ -30,10 +30,12 @@ """A setup module for the GRPC Python package.""" from distutils import extension as _extension +from distutils import util import os import os.path import pkg_resources import platform +import re import shlex import shutil import sys @@ -133,6 +135,10 @@ if 'darwin' in sys.platform and PY3: if mac_target and (pkg_resources.parse_version(mac_target) < pkg_resources.parse_version('10.7.0')): os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.7' + os.environ['_PYTHON_HOST_PLATFORM'] = re.sub( + r'macosx-[0-9]+\.[0-9]+-(.+)', + r'macosx-10.7-\1', + util.get_platform()) def cython_extensions(module_names, extra_sources, include_dirs, diff --git a/tools/distrib/python/grpcio_tools/setup.py b/tools/distrib/python/grpcio_tools/setup.py index a00ce011107..8082c7a665a 100644 --- a/tools/distrib/python/grpcio_tools/setup.py +++ b/tools/distrib/python/grpcio_tools/setup.py @@ -28,11 +28,13 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from distutils import extension +from distutils import util import errno import os import os.path import pkg_resources import platform +import re import shlex import shutil import sys @@ -83,6 +85,10 @@ if 'darwin' in sys.platform and PY3: if mac_target and (pkg_resources.parse_version(mac_target) < pkg_resources.parse_version('10.9.0')): os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9' + os.environ['_PYTHON_HOST_PLATFORM'] = re.sub( + r'macosx-[0-9]+\.[0-9]+-(.+)', + r'macosx-10.9-\1', + util.get_platform()) def package_data(): tools_path = GRPC_PYTHON_TOOLS_PACKAGE.replace('.', os.path.sep)