| 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 |
|
| 11 |
|
| 12 |
def _run_build_tables(dir): |
| 13 |
from subprocess import check_call |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
check_call([sys.executable, '-B', '_build_tables.py'], |
| 18 |
cwd=os.path.join(dir, 'pycparser')) |
| 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") |
| 33 |
|
| 34 |
|
| 35 |
setup( |
| 36 |
|
| 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-3-Clause', |
| 46 |
version='2.23', |
| 47 |
author='Eli Bendersky', |
| 48 |
maintainer='Eli Bendersky', |
| 49 |
author_email='[email protected]', |
| 50 |
url='https://github.com/eliben/pycparser', |
| 51 |
platforms='Cross Platform', |
| 52 |
classifiers = [ |
| 53 |
'Development Status :: 5 - Production/Stable', |
| 54 |
'License :: OSI Approved :: BSD License', |
| 55 |
'Programming Language :: Python :: 3', |
| 56 |
'Programming Language :: Python :: 3.8', |
| 57 |
'Programming Language :: Python :: 3.9', |
| 58 |
'Programming Language :: Python :: 3.10', |
| 59 |
'Programming Language :: Python :: 3.11', |
| 60 |
'Programming Language :: Python :: 3.12', |
| 61 |
'Programming Language :: Python :: 3.13', |
| 62 |
], |
| 63 |
python_requires=">=3.8", |
| 64 |
packages=['pycparser', 'pycparser.ply'], |
| 65 |
package_data={'pycparser': ['*.cfg']}, |
| 66 |
cmdclass={'install': install, 'sdist': sdist}, |
| 67 |
) |