forked from smvv/pybison
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
65 lines (60 loc) · 2.01 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
Builds bison python module
"""
from __future__ import absolute_import
from __future__ import print_function
version = '0.1'
from setuptools import setup
from setuptools import Extension
from Cython.Distutils import build_ext
from setuptools import find_packages
import sys
if sys.platform == 'win32':
print('No windows support at this time. PyBison won\'t work for you :(')
libs = []
extra_link_args = []
bison2pyscript = 'utils/bison2py.py'
bisondynlibModule = 'src/c/bisondynlib-win32.c'
elif sys.platform.startswith('linux'):
libs = ['dl']
extra_link_args = []
bison2pyscript = 'utils/bison2py'
bisondynlibModule = 'src/c/bisondynlib-linux.c'
elif sys.platform.startswith('darwin'):
libs = ['dl']
extra_link_args = []
bison2pyscript = 'utils/bison2py'
bisondynlibModule = 'src/c/bisondynlib-linux.c'
from distutils import sysconfig
vars = sysconfig.get_config_vars()
vars['LDSHARED'] = vars['LDSHARED'].replace('-bundle', '-dynamiclib')
else:
print('Sorry, your platform is presently unsupported.')
sys.exit(1)
setup(
name='bison',
version=version,
description='Python bindings for bison/flex parser engine',
author='David McNab <david@freenet.org.nz>',
url='http://www.freenet.org.nz/python/pybison',
ext_modules=[
Extension('bison_', [
'src/pyrex/bison_.pyx',
'src/c/bison_callback.c',
bisondynlibModule],
libraries=libs,
extra_compile_args=['-Wall', '-Wextra'],
# extra_compile_args=['/Od','/Zi','-D__builtin_expect(a,b)=(a)'], extra_link_args=extra_link_args,
)
],
#packages=find_packages(),
packages=['bison'],
package_dir={'': 'src'},
#py_modules=['node', 'xmlifier', 'convert'],
cmdclass={'build_ext': build_ext},
scripts=[bison2pyscript],
install_requires=[
"cython",
"six"
],
)