Просмотр исходного кода

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
Onur Çelebi 7 лет назад
Родитель
Сommit
ebf807422a
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      setup.py

+ 3 - 0
setup.py

@@ -18,6 +18,7 @@ import sys
 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]]