We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
spack load fails when package depends on ninja and meson
### Steps to reproduce

When I load a package that depends on ninja, I get an error:
spack load meson
==> Error: module 'spack.pkg.builtin.meson' has no attribute 'make_jobs'
This happens since PR
https://github.com/spack/spack/pull/31739
Of course I did recompile everything.
When I remove setup_dependent_package in ninja package it is OK again.


### Error message

Traceback (most recent call last):
  File "/home/cessenat/spack/bin/spack", line 100, in <module>
    sys.exit(spack.main.main())
  File "/home/cessenat/spack/lib/spack/spack/main.py", line 961, in main
    return _main(argv)
  File "/home/cessenat/spack/lib/spack/spack/main.py", line 916, in _main
    return finish_parse_and_run(parser, cmd_name, env_format_error)
  File "/home/cessenat/spack/lib/spack/spack/main.py", line 944, in finish_parse_and_run
    return _invoke_command(command, parser, args, unknown)
  File "/home/cessenat/spack/lib/spack/spack/main.py", line 608, in _invoke_command
    return_val = command(parser, args)
  File "/home/cessenat/spack/lib/spack/spack/cmd/load.py", line 115, in load
    env_mod.extend(uenv.environment_modifications_for_spec(spec))
  File "/home/cessenat/spack/lib/spack/spack/user_environment.py", line 92, in environment_modifications_for_spec
    spec, context="run", set_package_py_globals=set_package_py_globals
  File "/home/cessenat/spack/lib/spack/spack/build_environment.py", line 1009, in modifications_from_dependencies
    add_modifications_for_dep(dspec)
  File "/home/cessenat/spack/lib/spack/spack/build_environment.py", line 990, in add_modifications_for_dep
    dpkg.setup_dependent_package(spec.package.module, spec)
  File "/home/cessenat/spack/var/spack/repos/builtin/packages/ninja/package.py", line 79, in setup_dependent_package
    )
AttributeError: module 'spack.pkg.builtin.meson' has no attribute 'make_jobs'


### Information on your system

