setup.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env python3
  2. """
  3. Build the Cython demonstrations of low-level access to NumPy random
  4. Usage: python setup.py build_ext -i
  5. """
  6. import numpy as np
  7. from distutils.core import setup
  8. from Cython.Build import cythonize
  9. from setuptools.extension import Extension
  10. from os.path import join, dirname
  11. path = dirname(__file__)
  12. src_dir = join(dirname(path), '..', 'src')
  13. defs = [('NPY_NO_DEPRECATED_API', 0)]
  14. inc_path = np.get_include()
  15. # not so nice. We need the random/lib library from numpy
  16. lib_path = join(np.get_include(), '..', '..', 'random', 'lib')
  17. extending = Extension("extending",
  18. sources=[join('.', 'extending.pyx')],
  19. include_dirs=[
  20. np.get_include(),
  21. join(path, '..', '..')
  22. ],
  23. define_macros=defs,
  24. )
  25. distributions = Extension("extending_distributions",
  26. sources=[join('.', 'extending_distributions.pyx')],
  27. include_dirs=[inc_path],
  28. library_dirs=[lib_path],
  29. libraries=['npyrandom'],
  30. define_macros=defs,
  31. )
  32. extensions = [extending, distributions]
  33. setup(
  34. ext_modules=cythonize(extensions)
  35. )