We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
pybind11: fix get_include()
The `py-pybind11` package has a python module helper of the form:

```python
import pybind11 as py
print(py.get_include())
```

which helps downstream, if they are not using the CMake config package (which probably everyone is using), to query the install location.

`get_include()` currently points to the spec's Python include location instead of the package's include.

Diff for a new unit test:
```diff
diff --git a/var/spack/repos/builtin/packages/py-pybind11/package.py b/var/spack/repos/builtin/packages/py-pybind11/package.py
index cd482ceb3..0a86afb97 100644
--- a/var/spack/repos/builtin/packages/py-pybind11/package.py
+++ b/var/spack/repos/builtin/packages/py-pybind11/package.py
@@ -60,3 +60,17 @@ class PyPybind11(CMakePackage):
         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
+            module = "pybind11"
+            python = Executable(self.spec['python'].command.path)
+            python('-c', 'import {0}'.format(module))
+            inc = python('-c', 'import {0} as py; print(py.get_include())'.format(
+                module), output=str)
+            print("INC:")
+            print(inc)
+            assert inc == self.prefix.include
```

Similar to:
- https://github.com/conda-forge/pybind11-feedstock/pull/32
- https://github.com/pybind/pybind11/pull/1877

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `var/spack/repos/builtin/packages/py-pybind11/package.py`
Content:
```
1 # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
2 # Spack Project Developers. See the top-level COPYRIGHT file for details.
3 #
4 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
5 
6 from spack import *
7 
8 
9 class PyPybind11(CMakePackage):
10     """pybind11 -- Seamless operability between C++11 and Python.
11 
12     pybind11 is a lightweight header-only library that exposes C++ types in
13     Python and vice versa, mainly to create Python bindings of existing C++
14     code. Its goals and syntax are similar to the excellent Boost.Python
15     library by David Abrahams: to minimize boilerplate code in traditional
16     extension modules by inferring type information using compile-time
17     introspection."""
18 
19     homepage = "https://pybind11.readthedocs.io"
20     url      = "https://github.com/pybind/pybind11/archive/v2.1.0.tar.gz"
21     git      = "https://github.com/pybind/pybind11.git"
22 
23     maintainers = ['ax3l']
24 
25     version('master', branch='master')
26     version('2.4.3', sha256='1eed57bc6863190e35637290f97a20c81cfe4d9090ac0a24f3bbf08f265eb71d')
27     version('2.3.0', sha256='0f34838f2c8024a6765168227ba587b3687729ebf03dc912f88ff75c7aa9cfe8')
28     version('2.2.4', sha256='b69e83658513215b8d1443544d0549b7d231b9f201f6fc787a2b2218b408181e')
29     version('2.2.3', sha256='3a3b7b651afab1c5ba557f4c37d785a522b8030dfc765da26adc2ecd1de940ea')
30     version('2.2.2', sha256='b639a2b2cbf1c467849660801c4665ffc1a4d0a9e153ae1996ed6f21c492064e')
31     version('2.2.1', sha256='f8bd1509578b2a1e7407d52e6ee8afe64268909a1bbda620ca407318598927e7')
32     version('2.2.0', sha256='1b0fda17c650c493f5862902e90f426df6751da8c0b58c05983ab009951ed769')
33     version('2.1.1', sha256='f2c6874f1ea5b4ad4ffffe352413f7d2cd1a49f9050940805c2a082348621540')
34     version('2.1.0', sha256='2860f2b8d0c9f65f0698289a161385f59d099b7ead1bf64e8993c486f2b93ee0')
35 
36     depends_on('py-pytest', type='test')
37     depends_on('py-setuptools', type='build')
38 
39     extends('python')
40 
41     # compiler support
42     conflicts('%gcc@:4.7')
43     conflicts('%clang@:3.2')
44     conflicts('%intel@:16')
45 
46     def cmake_args(self):
47         args = []
48         args.append('-DPYTHON_EXECUTABLE:FILEPATH=%s'
49                     % self.spec['python'].command.path)
50         args += [
51             '-DPYBIND11_TEST:BOOL={0}'.format(
52                 'ON' if self.run_tests else 'OFF')
53         ]
54         return args
55 
56     def setup_build_environment(self, env):
57         env.set('PYBIND11_USE_CMAKE', 1)
58 
59     def install(self, spec, prefix):
60         super(PyPybind11, self).install(spec, prefix)
61         setup_py('install', '--single-version-externally-managed', '--root=/',
62                  '--prefix={0}'.format(prefix))
63
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/var/spack/repos/builtin/packages/py-pybind11/package.py b/var/spack/repos/builtin/packages/py-pybind11/package.py
--- a/var/spack/repos/builtin/packages/py-pybind11/package.py
+++ b/var/spack/repos/builtin/packages/py-pybind11/package.py
@@ -56,7 +56,27 @@
     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)

{"golden_diff": "diff --git a/var/spack/repos/builtin/packages/py-pybind11/package.py b/var/spack/repos/builtin/packages/py-pybind11/package.py\n--- a/var/spack/repos/builtin/packages/py-pybind11/package.py\n+++ b/var/spack/repos/builtin/packages/py-pybind11/package.py\n@@ -56,7 +56,27 @@\n     def setup_build_environment(self, env):\n         env.set('PYBIND11_USE_CMAKE', 1)\n \n+    def patch(self):\n+        \"\"\" see https://github.com/spack/spack/issues/13559 \"\"\"\n+        filter_file('import sys',\n+                    'import sys; return \"{0}\"'.format(self.prefix.include),\n+                    'pybind11/__init__.py',\n+                    string=True)\n+\n     def install(self, spec, prefix):\n         super(PyPybind11, self).install(spec, prefix)\n         setup_py('install', '--single-version-externally-managed', '--root=/',\n                  '--prefix={0}'.format(prefix))\n+\n+    @run_after('install')\n+    @on_package_attributes(run_tests=True)\n+    def test(self):\n+        with working_dir('spack-test', create=True):\n+            # test include helper points to right location\n+            python = self.spec['python'].command\n+            inc = python(\n+                '-c',\n+                'import pybind11 as py; ' +\n+                self.spec['python'].package.print_string('py.get_include()'),\n+                output=str)\n+            assert inc.strip() == str(self.prefix.include)\n", "issue": "pybind11: fix get_include()\nThe `py-pybind11` package has a python module helper of the form:\r\n\r\n```python\r\nimport pybind11 as py\r\nprint(py.get_include())\r\n```\r\n\r\nwhich helps downstream, if they are not using the CMake config package (which probably everyone is using), to query the install location.\r\n\r\n`get_include()` currently points to the spec's Python include location instead of the package's include.\r\n\r\nDiff for a new unit test:\r\n```diff\r\ndiff --git a/var/spack/repos/builtin/packages/py-pybind11/package.py b/var/spack/repos/builtin/packages/py-pybind11/package.py\r\nindex cd482ceb3..0a86afb97 100644\r\n--- a/var/spack/repos/builtin/packages/py-pybind11/package.py\r\n+++ b/var/spack/repos/builtin/packages/py-pybind11/package.py\r\n@@ -60,3 +60,17 @@ class PyPybind11(CMakePackage):\r\n         super(PyPybind11, self).install(spec, prefix)\r\n         setup_py('install', '--single-version-externally-managed', '--root=/',\r\n                  '--prefix={0}'.format(prefix))\r\n+\r\n+    @run_after('install')\r\n+    @on_package_attributes(run_tests=True)\r\n+    def test(self):\r\n+        with working_dir('spack-test', create=True):\r\n+            # test include helper points to right location\r\n+            module = \"pybind11\"\r\n+            python = Executable(self.spec['python'].command.path)\r\n+            python('-c', 'import {0}'.format(module))\r\n+            inc = python('-c', 'import {0} as py; print(py.get_include())'.format(\r\n+                module), output=str)\r\n+            print(\"INC:\")\r\n+            print(inc)\r\n+            assert inc == self.prefix.include\r\n```\r\n\r\nSimilar to:\r\n- https://github.com/conda-forge/pybind11-feedstock/pull/32\r\n- https://github.com/pybind/pybind11/pull/1877\n", "before_files": [{"content": "# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other\n# Spack Project Developers. See the top-level COPYRIGHT file for details.\n#\n# SPDX-License-Identifier: (Apache-2.0 OR MIT)\n\nfrom spack import *\n\n\nclass PyPybind11(CMakePackage):\n    \"\"\"pybind11 -- Seamless operability between C++11 and Python.\n\n    pybind11 is a lightweight header-only library that exposes C++ types in\n    Python and vice versa, mainly to create Python bindings of existing C++\n    code. Its goals and syntax are similar to the excellent Boost.Python\n    library by David Abrahams: to minimize boilerplate code in traditional\n    extension modules by inferring type information using compile-time\n    introspection.\"\"\"\n\n    homepage = \"https://pybind11.readthedocs.io\"\n    url      = \"https://github.com/pybind/pybind11/archive/v2.1.0.tar.gz\"\n    git      = \"https://github.com/pybind/pybind11.git\"\n\n    maintainers = ['ax3l']\n\n    version('master', branch='master')\n    version('2.4.3', sha256='1eed57bc6863190e35637290f97a20c81cfe4d9090ac0a24f3bbf08f265eb71d')\n    version('2.3.0', sha256='0f34838f2c8024a6765168227ba587b3687729ebf03dc912f88ff75c7aa9cfe8')\n    version('2.2.4', sha256='b69e83658513215b8d1443544d0549b7d231b9f201f6fc787a2b2218b408181e')\n    version('2.2.3', sha256='3a3b7b651afab1c5ba557f4c37d785a522b8030dfc765da26adc2ecd1de940ea')\n    version('2.2.2', sha256='b639a2b2cbf1c467849660801c4665ffc1a4d0a9e153ae1996ed6f21c492064e')\n    version('2.2.1', sha256='f8bd1509578b2a1e7407d52e6ee8afe64268909a1bbda620ca407318598927e7')\n    version('2.2.0', sha256='1b0fda17c650c493f5862902e90f426df6751da8c0b58c05983ab009951ed769')\n    version('2.1.1', sha256='f2c6874f1ea5b4ad4ffffe352413f7d2cd1a49f9050940805c2a082348621540')\n    version('2.1.0', sha256='2860f2b8d0c9f65f0698289a161385f59d099b7ead1bf64e8993c486f2b93ee0')\n\n    depends_on('py-pytest', type='test')\n    depends_on('py-setuptools', type='build')\n\n    extends('python')\n\n    # compiler support\n    conflicts('%gcc@:4.7')\n    conflicts('%clang@:3.2')\n    conflicts('%intel@:16')\n\n    def cmake_args(self):\n        args = []\n        args.append('-DPYTHON_EXECUTABLE:FILEPATH=%s'\n                    % self.spec['python'].command.path)\n        args += [\n            '-DPYBIND11_TEST:BOOL={0}'.format(\n                'ON' if self.run_tests else 'OFF')\n        ]\n        return args\n\n    def setup_build_environment(self, env):\n        env.set('PYBIND11_USE_CMAKE', 1)\n\n    def install(self, spec, prefix):\n        super(PyPybind11, self).install(spec, prefix)\n        setup_py('install', '--single-version-externally-managed', '--root=/',\n                 '--prefix={0}'.format(prefix))\n", "path": "var/spack/repos/builtin/packages/py-pybind11/package.py"}], "after_files": [{"content": "# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other\n# Spack Project Developers. See the top-level COPYRIGHT file for details.\n#\n# SPDX-License-Identifier: (Apache-2.0 OR MIT)\n\nfrom spack import *\n\n\nclass PyPybind11(CMakePackage):\n    \"\"\"pybind11 -- Seamless operability between C++11 and Python.\n\n    pybind11 is a lightweight header-only library that exposes C++ types in\n    Python and vice versa, mainly to create Python bindings of existing C++\n    code. Its goals and syntax are similar to the excellent Boost.Python\n    library by David Abrahams: to minimize boilerplate code in traditional\n    extension modules by inferring type information using compile-time\n    introspection.\"\"\"\n\n    homepage = \"https://pybind11.readthedocs.io\"\n    url      = \"https://github.com/pybind/pybind11/archive/v2.1.0.tar.gz\"\n    git      = \"https://github.com/pybind/pybind11.git\"\n\n    maintainers = ['ax3l']\n\n    version('master', branch='master')\n    version('2.4.3', sha256='1eed57bc6863190e35637290f97a20c81cfe4d9090ac0a24f3bbf08f265eb71d')\n    version('2.3.0', sha256='0f34838f2c8024a6765168227ba587b3687729ebf03dc912f88ff75c7aa9cfe8')\n    version('2.2.4', sha256='b69e83658513215b8d1443544d0549b7d231b9f201f6fc787a2b2218b408181e')\n    version('2.2.3', sha256='3a3b7b651afab1c5ba557f4c37d785a522b8030dfc765da26adc2ecd1de940ea')\n    version('2.2.2', sha256='b639a2b2cbf1c467849660801c4665ffc1a4d0a9e153ae1996ed6f21c492064e')\n    version('2.2.1', sha256='f8bd1509578b2a1e7407d52e6ee8afe64268909a1bbda620ca407318598927e7')\n    version('2.2.0', sha256='1b0fda17c650c493f5862902e90f426df6751da8c0b58c05983ab009951ed769')\n    version('2.1.1', sha256='f2c6874f1ea5b4ad4ffffe352413f7d2cd1a49f9050940805c2a082348621540')\n    version('2.1.0', sha256='2860f2b8d0c9f65f0698289a161385f59d099b7ead1bf64e8993c486f2b93ee0')\n\n    depends_on('py-pytest', type='test')\n    depends_on('py-setuptools', type='build')\n\n    extends('python')\n\n    # compiler support\n    conflicts('%gcc@:4.7')\n    conflicts('%clang@:3.2')\n    conflicts('%intel@:16')\n\n    def cmake_args(self):\n        args = []\n        args.append('-DPYTHON_EXECUTABLE:FILEPATH=%s'\n                    % self.spec['python'].command.path)\n        args += [\n            '-DPYBIND11_TEST:BOOL={0}'.format(\n                'ON' if self.run_tests else 'OFF')\n        ]\n        return args\n\n    def setup_build_environment(self, env):\n        env.set('PYBIND11_USE_CMAKE', 1)\n\n    def patch(self):\n        \"\"\" see https://github.com/spack/spack/issues/13559 \"\"\"\n        filter_file('import sys',\n                    'import sys; return \"{0}\"'.format(self.prefix.include),\n                    'pybind11/__init__.py',\n                    string=True)\n\n    def install(self, spec, prefix):\n        super(PyPybind11, self).install(spec, prefix)\n        setup_py('install', '--single-version-externally-managed', '--root=/',\n                 '--prefix={0}'.format(prefix))\n\n    @run_after('install')\n    @on_package_attributes(run_tests=True)\n    def test(self):\n        with working_dir('spack-test', create=True):\n            # test include helper points to right location\n            python = self.spec['python'].command\n            inc = python(\n                '-c',\n                'import pybind11 as py; ' +\n                self.spec['python'].package.print_string('py.get_include()'),\n                output=str)\n            assert inc.strip() == str(self.prefix.include)\n", "path": "var/spack/repos/builtin/packages/py-pybind11/package.py"}]}