summaryrefslogtreecommitdiff
path: root/ext/pybind11/setup.py
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pybind11/setup.py')
-rw-r--r--ext/pybind11/setup.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/ext/pybind11/setup.py b/ext/pybind11/setup.py
index 0cf4e47ce..b76120573 100644
--- a/ext/pybind11/setup.py
+++ b/ext/pybind11/setup.py
@@ -3,6 +3,7 @@
# Setup script for PyPI; use CMakeFile.txt to build extension modules
from setuptools import setup
+from distutils.command.install_headers import install_headers
from pybind11 import __version__
import os
@@ -12,16 +13,23 @@ if os.environ.get('PYBIND11_USE_CMAKE'):
headers = []
else:
headers = [
+ 'include/pybind11/detail/class.h',
+ 'include/pybind11/detail/common.h',
+ 'include/pybind11/detail/descr.h',
+ 'include/pybind11/detail/init.h',
+ 'include/pybind11/detail/internals.h',
+ 'include/pybind11/detail/typeid.h',
'include/pybind11/attr.h',
+ 'include/pybind11/buffer_info.h',
'include/pybind11/cast.h',
'include/pybind11/chrono.h',
- 'include/pybind11/class_support.h',
'include/pybind11/common.h',
'include/pybind11/complex.h',
- 'include/pybind11/descr.h',
'include/pybind11/eigen.h',
+ 'include/pybind11/embed.h',
'include/pybind11/eval.h',
'include/pybind11/functional.h',
+ 'include/pybind11/iostream.h',
'include/pybind11/numpy.h',
'include/pybind11/operators.h',
'include/pybind11/options.h',
@@ -29,9 +37,24 @@ else:
'include/pybind11/pytypes.h',
'include/pybind11/stl.h',
'include/pybind11/stl_bind.h',
- 'include/pybind11/typeid.h'
]
+
+class InstallHeaders(install_headers):
+ """Use custom header installer because the default one flattens subdirectories"""
+ def run(self):
+ if not self.distribution.headers:
+ return
+
+ for header in self.distribution.headers:
+ subdir = os.path.dirname(os.path.relpath(header, 'include/pybind11'))
+ install_dir = os.path.join(self.install_dir, subdir)
+ self.mkpath(install_dir)
+
+ (out, _) = self.copy_file(header, install_dir)
+ self.outfiles.append(out)
+
+
setup(
name='pybind11',
version=__version__,
@@ -43,6 +66,7 @@ setup(
packages=['pybind11'],
license='BSD',
headers=headers,
+ cmdclass=dict(install_headers=InstallHeaders),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',