blob: 6dce89cec8b0335653dd4a4cc1a1780605af2296 [file] [log] [blame]
Eli Bendersky8dbd1492013-08-03 06:07:08 -07001import os, sys
Florian Rathgeberaa47db42013-08-09 19:39:13 +02002try:
3 from setuptools import setup
4 from setuptools.command.install import install as _install
5 from setuptools.command.sdist import sdist as _sdist
6except 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
12def _run_build_tables(dir):
Stefano Riveraaedb4ed2018-05-02 11:20:31 -070013 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 Rathgeberaa47db42013-08-09 19:39:13 +020019
20
21class 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
28class 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 Bendersky8dbd1492013-08-03 06:07:08 -070033
34
35setup(
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 Benderskydd0cf112020-03-04 06:07:58 -080046 version='2.20',
Eli Bendersky8dbd1492013-08-03 06:07:08 -070047 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 Dufresne902500d2018-04-11 06:45:30 -070053 'Development Status :: 5 - Production/Stable',
54 'License :: OSI Approved :: BSD License',
Eli Bendersky8dbd1492013-08-03 06:07:08 -070055 'Programming Language :: Python :: 2',
Hugo988a6af2017-10-10 15:24:32 +030056 'Programming Language :: Python :: 2.7',
57 'Programming Language :: Python :: 3',
Hugo988a6af2017-10-10 15:24:32 +030058 'Programming Language :: Python :: 3.4',
59 'Programming Language :: Python :: 3.5',
60 'Programming Language :: Python :: 3.6',
61 ],
Jon Dufresnea301cbb2018-06-28 06:12:24 -070062 python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
Eli Bendersky8dbd1492013-08-03 06:07:08 -070063 packages=['pycparser', 'pycparser.ply'],
64 package_data={'pycparser': ['*.cfg']},
Florian Rathgeberaa47db42013-08-09 19:39:13 +020065 cmdclass={'install': install, 'sdist': sdist},
Eli Bendersky8dbd1492013-08-03 06:07:08 -070066)