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
|
#!/usr/bin/python
from setuptools import setup
from distutils.core import Extension
from distutils.command.build_ext import build_ext
from subprocess import check_call
class Build_WLP_ext(build_ext):
def run(self):
self.make_file('wlp/command.y', 'wlp/y.tab.c', check_call,
([['yacc', '-d', '-o', 'wlp/commands.tab.c', 'wlp/commands.y']]),
'Generating lexer')
self.make_file('wlp/commands.l', 'wlp/lex.yy.c', check_call,
([['lex', '-o', 'wlp/lex.yy.c', 'wlp/commands.l']]),
'Generating parser')
build_ext.run(self)
# see https://github.com/Turbo87/py-xcsoar/blob/master/setup.py
wlp_module = Extension('wlp',
sources=['wlp/wlp.c',
'wlp/structs.c',
'wlp/commands.tab.c',
'wlp/lex.yy.c'])
install_requirements = ['']
setup(name='PackageName',
version='1.0',
description='This is a demo package',
cmdclass={'build_ext': Build_WLP_ext},
ext_modules=[wlp_module],
install_requires=install_requirements)
|