Skip to content

Commit

Permalink
REF: use new API for higher level builder reuse.
Browse files Browse the repository at this point in the history
  • Loading branch information
cournape committed Aug 28, 2011
1 parent 0d8b636 commit dfafdcd
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 57 deletions.
16 changes: 8 additions & 8 deletions bscript
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ def pre_configure(context):
# FIXME: fix upstream waf tool to work on mac os X
conf.env.CC = ["/usr/bin/gcc-4.0"]
conf.env.LINK_CC = ["/usr/bin/gcc-4.0"]
# FIXME: fix upstream waf tool to avoid linking against libpython2.6.so
# (cause crashes when importing the extension)
name = "python%s" % ".".join([str(i) for i in sys.version_info[:2]])
remove_flag(name, conf.env.LIB_PYEXT)
remove_flag("-dynamiclib", conf.env.LINKFLAGS_cshlib)
remove_flag_postvalue("-compatibility_version", conf.env.CFLAGS_cshlib)
remove_flag_postvalue("-current_version", conf.env.CFLAGS_cshlib)
## FIXME: fix upstream waf tool to avoid linking against libpython2.6.so
## (cause crashes when importing the extension)
#name = "python%s" % ".".join([str(i) for i in sys.version_info[:2]])
#remove_flag(name, conf.env.LIB_PYEXT)
#remove_flag("-dynamiclib", conf.env.LINKFLAGS_cshlib)
#remove_flag_postvalue("-compatibility_version", conf.env.CFLAGS_cshlib)
#remove_flag_postvalue("-current_version", conf.env.CFLAGS_cshlib)
remove_flag_prevalue("ppc", conf.env.CFLAGS_PYEXT)
remove_flag_prevalue("ppc", conf.env.LINKFLAGS_PYEXT)
conf.env.LINKFLAGS_cshlib.extend(["-undefined", "dynamic_lookup", "-bundle"])
#conf.env.LINKFLAGS_cshlib.extend(["-undefined", "dynamic_lookup", "-bundle"])
conf.env["MACOSX_DEPLOYMENT_TARGET"] = "10.4"

conf.env.CFLAGS_PYEXT.append("-Wfatal-errors")
Expand Down
53 changes: 20 additions & 33 deletions numpy/core/bscript
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,9 @@ def pbuild(context):
def builder(library):
# FIXME: hack to build static library that can be linked into a dlopen-able
# library
bld(features="c pyext cstlib bento",
source=library.sources,
includes=["src/private", "src/npymath", "include"],
use="cshlib",
target=library.name)
return context.default_library_builder(library,
includes=["src/private", "src/npymath", "include"],
use="cloadable")
context.register_compiled_library_builder("npymath", builder)

def builder_multiarray(extension):
Expand Down Expand Up @@ -442,20 +440,16 @@ def pbuild(context):
else:
sources = extension.sources
includes = ["src/multiarray", "src/private"]
bld(features="c cshlib pyext bento",
includes=includes,
target="multiarray",
source=sources,
use="npymath")
return context.default_builder(extension,
includes=includes,
source=sources,
use="npymath")
context.register_builder("multiarray", builder_multiarray)

def builder_sort(extension):
includes = [".", "src/private"]
bld(features="c cshlib pyext bento",
target="_sort",
source=extension.sources,
includes=includes,
use="npymath")
return context.default_builder(extension,
includes=[".", "src/private"],
use="npymath")
context.register_builder("_sort", builder_sort)

def build_ufunc(extension):
Expand All @@ -480,31 +474,24 @@ def pbuild(context):
pjoin("src", "umath", "loops.c.src")]
else:
sources = extension.sources
bld(features="c cshlib pyext bento",
includes=includes,
target="umath",
source=sources,
use="npymath")
return context.default_builder(extension,
includes=includes,
source=sources,
use="npymath")
context.register_builder("umath", build_ufunc)

def build_scalarmath(extension):
bld(features="c cshlib pyext bento",
target=extension.name,
source=extension.sources,
use="npymath")
return context.default_builder(extension,
use="npymath")
context.register_builder("scalarmath", build_scalarmath)

def build_multiarray_tests(extension):
bld(features="c cshlib pyext bento",
target=extension.name,
source=extension.sources,
use="npymath")
return context.default_builder(extension,
use="npymath")
context.register_builder("multiarray_tests", build_multiarray_tests)

def build_dotblas(extension):
if bld.env.HAS_CBLAS:
bld(features="c cshlib pyext bento",
target=extension.name,
source=extension.sources,
use="CBLAS")
return context.default_builder(extension,
use="CBLAS")
context.register_builder("_dotblas", build_dotblas)
5 changes: 1 addition & 4 deletions numpy/fft/bscript
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,5 @@ def build(context):
def build(extension):
includes = ["../core/include", "../core/include/numpy", "../core",
"../core/src/private"]
bld(features="c cshlib pyext bento",
target=extension.name,
source=extension.sources,
includes=includes)
return context.default_builder(extension, includes=includes)
context.register_builder("fftpack_lite", build)
5 changes: 1 addition & 4 deletions numpy/lib/bscript
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@ def pbuild(context):
def builder_compiled_base(extension):
includes = ["../core/include", "../core/include/numpy", "../core",
"../core/src/private"]
bld(features="c cshlib pyext bento",
target=extension.name,
includes=includes,
source=extension.sources)
return context.default_builder(extension, includes=includes)
context.register_builder("_compiled_base", builder_compiled_base)
7 changes: 3 additions & 4 deletions numpy/linalg/bscript
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ def pbuild(context):

includes = ["../core/include", "../core/include/numpy", "../core",
"../core/src/private"]
bld(features="c cshlib pyext bento",
target=extension.name,
source=extension.sources,
includes=includes, **kw)
return context.default_builder(extension,
includes=includes,
**kw)
context.register_builder("lapack_lite", build_lapack_lite)
5 changes: 1 addition & 4 deletions numpy/random/bscript
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,5 @@ def build(context):
def builder(extension):
includes = ["../core/include", "../core/include/numpy", "../core",
"../core/src/private"]
bld(features="c cshlib pyext bento",
target=extension.name,
source=extension.sources,
includes=includes)
return context.default_builder(extension, includes=includes)
context.register_builder("mtrand", builder)

0 comments on commit dfafdcd

Please sign in to comment.