Skip to content

Commit

Permalink
more cython optional
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Apr 2, 2015
1 parent c15d4f2 commit 433d9d7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions setup.py
Expand Up @@ -21,8 +21,6 @@
from distutils.extension import Extension

lib_talib_name = 'ta_lib' # the underlying C library's name
ext_modules = []
cmdclass = {}

platform_supported = False
for prefix in ['darwin', 'linux', 'bsd']:
Expand Down Expand Up @@ -57,9 +55,9 @@

try:
from Cython.Distutils import build_ext
cmdclass['build_ext'] = build_ext
has_cython = True
except ImportError:
pass
has_cython = False

if not platform_supported:
raise NotImplementedError(sys.platform)
Expand All @@ -74,10 +72,15 @@
else:
warnings.warn('Cannot find ta-lib library, installation may fail.')

cmdclass = {}
if has_cython:
cmdclass['build_ext'] = build_ext

ext_modules = []
for name in ['common', 'func', 'abstract']:
ext = Extension(
'talib.%s' % name,
['talib/%s.pyx' % name],
[('talib/%s.pyx' if has_cython else 'talib/%s.c') % name],
include_dirs = include_dirs,
library_dirs = lib_talib_dirs,
libraries = [lib_talib_name]
Expand Down

0 comments on commit 433d9d7

Please sign in to comment.