Skip to content

Commit 416e863

Browse files
authored
Merge pull request #13 from JoshRosen/fix-build-with-newer-xcode
On Mac, target macOS 10.9 when possible (fixes build on XCode 10+)
2 parents 9d933a2 + 230010b commit 416e863

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

setup.py

+24
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,31 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# Parts of this file were taken from the pandas project
16+
# (https://github.com/pandas-dev/pandas), which is permitted for use under
17+
# the BSD 3-Clause License
18+
19+
from distutils.sysconfig import get_config_var
20+
from distutils.version import LooseVersion
21+
import os
22+
import platform
1523
from setuptools import setup, Extension
24+
import sys
25+
26+
27+
# From https://github.com/pandas-dev/pandas/pull/24274:
28+
# For mac, ensure extensions are built for macos 10.9 when compiling on a
29+
# 10.9 system or above, overriding distuitls behaviour which is to target
30+
# the version that python was built for. This may be overridden by setting
31+
# MACOSX_DEPLOYMENT_TARGET before calling setup.py
32+
if sys.platform == 'darwin':
33+
if 'MACOSX_DEPLOYMENT_TARGET' not in os.environ:
34+
current_system = LooseVersion(platform.mac_ver()[0])
35+
python_target = LooseVersion(
36+
get_config_var('MACOSX_DEPLOYMENT_TARGET'))
37+
if python_target < '10.9' and current_system >= '10.9':
38+
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
39+
1640

1741
sasl_module = Extension('sasl.saslwrapper',
1842
sources=['sasl/saslwrapper.cpp'],

0 commit comments

Comments
 (0)