-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.py
71 lines (60 loc) · 1.51 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
66
67
68
69
70
71
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""Setup this SWIG library."""
import runpy
from setuptools import Extension, find_packages, setup
from setuptools.command.build_py import build_py
EXAMPLE_EXT = Extension(
name='_example',
sources=[
'src/example/example.c',
'src/example/example.i',
],
)
STD_EXT = Extension(
name='_stl_example',
swig_opts=['-c++'],
sources=[
'src/example/stl_example.cpp',
'src/example/stl_example.i',
],
include_dirs=[
'src/example',
],
extra_compile_args=[ # The g++ (4.8) in Travis needs this
'-std=c++11',
]
)
# Build extensions before python modules,
# or the generated SWIG python files will be missing.
class BuildPy(build_py):
def run(self):
self.run_command('build_ext')
super(build_py, self).run()
INFO = runpy.run_path('src/example/_meta.py')
setup(
name='swig-example-demo',
description='A Python demo for SWIG',
version=INFO['__version__'],
author=INFO['__author__'],
license=INFO['__copyright__'],
author_email=INFO['__email__'],
url=INFO['__url__'],
keywords=['SWIG', 'demo'],
packages=find_packages('src'),
package_dir={'': 'src'},
package_data={'': ['*.pyd']},
ext_modules=[EXAMPLE_EXT, STD_EXT],
cmdclass={
'build_py': BuildPy,
},
python_requires='>=3.4',
setup_requires=[
'pytest-runner',
],
tests_require=[
'pytest',
'pytest-cov',
'pytest-flake8',
],
)