code.putln("#ifdef CYTHON_REFNANNY")
code.putln("void* __pyx_refchk = NULL;")
- code.putln("__Pyx_Refnanny = (__Pyx_RefnannyAPIStruct*) PyCObject_Import((char *)\"refnanny\", (char *)\"RefnannyAPI\");")
- code.putln("if (!__Pyx_Refnanny) Py_FatalError(\"failed to import refnanny module\");")
+ code.putln("__Pyx_Refnanny = __Pyx_ImportRefcountAPI(\"refnanny\");")
+ code.putln("if (!__Pyx_Refnanny) {")
+ code.putln(" PyErr_Clear();")
+ code.putln(" __Pyx_Refnanny = __Pyx_ImportRefcountAPI(\"Cython.Runtime.refnanny\");")
+ code.putln(" if (!__Pyx_Refnanny)")
+ code.putln(" Py_FatalError(\"failed to import refnanny module\");")
+ code.putln("}")
code.putln("__pyx_refchk = __Pyx_Refnanny->NewContext(\"%s\", __LINE__);"% header3)
code.putln("#endif")
int (*FinishContext)(void*);
} __Pyx_RefnannyAPIStruct;
static __Pyx_RefnannyAPIStruct* __Pyx_Refnanny = NULL;
+#define __Pyx_ImportRefcountAPI(name) \
+ (__Pyx_RefnannyAPIStruct*) PyCObject_Import((char *)name, (char *)\"RefnannyAPI\")
#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (r), __LINE__)
#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (r), __LINE__)
#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
@rm -f Cython/Compiler/Parsing.{c,so,pyd}
@rm -f Cython/Compiler/Scanning.{c,so,pyd}
@rm -f Cython/Compiler/Visitor.{c,so,pyd}
+ @rm -f Cython/Runtime/refnanny.{c,so,pyd}
@rm -f Cython/Plex/Scanners.{c,so,pyd}
@(cd Demos; $(MAKE) clean)
compiled_modules = ["Cython.Plex.Scanners",
"Cython.Compiler.Scanning",
"Cython.Compiler.Parsing",
- "Cython.Compiler.Visitor"]
+ "Cython.Compiler.Visitor",
+ "Cython.Runtime.refnanny"]
extensions = []
for module in compiled_modules:
source_file = os.path.join(source_root, *module.split('.'))
+ if os.path.exists(source_file + ".py"):
+ source_file = source_file + ".py"
+ else:
+ source_file = source_file + ".pyx"
print("Compiling module %s ..." % module)
- result = compile(source_file + ".py")
+ result = compile(source_file)
if result.c_file:
extensions.append(
Extension(module, sources = [result.c_file])
setup(
- name = 'Cython',
+ name = 'Cython',
version = version,
url = 'http://www.cython.org',
author = 'Greg Ewing, Robert Bradshaw, Stefan Behnel, Dag Seljebotn, et al.',
packages=[
'Cython',
'Cython.Compiler',
+ 'Cython.Runtime',
'Cython.Distutils',
'Cython.Mac',
'Cython.Unix',
'Cython.Tests',
'Cython.Compiler.Tests',
],
-
+
# pyximport
py_modules = ["pyximport/__init__",
"pyximport/pyximport",
- "pyximport/pyxbuild",
-
+ "pyximport/pyxbuild",
+
"cython"],
-
+
**setup_args
)