aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..2d4e9ba
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,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)