| 1 |
PYTHON setup.py build_ext --inplace |
| 2 |
|
| 3 |
######## setup.py ######## |
| 4 |
|
| 5 |
from Cython.Build import cythonize |
| 6 |
from Cython.Distutils.extension import Extension |
| 7 |
|
| 8 |
ext_modules = [ |
| 9 |
Extension("foo", ["foo.pyx"]), |
| 10 |
] |
| 11 |
|
| 12 |
# Example documented in docs/src/reference/compilation.rst |
| 13 |
from Cython.Build.Dependencies import default_create_extension |
| 14 |
|
| 15 |
def my_create_extension(template, kwds): |
| 16 |
libs = kwds.get('libraries', []) + ["mylib"] |
| 17 |
kwds['libraries'] = libs |
| 18 |
return default_create_extension(template, kwds) |
| 19 |
|
| 20 |
ext_modules = cythonize(ext_modules, create_extension=my_create_extension) |
| 21 |
|
| 22 |
assert ext_modules[0].libraries == ["mylib"] |
| 23 |
|
| 24 |
######## foo.pyx ######## |