4
4
5
5
from setuptools import setup
6
6
from distutils .command .install_headers import install_headers
7
+ from distutils .command .build_py import build_py
7
8
from pybind11 import __version__
8
9
import os
9
10
11
+ package_data = [
12
+ 'include/pybind11/detail/class.h' ,
13
+ 'include/pybind11/detail/common.h' ,
14
+ 'include/pybind11/detail/descr.h' ,
15
+ 'include/pybind11/detail/init.h' ,
16
+ 'include/pybind11/detail/internals.h' ,
17
+ 'include/pybind11/detail/typeid.h' ,
18
+ 'include/pybind11/attr.h' ,
19
+ 'include/pybind11/buffer_info.h' ,
20
+ 'include/pybind11/cast.h' ,
21
+ 'include/pybind11/chrono.h' ,
22
+ 'include/pybind11/common.h' ,
23
+ 'include/pybind11/complex.h' ,
24
+ 'include/pybind11/eigen.h' ,
25
+ 'include/pybind11/embed.h' ,
26
+ 'include/pybind11/eval.h' ,
27
+ 'include/pybind11/functional.h' ,
28
+ 'include/pybind11/iostream.h' ,
29
+ 'include/pybind11/numpy.h' ,
30
+ 'include/pybind11/operators.h' ,
31
+ 'include/pybind11/options.h' ,
32
+ 'include/pybind11/pybind11.h' ,
33
+ 'include/pybind11/pytypes.h' ,
34
+ 'include/pybind11/stl.h' ,
35
+ 'include/pybind11/stl_bind.h' ,
36
+ ]
37
+
10
38
# Prevent installation of pybind11 headers by setting
11
39
# PYBIND11_USE_CMAKE.
12
40
if os .environ .get ('PYBIND11_USE_CMAKE' ):
13
41
headers = []
14
42
else :
15
- headers = [
16
- 'include/pybind11/detail/class.h' ,
17
- 'include/pybind11/detail/common.h' ,
18
- 'include/pybind11/detail/descr.h' ,
19
- 'include/pybind11/detail/init.h' ,
20
- 'include/pybind11/detail/internals.h' ,
21
- 'include/pybind11/detail/typeid.h' ,
22
- 'include/pybind11/attr.h' ,
23
- 'include/pybind11/buffer_info.h' ,
24
- 'include/pybind11/cast.h' ,
25
- 'include/pybind11/chrono.h' ,
26
- 'include/pybind11/common.h' ,
27
- 'include/pybind11/complex.h' ,
28
- 'include/pybind11/eigen.h' ,
29
- 'include/pybind11/embed.h' ,
30
- 'include/pybind11/eval.h' ,
31
- 'include/pybind11/functional.h' ,
32
- 'include/pybind11/iostream.h' ,
33
- 'include/pybind11/numpy.h' ,
34
- 'include/pybind11/operators.h' ,
35
- 'include/pybind11/options.h' ,
36
- 'include/pybind11/pybind11.h' ,
37
- 'include/pybind11/pytypes.h' ,
38
- 'include/pybind11/stl.h' ,
39
- 'include/pybind11/stl_bind.h' ,
40
- ]
43
+ headers = package_data
41
44
42
45
43
46
class InstallHeaders (install_headers ):
@@ -55,6 +58,16 @@ def run(self):
55
58
self .outfiles .append (out )
56
59
57
60
61
+ # Install the headers inside the package as well
62
+ class BuildPy (build_py ):
63
+ def build_package_data (self ):
64
+ build_py .build_package_data (self )
65
+ for header in package_data :
66
+ target = os .path .join (self .build_lib , 'pybind11' , header )
67
+ self .mkpath (os .path .dirname (target ))
68
+ self .copy_file (header , target , preserve_mode = False )
69
+
70
+
58
71
setup (
59
72
name = 'pybind11' ,
60
73
version = __version__ ,
@@ -66,7 +79,8 @@ def run(self):
66
79
packages = ['pybind11' ],
67
80
license = 'BSD' ,
68
81
headers = headers ,
69
- cmdclass = dict (install_headers = InstallHeaders ),
82
+ zip_safe = False ,
83
+ cmdclass = dict (install_headers = InstallHeaders , build_py = BuildPy ),
70
84
classifiers = [
71
85
'Development Status :: 5 - Production/Stable' ,
72
86
'Intended Audience :: Developers' ,
0 commit comments