Change MACOSX_DEPLOYMENT_TARGET to 10.9 (#5406)

* Add kokoro build for python source package

* Use libc++ for xcode 10 (#5303)

The xcode 10 removes the deprecated libstdc++ library. We could set
"MACOSX_DEPLOYMENT_TARGET" to "10.9" to use libc++ instead.

* Add python 3.7 build

* Add build for python 3.7 on linux and windows

* Remove unused source build

* Add comment

* Fix $MACOSX_DEPLOYMENT_TARGET mismatch

* Fix MACOSX_DEPLOYMENT_TARGET mismatch

* Add missing import for sysconfig

* Add missing imports
This commit is contained in:
Paul Yang 2018-11-28 16:45:16 -08:00 committed by GitHub
parent 0b9af83dae
commit 704037f23a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 0 deletions

View File

@ -43,3 +43,4 @@ build_artifact_version 2.7
build_artifact_version 3.4
build_artifact_version 3.5
build_artifact_version 3.6
build_artifact_version 3.7

View File

@ -45,3 +45,4 @@ build_artifact_version 2.7
build_artifact_version 3.4
build_artifact_version 3.5
build_artifact_version 3.6
build_artifact_version 3.7

View File

@ -51,3 +51,13 @@ SET PYTHON=C:\python36
SET PYTHON_VERSION=3.6
SET PYTHON_ARCH=64
CALL build_single_artifact.bat
SET PYTHON=C:\python37_32bit
SET PYTHON_VERSION=3.7
SET PYTHON_ARCH=32
CALL build_single_artifact.bat
SET PYTHON=C:\python37
SET PYTHON_VERSION=3.7
SET PYTHON_ARCH=64
CALL build_single_artifact.bat

View File

@ -1,10 +1,14 @@
#! /usr/bin/env python
#
# See README for usage instructions.
from distutils import util
import glob
import os
import pkg_resources
import re
import subprocess
import sys
import sysconfig
import platform
# We must use setuptools, not distutils, because we need to use the
@ -185,6 +189,18 @@ if __name__ == '__main__':
if sys.platform == 'darwin':
extra_compile_args.append("-Wno-shorten-64-to-32");
# https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
# C++ projects must now migrate to libc++ and are recommended to set a
# deployment target of macOS 10.9 or later, or iOS 7 or later.
if sys.platform == 'darwin':
mac_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
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())
# https://github.com/Theano/Theano/issues/4926
if sys.platform == 'win32':
extra_compile_args.append('-D_hypot=hypot')