From ebf807422ace063cf27cf841a32e951f5a5b669d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Onur=20=C3=87elebi?= Date: Thu, 4 Apr 2019 08:10:28 -0700 Subject: [PATCH] set environment variable MACOSX_DEPLOYMENT_TARGET to be consistent with `-stdlib=libc++` Summary: On OS X, it shouldn't be necessary to manually set the variable `MACOSX_DEPLOYMENT_TARGET` when installing python bindings. Reviewed By: EdouardGrave Differential Revision: D14726033 fbshipit-source-id: 6583650c03f1a2c5da6922d70ca8eb90df89e5ef --- setup.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup.py b/setup.py index fdd97eb55..d8061c34b 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,7 @@ import setuptools import os import subprocess +import platform __version__ = '0.8.22' FASTTEXT_SRC = "src" @@ -118,6 +119,8 @@ class BuildExt(build_ext): def build_extensions(self): if sys.platform == 'darwin': + mac_osx_version = float('.'.join(platform.mac_ver()[0].split('.')[:2])) + os.environ['MACOSX_DEPLOYMENT_TARGET'] = str(mac_osx_version) all_flags = ['-stdlib=libc++', '-mmacosx-version-min=10.7'] if has_flag(self.compiler, [all_flags[0]]): self.c_opts['unix'] += [all_flags[0]]