setup.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import os, sys
  2. try:
  3. from setuptools import setup
  4. from setuptools.command.install import install as _install
  5. from setuptools.command.sdist import sdist as _sdist
  6. except ImportError:
  7. from distutils.core import setup
  8. from distutils.command.install import install as _install
  9. from distutils.command.sdist import sdist as _sdist
  10. def _run_build_tables(dir):
  11. from subprocess import call
  12. call([sys.executable, '_build_tables.py'],
  13. cwd=os.path.join(dir, 'pycparser'))
  14. class install(_install):
  15. def run(self):
  16. _install.run(self)
  17. self.execute(_run_build_tables, (self.install_lib,),
  18. msg="Build the lexing/parsing tables")
  19. class sdist(_sdist):
  20. def make_release_tree(self, basedir, files):
  21. _sdist.make_release_tree(self, basedir, files)
  22. self.execute(_run_build_tables, (basedir,),
  23. msg="Build the lexing/parsing tables")
  24. setup(
  25. # metadata
  26. name='pycparser',
  27. description='C parser in Python',
  28. long_description="""
  29. pycparser is a complete parser of the C language, written in
  30. pure Python using the PLY parsing library.
  31. It parses C code into an AST and can serve as a front-end for
  32. C compilers or analysis tools.
  33. """,
  34. license='BSD',
  35. version='2.18',
  36. author='Eli Bendersky',
  37. maintainer='Eli Bendersky',
  38. author_email='eliben@gmail.com',
  39. url='https://github.com/eliben/pycparser',
  40. platforms='Cross Platform',
  41. classifiers = [
  42. 'Programming Language :: Python :: 2',
  43. 'Programming Language :: Python :: 3',],
  44. packages=['pycparser', 'pycparser.ply'],
  45. package_data={'pycparser': ['*.cfg']},
  46. cmdclass={'install': install, 'sdist': sdist},
  47. )