summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Huebl <axel.huebl@plasma.ninja>2019-11-05 22:15:14 -0800
committerMassimiliano Culpo <massimiliano.culpo@gmail.com>2019-11-06 07:15:13 +0100
commitf9dc41f8061890b1d768eb2365ceede2c7bfc95b (patch)
tree25e816cba0178629d492fb38526a981f3d35f8af
parenta684efe8267981563fe6f9c5fa2ad23c50d87cc6 (diff)
downloadspack-f9dc41f8061890b1d768eb2365ceede2c7bfc95b.tar.gz
spack-f9dc41f8061890b1d768eb2365ceede2c7bfc95b.tar.bz2
spack-f9dc41f8061890b1d768eb2365ceede2c7bfc95b.tar.xz
spack-f9dc41f8061890b1d768eb2365ceede2c7bfc95b.zip
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>
-rw-r--r--var/spack/repos/builtin/packages/py-pybind11/package.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/py-pybind11/package.py b/var/spack/repos/builtin/packages/py-pybind11/package.py
index cd482ceb32..a0bcafca7f 100644
--- a/var/spack/repos/builtin/packages/py-pybind11/package.py
+++ b/var/spack/repos/builtin/packages/py-pybind11/package.py
@@ -56,7 +56,27 @@ class PyPybind11(CMakePackage):
def setup_build_environment(self, env):
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):
super(PyPybind11, self).install(spec, prefix)
setup_py('install', '--single-version-externally-managed', '--root=/',
'--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)