* **Spack:** 0.19.0.dev0
* **Python:** 3.6.8
* **Platform:** linux-centos7-skylake
* **Concretizer:** clingo
[

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have searched the issues of this repo and believe this is not a duplicate
- [X] I have run the failing commands in debug mode and reported the output

--- 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/ninja/package.py`
Content:
```
1 # Copyright 2013-2022 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 import sys
6 
7 from spack.build_environment import MakeExecutable
8 from spack.package import *
9 from spack.util.executable import which_string
10 
11 
12 class Ninja(Package):
13     """Ninja is a small build system with a focus on speed. It differs from
14     other build systems in two major respects: it is designed to have its input
15     files generated by a higher-level build system, and it is designed to run
16     builds as fast as possible."""
17 
18     homepage = "https://ninja-build.org/"
19     url = "https://github.com/ninja-build/ninja/archive/v1.7.2.tar.gz"
20     git = "https://github.com/ninja-build/ninja.git"
21 
22     tags = ["build-tools", "e4s"]
23 
24     executables = ["^ninja$"]
25 
26     version("kitware", branch="features-for-fortran", git="https://github.com/Kitware/ninja.git")
27     version("master", branch="master")
28     version("1.11.0", sha256="3c6ba2e66400fe3f1ae83deb4b235faf3137ec20bd5b08c29bfc368db143e4c6")
29     version("1.10.2", sha256="ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed")
30     version("1.10.1", sha256="a6b6f7ac360d4aabd54e299cc1d8fa7b234cd81b9401693da21221c62569a23e")
31     version("1.10.0", sha256="3810318b08489435f8efc19c05525e80a993af5a55baa0dfeae0465a9d45f99f")
32     version("1.9.0", sha256="5d7ec75828f8d3fd1a0c2f31b5b0cea780cdfe1031359228c428c1a48bfcd5b9")
33     version("1.8.2", sha256="86b8700c3d0880c2b44c2ff67ce42774aaf8c28cbf57725cb881569288c1c6f4")
34     version("1.7.2", sha256="2edda0a5421ace3cf428309211270772dd35a91af60c96f93f90df6bc41b16d9")
35     version("1.6.0", sha256="b43e88fb068fe4d92a3dfd9eb4d19755dae5c33415db2e9b7b61b4659009cde7")
36 
37     depends_on("python", type="build")
38 
39     phases = ["configure", "install"]
40 
41     @classmethod
42     def determine_version(cls, exe):
43         output = Executable(exe)("--version", output=str, error=str)
44         return output.strip()
45 
46     def configure(self, spec, prefix):
47         python("configure.py", "--bootstrap")
48 
49     @run_after("configure")
50     @on_package_attributes(run_tests=True)
51     def configure_test(self):
52         ninja = Executable("./ninja")
53         ninja("-j{0}".format(make_jobs), "ninja_test")
54         ninja_test = Executable("./ninja_test")
55         ninja_test()
56 
57     def setup_run_environment(self, env):
58         env.prepend_path("PYTHONPATH", self.prefix.misc)
59 
60     def install(self, spec, prefix):
61         mkdir(prefix.bin)
62         name = "ninja"
63         if sys.platform == "win32":
64             name = name + ".exe"
65         install(name, prefix.bin)
66         install_tree("misc", prefix.misc)
67 
68         if sys.platform == "win32":
69             return
70         # Some distros like Fedora install a 'ninja-build' executable
71         # instead of 'ninja'. Install both for uniformity.
72         with working_dir(prefix.bin):
73             symlink("ninja", "ninja-build")
74 
75     def setup_dependent_package(self, module, dspec):
76         name = "ninja"
77         module.ninja = MakeExecutable(
78             which_string(name, path=[self.spec.prefix.bin], required=True), module.make_jobs
79         )
80
```
--- 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/ninja/package.py b/var/spack/repos/builtin/packages/ninja/package.py
--- a/var/spack/repos/builtin/packages/ninja/package.py
+++ b/var/spack/repos/builtin/packages/ninja/package.py
@@ -4,7 +4,7 @@
 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
 import sys
 
-from spack.build_environment import MakeExecutable
+from spack.build_environment import MakeExecutable, determine_number_of_jobs
 from spack.package import *
 from spack.util.executable import which_string
 
@@ -74,6 +74,8 @@
 
     def setup_dependent_package(self, module, dspec):
         name = "ninja"
+
         module.ninja = MakeExecutable(
-            which_string(name, path=[self.spec.prefix.bin], required=True), module.make_jobs
+            which_string(name, path=[self.spec.prefix.bin], required=True),
+            determine_number_of_jobs(parallel=self.parallel),
         )

{"golden_diff": "diff --git a/var/spack/repos/builtin/packages/ninja/package.py b/var/spack/repos/builtin/packages/ninja/package.py\n--- a/var/spack/repos/builtin/packages/ninja/package.py\n+++ b/var/spack/repos/builtin/packages/ninja/package.py\n@@ -4,7 +4,7 @@\n # SPDX-License-Identifier: (Apache-2.0 OR MIT)\n import sys\n \n-from spack.build_environment import MakeExecutable\n+from spack.build_environment import MakeExecutable, determine_number_of_jobs\n from spack.package import *\n from spack.util.executable import which_string\n \n@@ -74,6 +74,8 @@\n \n     def setup_dependent_package(self, module, dspec):\n         name = \"ninja\"\n+\n         module.ninja = MakeExecutable(\n-            which_string(name, path=[self.spec.prefix.bin], required=True), module.make_jobs\n+            which_string(name, path=[self.spec.prefix.bin], required=True),\n+            determine_number_of_jobs(parallel=self.parallel),\n         )\n", "issue": "spack load fails when package depends on ninja and meson\n### Steps to reproduce\r\n\r\nWhen I load a package that depends on ninja, I get an error:\r\nspack load meson\r\n==> Error: module 'spack.pkg.builtin.meson' has no attribute 'make_jobs'\r\nThis happens since PR\r\nhttps://github.com/spack/spack/pull/31739\r\nOf course I did recompile everything.\r\nWhen I remove setup_dependent_package in ninja package it is OK again.\r\n\r\n\r\n### Error message\r\n\r\nTraceback (most recent call last):\r\n  File \"/home/cessenat/spack/bin/spack\", line 100, in <module>\r\n    sys.exit(spack.main.main())\r\n  File \"/home/cessenat/spack/lib/spack/spack/main.py\", line 961, in main\r\n    return _main(argv)\r\n  File \"/home/cessenat/spack/lib/spack/spack/main.py\", line 916, in _main\r\n    return finish_parse_and_run(parser, cmd_name, env_format_error)\r\n  File \"/home/cessenat/spack/lib/spack/spack/main.py\", line 944, in finish_parse_and_run\r\n    return _invoke_command(command, parser, args, unknown)\r\n  File \"/home/cessenat/spack/lib/spack/spack/main.py\", line 608, in _invoke_command\r\n    return_val = command(parser, args)\r\n  File \"/home/cessenat/spack/lib/spack/spack/cmd/load.py\", line 115, in load\r\n    env_mod.extend(uenv.environment_modifications_for_spec(spec))\r\n  File \"/home/cessenat/spack/lib/spack/spack/user_environment.py\", line 92, in environment_modifications_for_spec\r\n    spec, context=\"run\", set_package_py_globals=set_package_py_globals\r\n  File \"/home/cessenat/spack/lib/spack/spack/build_environment.py\", line 1009, in modifications_from_dependencies\r\n    add_modifications_for_dep(dspec)\r\n  File \"/home/cessenat/spack/lib/spack/spack/build_environment.py\", line 990, in add_modifications_for_dep\r\n    dpkg.setup_dependent_package(spec.package.module, spec)\r\n  File \"/home/cessenat/spack/var/spack/repos/builtin/packages/ninja/package.py\", line 79, in setup_dependent_package\r\n    )\r\nAttributeError: module 'spack.pkg.builtin.meson' has no attribute 'make_jobs'\r\n\r\n\r\n### Information on your system\r\n\r\n* **Spack:** 0.19.0.dev0\r\n* **Python:** 3.6.8\r\n* **Platform:** linux-centos7-skylake\r\n* **Concretizer:** clingo\r\n[\r\n\r\n### General information\r\n\r\n- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform\r\n- [X] I have searched the issues of this repo and believe this is not a duplicate\r\n- [X] I have run the failing commands in debug mode and reported the output\n", "before_files": [{"content": "# Copyright 2013-2022 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)\nimport sys\n\nfrom spack.build_environment import MakeExecutable\nfrom spack.package import *\nfrom spack.util.executable import which_string\n\n\nclass Ninja(Package):\n    \"\"\"Ninja is a small build system with a focus on speed. It differs from\n    other build systems in two major respects: it is designed to have its input\n    files generated by a higher-level build system, and it is designed to run\n    builds as fast as possible.\"\"\"\n\n    homepage = \"https://ninja-build.org/\"\n    url = \"https://github.com/ninja-build/ninja/archive/v1.7.2.tar.gz\"\n    git = \"https://github.com/ninja-build/ninja.git\"\n\n    tags = [\"build-tools\", \"e4s\"]\n\n    executables = [\"^ninja$\"]\n\n    version(\"kitware\", branch=\"features-for-fortran\", git=\"https://github.com/Kitware/ninja.git\")\n    version(\"master\", branch=\"master\")\n    version(\"1.11.0\", sha256=\"3c6ba2e66400fe3f1ae83deb4b235faf3137ec20bd5b08c29bfc368db143e4c6\")\n    version(\"1.10.2\", sha256=\"ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed\")\n    version(\"1.10.1\", sha256=\"a6b6f7ac360d4aabd54e299cc1d8fa7b234cd81b9401693da21221c62569a23e\")\n    version(\"1.10.0\", sha256=\"3810318b08489435f8efc19c05525e80a993af5a55baa0dfeae0465a9d45f99f\")\n    version(\"1.9.0\", sha256=\"5d7ec75828f8d3fd1a0c2f31b5b0cea780cdfe1031359228c428c1a48bfcd5b9\")\n    version(\"1.8.2\", sha256=\"86b8700c3d0880c2b44c2ff67ce42774aaf8c28cbf57725cb881569288c1c6f4\")\n    version(\"1.7.2\", sha256=\"2edda0a5421ace3cf428309211270772dd35a91af60c96f93f90df6bc41b16d9\")\n    version(\"1.6.0\", sha256=\"b43e88fb068fe4d92a3dfd9eb4d19755dae5c33415db2e9b7b61b4659009cde7\")\n\n    depends_on(\"python\", type=\"build\")\n\n    phases = [\"configure\", \"install\"]\n\n    @classmethod\n    def determine_version(cls, exe):\n        output = Executable(exe)(\"--version\", output=str, error=str)\n        return output.strip()\n\n    def configure(self, spec, prefix):\n        python(\"configure.py\", \"--bootstrap\")\n\n    @run_after(\"configure\")\n    @on_package_attributes(run_tests=True)\n    def configure_test(self):\n        ninja = Executable(\"./ninja\")\n        ninja(\"-j{0}\".format(make_jobs), \"ninja_test\")\n        ninja_test = Executable(\"./ninja_test\")\n        ninja_test()\n\n    def setup_run_environment(self, env):\n        env.prepend_path(\"PYTHONPATH\", self.prefix.misc)\n\n    def install(self, spec, prefix):\n        mkdir(prefix.bin)\n        name = \"ninja\"\n        if sys.platform == \"win32\":\n            name = name + \".exe\"\n        install(name, prefix.bin)\n        install_tree(\"misc\", prefix.misc)\n\n        if sys.platform == \"win32\":\n            return\n        # Some distros like Fedora install a 'ninja-build' executable\n        # instead of 'ninja'. Install both for uniformity.\n        with working_dir(prefix.bin):\n            symlink(\"ninja\", \"ninja-build\")\n\n    def setup_dependent_package(self, module, dspec):\n        name = \"ninja\"\n        module.ninja = MakeExecutable(\n            which_string(name, path=[self.spec.prefix.bin], required=True), module.make_jobs\n        )\n", "path": "var/spack/repos/builtin/packages/ninja/package.py"}], "after_files": [{"content": "# Copyright 2013-2022 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)\nimport sys\n\nfrom spack.build_environment import MakeExecutable, determine_number_of_jobs\nfrom spack.package import *\nfrom spack.util.executable import which_string\n\n\nclass Ninja(Package):\n    \"\"\"Ninja is a small build system with a focus on speed. It differs from\n    other build systems in two major respects: it is designed to have its input\n    files generated by a higher-level build system, and it is designed to run\n    builds as fast as possible.\"\"\"\n\n    homepage = \"https://ninja-build.org/\"\n    url = \"https://github.com/ninja-build/ninja/archive/v1.7.2.tar.gz\"\n    git = \"https://github.com/ninja-build/ninja.git\"\n\n    tags = [\"build-tools\", \"e4s\"]\n\n    executables = [\"^ninja$\"]\n\n    version(\"kitware\", branch=\"features-for-fortran\", git=\"https://github.com/Kitware/ninja.git\")\n    version(\"master\", branch=\"master\")\n    version(\"1.11.0\", sha256=\"3c6ba2e66400fe3f1ae83deb4b235faf3137ec20bd5b08c29bfc368db143e4c6\")\n    version(\"1.10.2\", sha256=\"ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed\")\n    version(\"1.10.1\", sha256=\"a6b6f7ac360d4aabd54e299cc1d8fa7b234cd81b9401693da21221c62569a23e\")\n    version(\"1.10.0\", sha256=\"3810318b08489435f8efc19c05525e80a993af5a55baa0dfeae0465a9d45f99f\")\n    version(\"1.9.0\", sha256=\"5d7ec75828f8d3fd1a0c2f31b5b0cea780cdfe1031359228c428c1a48bfcd5b9\")\n    version(\"1.8.2\", sha256=\"86b8700c3d0880c2b44c2ff67ce42774aaf8c28cbf57725cb881569288c1c6f4\")\n    version(\"1.7.2\", sha256=\"2edda0a5421ace3cf428309211270772dd35a91af60c96f93f90df6bc41b16d9\")\n    version(\"1.6.0\", sha256=\"b43e88fb068fe4d92a3dfd9eb4d19755dae5c33415db2e9b7b61b4659009cde7\")\n\n    depends_on(\"python\", type=\"build\")\n\n    phases = [\"configure\", \"install\"]\n\n    @classmethod\n    def determine_version(cls, exe):\n        output = Executable(exe)(\"--version\", output=str, error=str)\n        return output.strip()\n\n    def configure(self, spec, prefix):\n        python(\"configure.py\", \"--bootstrap\")\n\n    @run_after(\"configure\")\n    @on_package_attributes(run_tests=True)\n    def configure_test(self):\n        ninja = Executable(\"./ninja\")\n        ninja(\"-j{0}\".format(make_jobs), \"ninja_test\")\n        ninja_test = Executable(\"./ninja_test\")\n        ninja_test()\n\n    def setup_run_environment(self, env):\n        env.prepend_path(\"PYTHONPATH\", self.prefix.misc)\n\n    def install(self, spec, prefix):\n        mkdir(prefix.bin)\n        name = \"ninja\"\n        if sys.platform == \"win32\":\n            name = name + \".exe\"\n        install(name, prefix.bin)\n        install_tree(\"misc\", prefix.misc)\n\n        if sys.platform == \"win32\":\n            return\n        # Some distros like Fedora install a 'ninja-build' executable\n        # instead of 'ninja'. Install both for uniformity.\n        with working_dir(prefix.bin):\n            symlink(\"ninja\", \"ninja-build\")\n\n    def setup_dependent_package(self, module, dspec):\n        name = \"ninja\"\n\n        module.ninja = MakeExecutable(\n            which_string(name, path=[self.spec.prefix.bin], required=True),\n            determine_number_of_jobs(parallel=self.parallel),\n        )\n", "path": "var/spack/repos/builtin/packages/ninja/package.py"}]}