setup.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. from setuptools import setup
  2. have_cython = False
  3. try:
  4. from Cython.Distutils import build_ext, Extension
  5. have_cython = True
  6. except ImportError:
  7. from setuptools.command.build_ext import build_ext
  8. from setuptools.extension import Extension
  9. if have_cython:
  10. packer = Extension(
  11. "erlpack._packer",
  12. cython_cplus=True,
  13. extra_compile_args=['-O3'],
  14. sources=["py/erlpack/_packer.pyx"]
  15. )
  16. unpacker = Extension(
  17. "erlpack._unpacker",
  18. cython_cplus=True,
  19. extra_compile_args=['-O3'],
  20. sources=["py/erlpack/_unpacker.pyx"]
  21. )
  22. else:
  23. packer = Extension('erlpack._packer', sources=[
  24. 'py/erlpack/_packer.cpp'], extra_compile_args=['-O3'])
  25. unpacker = Extension('erlpack._unpacker', sources=[
  26. 'py/erlpack/_unpacker.cpp'], extra_compile_args=['-O3'])
  27. ext_modules = [packer, unpacker]
  28. setup(
  29. name='erlpack',
  30. version='0.3.2',
  31. author='Jake Heinz',
  32. author_email='jh@discordapp.com',
  33. url="http://github.com/discordapp/erlpack",
  34. description='A high performance erlang term encoder for Python.',
  35. license='Apache 2.0',
  36. cmdclass={'build_ext': build_ext},
  37. zip_safe=False,
  38. package_dir={'': 'py'},
  39. packages=['erlpack'],
  40. ext_modules=ext_modules,
  41. setup_requires=['pytest-runner'],
  42. tests_require=['pytest'],
  43. )