pybind11: correct get_include path (#13605)
* pybind11: test get_include path Helper for non-CMake downstream projects to find the pybind11 header location. * pybind11: return proper get_include() use our prefix instead of letting pybind11 trying to self-determine it from given conda/virtualenv/global rules. Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
parent
a684efe826
commit
f9dc41f806
@ -56,7 +56,27 @@ def cmake_args(self):
|
|||||||
def setup_build_environment(self, env):
|
def setup_build_environment(self, env):
|
||||||
env.set('PYBIND11_USE_CMAKE', 1)
|
env.set('PYBIND11_USE_CMAKE', 1)
|
||||||
|
|
||||||
|
def patch(self):
|
||||||
|
""" see https://github.com/spack/spack/issues/13559 """
|
||||||
|
filter_file('import sys',
|
||||||
|
'import sys; return "{0}"'.format(self.prefix.include),
|
||||||
|
'pybind11/__init__.py',
|
||||||
|
string=True)
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
super(PyPybind11, self).install(spec, prefix)
|
super(PyPybind11, self).install(spec, prefix)
|
||||||
setup_py('install', '--single-version-externally-managed', '--root=/',
|
setup_py('install', '--single-version-externally-managed', '--root=/',
|
||||||
'--prefix={0}'.format(prefix))
|
'--prefix={0}'.format(prefix))
|
||||||
|
|
||||||
|
@run_after('install')
|
||||||
|
@on_package_attributes(run_tests=True)
|
||||||
|
def test(self):
|
||||||
|
with working_dir('spack-test', create=True):
|
||||||
|
# test include helper points to right location
|
||||||
|
python = self.spec['python'].command
|
||||||
|
inc = python(
|
||||||
|
'-c',
|
||||||
|
'import pybind11 as py; ' +
|
||||||
|
self.spec['python'].package.print_string('py.get_include()'),
|
||||||
|
output=str)
|
||||||
|
assert inc.strip() == str(self.prefix.include)
|
||||||
|
Loading…
Reference in New Issue
Block a user