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