Repository: spack/spack

Issue:
hpx package.py: self.variants['instrumentation'].values: 'tuple' object has no attribute 'values'
### Steps to reproduce the issue

`hpx`'s package.py has an issue in `spack@develop` (b9cdaa542916bbdc98b2b6c81fe1126af425e031 from `Wed Nov 3 21:07:35 2021 -0400`)

Seeing the same error on:
* Ubuntu 18.04, GCC 7.5.0, x86_64 and ppc64le
* Ubuntu 20.04, GCC 9.3.0, x86_64 and ppc64le

```
$> spack install hpx
...
==> Installing hpx-1.7.1-dwyyd3j34r3yydrz5vftzv25ms7bqnsn
==> Fetching https://mirror.spack.io/_source-cache/archive/00/008a0335def3c551cba31452eda035d7e914e3e4f77eec679eea070ac71bd83b.tar.gz
==> No patches needed for hpx
==> hpx: Executing phase: 'cmake'
==> Error: AttributeError: 'tuple' object has no attribute 'values'

/spack/var/spack/repos/builtin/packages/hpx/package.py:166, in instrumentation_args:
        165    def instrumentation_args(self):
  >>    166        for value in self.variants['instrumentation'].values:
        167            if value == 'none':
        168                continue
        169
```

### Information on your system

* **Spack:** 0.16.3-5229-b9cdaa5429
* **Python:** 3.8.10
* **Platform:** linux-ubuntu20.04-cascadelake
* **Concretizer:** clingo

### Additional information

@teonnik @msimberg @albestro


### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/hpx/package.py b/var/spack/repos/builtin/packages/hpx/package.py
--- a/var/spack/repos/builtin/packages/hpx/package.py
+++ b/var/spack/repos/builtin/packages/hpx/package.py
@@ -163,13 +163,16 @@ class Hpx(CMakePackage, CudaPackage, ROCmPackage):
     patch('git_external.patch', when='@1.3.0 instrumentation=apex')
 
     def instrumentation_args(self):
-        for value in self.variants['instrumentation'].values:
+        args = []
+        for value in self.variants['instrumentation'][0].values:
             if value == 'none':
                 continue
 
             condition = 'instrumentation={0}'.format(value)
-            yield self.define(
-                'HPX_WITH_{0}'.format(value.upper()), condition in self.spec)
+            args.append(self.define(
+                'HPX_WITH_{0}'.format(value.upper()), condition in self.spec
+            ))
+        return args
 
     def cmake_args(self):
         spec, args = self.spec, []
diff --git a/var/spack/repos/builtin/packages/mfem/package.py b/var/spack/repos/builtin/packages/mfem/package.py
--- a/var/spack/repos/builtin/packages/mfem/package.py
+++ b/var/spack/repos/builtin/packages/mfem/package.py
@@ -343,7 +343,7 @@ def is_sys_lib_path(dir):
         if '+cuda' in spec:
             xcompiler = '-Xcompiler='
             xlinker = '-Xlinker='
-        cuda_arch = spec.variants['cuda_arch'].value
+        cuda_arch = None if '~cuda' in spec else spec.variants['cuda_arch'].value
 
         # We need to add rpaths explicitly to allow proper export of link flags
         # from within MFEM.


Test patch: