Commit 6667903199f82dd982e2511c06329b80dd419742

Authored by knodlseder
1 parent bdfd2ff1

remove compile options for darwin

Showing 1 changed file with 29 additions and 0 deletions
pyext/setup.py.in
1 1 from distutils.core import setup, Extension
  2 +from distutils import sysconfig
2 3 import glob
3 4 import os
  5 +import sys
  6 +
  7 +# Removes list of bad prefixes from list
  8 +def remove_prefixes(optlist, bad_prefixes):
  9 + for bad_prefix in bad_prefixes:
  10 + for i, flag in enumerate(optlist):
  11 + if flag.startswith(bad_prefix):
  12 + optlist.pop(i)
  13 + break
  14 + return optlist
  15 +
  16 +# Adjust compile options for darwin
  17 +if sys.platform.lower().startswith("darwin"):
  18 +
  19 + # Remove some time consuming options
  20 + cvars = sysconfig.get_config_vars()
  21 + cflags = cvars.get('OPT')
  22 + if cflags:
  23 + cflags = remove_prefixes(cflags.split(),
  24 + ['-g', '-O', '-Wstrict-prototypes', '-DNDEBUG'])
  25 + cvars['OPT'] = str.join(' ', cflags)
  26 + cvars['CFLAGS'] = cvars['BASECFLAGS'] + ' ' + cvars['OPT']
  27 +
  28 + # Remove -arch flags. This prevents building a fat library
  29 + cvars['ARCHFLAGS'] = ''
  30 +
  31 + # Signal darwin compiler adjustments
  32 + print 'Adjust default distutils compiler options for darwin.'
4 33  
5 34 # Remove any existing symbolic link to libctatools.a
6 35 # This will prevent any exception in creating the symbolic link due to
... ...