Commit f5549cbd authored by Stefan Behnel's avatar Stefan Behnel

fix up demo code

--HG--
extra : transplant_source : %FF%0B%A3%9D%21%85%A9%1A%8B%D1V%AD%CF%DD%3Em%92%DE_%8F
parent 38cb0633
import os import os
import sys
from distutils.core import setup from distutils.core import setup
from distutils.extension import Extension from distutils.extension import Extension
from Cython.Distutils import build_ext from Cython.Build import cythonize
# For demo purposes, we build our own tiny library. # For demo purposes, we build our own tiny library.
...@@ -12,20 +13,19 @@ try: ...@@ -12,20 +13,19 @@ try:
assert os.system("ar rcs libmymath.a mymath.o") == 0 assert os.system("ar rcs libmymath.a mymath.o") == 0
except: except:
if not os.path.exists("libmymath.a"): if not os.path.exists("libmymath.a"):
print "Error building external library, please create libmymath.a manually." print("Error building external library, please create libmymath.a manually.")
sys.exit(1) sys.exit(1)
# Here is how to use the library built above. # Here is how to use the library built above.
ext_modules=[ ext_modules = cythonize([
Extension("call_mymath", Extension("call_mymath",
sources = ["call_mymath.pyx"], sources=["call_mymath.pyx"],
include_dirs = [os.getcwd()], # path to .h file(s) include_dirs=[os.getcwd()], # path to .h file(s)
library_dirs = [os.getcwd()], # path to .a or .so file(s) library_dirs=[os.getcwd()], # path to .a or .so file(s)
libraries = ['mymath']) libraries=['mymath'])
] ])
setup( setup(
name = 'Demos', name='Demos',
cmdclass = {'build_ext': build_ext}, ext_modules=ext_modules,
ext_modules = ext_modules,
) )
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