Eli Bendersky | 8dbd149 | 2013-08-03 06:07:08 -0700 | [diff] [blame] | 1 | import os, sys |
Florian Rathgeber | aa47db4 | 2013-08-09 19:39:13 +0200 | [diff] [blame] | 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 | |
| 11 | |
| 12 | def _run_build_tables(dir): |
| 13 | from subprocess import call |
| 14 | call([sys.executable, '_build_tables.py'], |
| 15 | cwd=os.path.join(dir, 'pycparser')) |
| 16 | |
| 17 | |
| 18 | class install(_install): |
| 19 | def run(self): |
| 20 | _install.run(self) |
| 21 | self.execute(_run_build_tables, (self.install_lib,), |
| 22 | msg="Build the lexing/parsing tables") |
| 23 | |
| 24 | |
| 25 | class sdist(_sdist): |
| 26 | def make_release_tree(self, basedir, files): |
| 27 | _sdist.make_release_tree(self, basedir, files) |
| 28 | self.execute(_run_build_tables, (basedir,), |
| 29 | msg="Build the lexing/parsing tables") |
Eli Bendersky | 8dbd149 | 2013-08-03 06:07:08 -0700 | [diff] [blame] | 30 | |
| 31 | |
| 32 | setup( |
| 33 | # metadata |
| 34 | name='pycparser', |
| 35 | description='C parser in Python', |
| 36 | long_description=""" |
| 37 | pycparser is a complete parser of the C language, written in |
| 38 | pure Python using the PLY parsing library. |
| 39 | It parses C code into an AST and can serve as a front-end for |
| 40 | C compilers or analysis tools. |
| 41 | """, |
| 42 | license='BSD', |
Eli Bendersky | 6162a21 | 2017-07-04 15:09:22 -0700 | [diff] [blame] | 43 | version='2.18', |
Eli Bendersky | 8dbd149 | 2013-08-03 06:07:08 -0700 | [diff] [blame] | 44 | author='Eli Bendersky', |
| 45 | maintainer='Eli Bendersky', |
| 46 | author_email='eliben@gmail.com', |
| 47 | url='https://github.com/eliben/pycparser', |
| 48 | platforms='Cross Platform', |
| 49 | classifiers = [ |
Jon Dufresne | 902500d | 2018-04-11 06:45:30 -0700 | [diff] [blame^] | 50 | 'Development Status :: 5 - Production/Stable', |
| 51 | 'License :: OSI Approved :: BSD License', |
Eli Bendersky | 8dbd149 | 2013-08-03 06:07:08 -0700 | [diff] [blame] | 52 | 'Programming Language :: Python :: 2', |
Hugo | 988a6af | 2017-10-10 15:24:32 +0300 | [diff] [blame] | 53 | 'Programming Language :: Python :: 2.7', |
| 54 | 'Programming Language :: Python :: 3', |
| 55 | 'Programming Language :: Python :: 3.2', |
| 56 | 'Programming Language :: Python :: 3.3', |
| 57 | 'Programming Language :: Python :: 3.4', |
| 58 | 'Programming Language :: Python :: 3.5', |
| 59 | 'Programming Language :: Python :: 3.6', |
| 60 | ], |
Eli Bendersky | 8dbd149 | 2013-08-03 06:07:08 -0700 | [diff] [blame] | 61 | packages=['pycparser', 'pycparser.ply'], |
| 62 | package_data={'pycparser': ['*.cfg']}, |
Florian Rathgeber | aa47db4 | 2013-08-09 19:39:13 +0200 | [diff] [blame] | 63 | cmdclass={'install': install, 'sdist': sdist}, |
Eli Bendersky | 8dbd149 | 2013-08-03 06:07:08 -0700 | [diff] [blame] | 64 | ) |