Repository: spack/spack

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


Discussion:
Probably @trws or @eugeneswalker or @becker33 could help with this issue.
Yeah, that one's on me, odd that it didn't come up in testing but should hopefully be a straightforward fix.

Resolving patch:
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 install(self, spec, prefix):
 
     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),
         )


Test patch: