Commit e2298d00 authored by Robert Bradshaw's avatar Robert Bradshaw

merge

parents b02c0b09 05dbd1df
version = '0.11.rc'
version = '0.11.rc2'
......@@ -6,7 +6,7 @@ include setup.py
include bin/cython
include cython.py
include Cython/Compiler/Lexicon.pickle
include Cython/Includes/*.pxd
recursive-include Cython *.pyx *.pxd
include Doc/*
include Demos/*.pyx
......
......@@ -23,7 +23,7 @@ def pyx_to_dll(filename, ext = None, force_rebuild = 0,
build_in_temp=False, pyxbuild_dir=None):
"""Compile a PYX file to a DLL and return the name of the generated .so
or .dll ."""
assert os.path.exists(filename)
assert os.path.exists(filename), "Could not find %s" % os.path.abspath(filename)
path, name = os.path.split(filename)
......
......@@ -18,6 +18,15 @@ EXT_DEP_MODULES = {
'numpy' : re.compile('.*\.numpy_.*').match
}
def get_numpy_include_dirs():
import numpy
return [numpy.get_include()]
EXT_DEP_INCLUDES = [
# test name matcher , callable returning list
(re.compile('numpy_.*').match, get_numpy_include_dirs),
]
VER_DEP_MODULES = {
# such as:
# (2,4) : lambda x: x in ['run.set']
......@@ -271,9 +280,14 @@ class CythonCompileTestCase(unittest.TestCase):
if incdir:
build_extension.include_dirs.append(incdir)
build_extension.finalize_options()
ext_include_dirs = []
for match, get_additional_include_dirs in EXT_DEP_INCLUDES:
if match(module):
ext_include_dirs += get_additional_include_dirs()
extension = Extension(
module,
sources = [self.build_target_filename(module)],
include_dirs = ext_include_dirs,
extra_compile_args = CFLAGS,
)
if self.language == 'cpp':
......
......@@ -11,14 +11,23 @@ if sys.platform == "win32":
setup_args = {}
if sys.version_info < (2,4):
import glob
cython_dir = os.path.join(get_python_lib(prefix=''), 'Cython')
compiler_dir = os.path.join(cython_dir, 'Compiler')
setup_args['data_files'] = [
(compiler_dir, ['Cython/Compiler/Lexicon.pickle']),
(cython_dir, ['Cython/Includes/*.pxd'])]
(cython_dir, [ f for pattern in
['Cython/Includes/*.pxd',
'Cython/Plex/*.pxd',
'Cython/Compiler/*.pxd',
'Cython/Runtime/*.pyx']
for f in glob.glob(pattern) ])]
else:
setup_args['package_data'] = {'Cython.Compiler' : ['Lexicon.pickle'],
'Cython' : ['Includes/*.pxd']}
'Cython' : ['Includes/*.pxd',
'Plex/*.pxd',
'Compiler/*.pxd',
'Runtime/*.pyx']}
if os.name == "posix":
scripts = ["bin/cython"]
......
__doc__ = u"""
>>> global_c_and_s()
99
abcdef
>>> local_c_and_s()
98
bcdefg
"""
cdef char c = 'c'
cdef char* s = 'abcdef'
def global_c_and_s():
pys = s
print c
print pys.decode('ASCII')
def local_c_and_s():
cdef char c = 'b'
cdef char* s = 'bcdefg'
pys = s
print c
print pys.decode('ASCII')
__doc__ = u"""
>>> f = PyFoo()
>>> print(f.bar)
5
>>> print(f.baz)
someval
>>> f = MyPyFoo()
>>> print(f.bar)
7
>>> print(f.baz)
anotherval
>>> f = CyFoo()
>>> print(f.bar)
5
>>> print(f.baz)
anotherval
>>> f = MyCyFoo()
>>> print(f.bar)
7
>>> print(f.baz)
anotherval
>>> f = AnotherFoo()
>>> print(f.bar)
8
>>> print(f.baz)
yetanotherval
"""
# this works:
class PyFoo(object):
bar = 5
baz = u"someval"
class MyPyFoo(PyFoo):
bar = 7
baz = u"anotherval"
# this doesn't:
cdef class CyFoo:
cdef public int bar = 5
cdef public object baz = u"someval"
cdef class MyCyFoo(CyFoo):
cdef public int bar = 7
cdef public object baz = u"anotherval"
class AnotherFoo(CyFoo):
bar = 8
baz = u"yetanotherval"
cdef class A:
cpdef a(int not_self):
pass
......@@ -44,6 +44,11 @@ __doc__ = u"""
-inf
>>> float_infn == float('-inf')
True
>>> global_floats()[1:] == (float('+inf'), float('-inf'))
True
>>> global_floats()[0]
nan
"""
DEF FLOAT = 12.5
......@@ -51,6 +56,10 @@ DEF FLOAT_NAN = float('nan')
DEF FLOAT_INFP = float('+inf')
DEF FLOAT_INFN = float('-inf')
cdef double cdef_float_nan = float('nan')
cdef double cdef_float_infp = float('+inf')
cdef double cdef_float_infn = float('-inf')
float_nan = FLOAT_NAN
float_infp = FLOAT_INFP
float_infn = FLOAT_INFN
......@@ -105,3 +114,5 @@ def infn3():
f = FLOAT_INFN
return f
def global_floats():
return (cdef_float_nan, cdef_float_infp, cdef_float_infn)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment