diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2014-12-15 11:29:38 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2014-12-15 11:36:35 +0100 |
commit | e3ab39bf39d0ba75f6eb504752ef0ffb4bf4a3b1 (patch) | |
tree | a82d339953922d01c5a27dfa00ff811cc2723ab8 /setup.py | |
parent | c1098b321415976df7b6fc77117046b3b515885d (diff) | |
download | pygn-e3ab39bf39d0ba75f6eb504752ef0ffb4bf4a3b1.tar.gz |
I am able to build the extension with setup.py
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 32 |
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) |