Skip to content

Commit

Permalink
BLD: Close pandas-dev#10510, add CFLAGS -fgnu89-inline on FreeBSD 10+
Browse files Browse the repository at this point in the history
  • Loading branch information
iblislin committed Nov 10, 2015
1 parent 0c8a8e1 commit 57426e1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions doc/source/whatsnew/v0.17.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,7 @@ Bug Fixes
- Fixed a bug that prevented the construction of an empty series of dtype
``datetime64[ns, tz]`` (:issue:`11245`).
- Bug in ``DataFrame.to_dict()`` produces a ``np.datetime64`` object instead of ``Timestamp`` when only datetime is present in data (:issue:`11327`)



- Bug in the link-time error caused by C ``inline`` functions on FreeBSD 10+ (with ``clang``) (:issue:`10510`)
25 changes: 24 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import shutil
import warnings
import re
import platform
from distutils.version import LooseVersion

# versioning
Expand Down Expand Up @@ -289,7 +290,10 @@ def run(self):


class CheckingBuildExt(build_ext):
"""Subclass build_ext to get clearer report if Cython is necessary."""
"""
Subclass build_ext to get clearer report if Cython is necessary.
Also, add some platform based compiler flags.
"""

def check_cython_extensions(self, extensions):
for ext in extensions:
Expand All @@ -302,8 +306,27 @@ def check_cython_extensions(self, extensions):

def build_extensions(self):
self.check_cython_extensions(self.extensions)
self.add_gnu_inline_flag(self.extensions)
build_ext.build_extensions(self)

def add_gnu_inline_flag(self, extensions):
'''
Add CFLAGS `-fgnu89-inline` for clang on FreeBSD 10+
'''
if not platform.system() == 'FreeBSD':
return

try:
bsd_release = float(platform.release().split('-')[0])
except ValueError: # unknow freebsd version
return

if bsd_release < 10: # 9 or earlier still using gcc42
return

for ext in extensions:
ext.extra_compile_args += ['-fgnu89-inline']


class CythonCommand(build_ext):
"""Custom distutils command subclassed from Cython.Distutils.build_ext
Expand Down

0 comments on commit 57426e1

Please sign in to comment.