* Fix numpy commit problem

This commit is contained in:
Matthew Honnibal 2015-01-28 14:00:20 +11:00
parent f9ee5d9934
commit 781dd712dc
1 changed files with 12 additions and 7 deletions

View File

@ -68,15 +68,18 @@ def c_ext(mod_name, language, includes, compile_args):
extra_compile_args=compile_args, extra_link_args=compile_args) extra_compile_args=compile_args, extra_link_args=compile_args)
def cython_ext(mod_name, language, includes, compile_args): def cython_exts(mod_names, language, includes, compile_args):
import Cython.Distutils import Cython.Distutils
import Cython.Build import Cython.Build
mod_path = mod_name.replace('.', '/') + '.pyx'
if language == 'cpp': if language == 'cpp':
language = 'c++' language = 'c++'
ext = Extension(mod_name, [mod_path], language=language, include_dirs=includes, exts = []
extra_compile_args=compile_args) for mod_name in mod_names:
return Cython.Build.cythonize([ext])[0] mod_path = mod_name.replace('.', '/') + '.pyx'
e = Extension(mod_name, [mod_path], language=language, include_dirs=includes,
extra_compile_args=compile_args)
exts.append(e)
return Cython.Build.cythonize(exts)
def run_setup(exts): def run_setup(exts):
@ -110,10 +113,12 @@ def run_setup(exts):
def main(modules, is_pypy): def main(modules, is_pypy):
language = "cpp" language = "cpp"
ext_func = cython_ext if use_cython else c_ext
includes = ['.', path.join(sys.prefix, 'include')] includes = ['.', path.join(sys.prefix, 'include')]
compile_args = ['-O3'] compile_args = ['-O3']
exts = [ext_func(mn, language, includes, compile_args) for mn in modules] if use_cython:
exts = cython_exts(modules, language, includes, compile_args)
else:
exts = [c_ext(mn, language, includes, compile_args) for mn in modules]
run_setup(exts) run_setup(exts)