Skip to content

Commit 4193e3f

Browse files
committed
No need to change directories
1 parent bd24155 commit 4193e3f

File tree

2 files changed

+31
-56
lines changed

2 files changed

+31
-56
lines changed

pybind11/__init__.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,7 @@
22

33

44
def get_include(user=False):
5-
from distutils.dist import Distribution
65
import os
7-
import sys
6+
d = os.path.dirname(__file__)
7+
return os.path.join(os.path.dirname(d), "include")
88

9-
# Are we running in a virtual environment?
10-
virtualenv = hasattr(sys, 'real_prefix') or \
11-
sys.prefix != getattr(sys, "base_prefix", sys.prefix)
12-
13-
# Are we running in a conda environment?
14-
conda = os.path.exists(os.path.join(sys.prefix, 'conda-meta'))
15-
16-
if virtualenv:
17-
return os.path.join(sys.prefix, 'include', 'site',
18-
'python' + sys.version[:3])
19-
elif conda:
20-
if os.name == 'nt':
21-
return os.path.join(sys.prefix, 'Library', 'include')
22-
else:
23-
return os.path.join(sys.prefix, 'include')
24-
else:
25-
dist = Distribution({'name': 'pybind11'})
26-
dist.parse_config_files()
27-
28-
dist_cobj = dist.get_command_obj('install', create=True)
29-
30-
# Search for packages in user's home directory?
31-
if user:
32-
dist_cobj.user = user
33-
dist_cobj.prefix = ""
34-
dist_cobj.finalize_options()
35-
36-
return os.path.dirname(dist_cobj.install_headers)

setup.py

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,39 @@
77
from pybind11 import __version__
88
import os
99

10+
package_data = [
11+
'include/pybind11/detail/class.h',
12+
'include/pybind11/detail/common.h',
13+
'include/pybind11/detail/descr.h',
14+
'include/pybind11/detail/init.h',
15+
'include/pybind11/detail/internals.h',
16+
'include/pybind11/detail/typeid.h',
17+
'include/pybind11/attr.h',
18+
'include/pybind11/buffer_info.h',
19+
'include/pybind11/cast.h',
20+
'include/pybind11/chrono.h',
21+
'include/pybind11/common.h',
22+
'include/pybind11/complex.h',
23+
'include/pybind11/eigen.h',
24+
'include/pybind11/embed.h',
25+
'include/pybind11/eval.h',
26+
'include/pybind11/functional.h',
27+
'include/pybind11/iostream.h',
28+
'include/pybind11/numpy.h',
29+
'include/pybind11/operators.h',
30+
'include/pybind11/options.h',
31+
'include/pybind11/pybind11.h',
32+
'include/pybind11/pytypes.h',
33+
'include/pybind11/stl.h',
34+
'include/pybind11/stl_bind.h',
35+
]
36+
1037
# Prevent installation of pybind11 headers by setting
1138
# PYBIND11_USE_CMAKE.
1239
if os.environ.get('PYBIND11_USE_CMAKE'):
1340
headers = []
1441
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-
]
42+
headers = package_data
4143

4244

4345
class InstallHeaders(install_headers):
@@ -66,6 +68,7 @@ def run(self):
6668
packages=['pybind11'],
6769
license='BSD',
6870
headers=headers,
71+
package_data={'pybind11': package_data},
6972
cmdclass=dict(install_headers=InstallHeaders),
7073
classifiers=[
7174
'Development Status :: 5 - Production/Stable',

0 commit comments

Comments
 (0)