Repository: spack/spack

Issue:
glib build (configure) error KeyError: No spec with name python
Trying to install r v3.3.2 and found a stumbling block

### Expected Result
```
==> Installing glib
==> Fetching file://MIRROR_DIR/glib/glib-2.53.1.tar.xz
==> Staging archive: WORKING_DIR/var/spack/stage/glib-2.53.1-icuxtkz3awdm4w3opiwzpgijwtxgz3r2/glib-2.53.1.tar.xz
==> Created stage in WORKING_DIR/var/spack/stage/glib-2.53.1-icuxtkz3awdm4w3opiwzpgijwtxgz3r2
==> Applied patch no-Werror=format-security.patch
==> Building glib [AutotoolsPackage]
==> Executing phase: 'autoreconf'
==> Executing phase: 'configure'
==> Executing phase: 'build'
==> Executing phase: 'install'
==> Successfully installed glib
  Fetch: 0.05s.  Build: 40.65s.  Total: 40.70s.
[+] WORKING_DIR/opt/spack/linux-centos7-x86_64/gcc-5.4.0/glib-2.53.1-icuxtkz3awdm4w3opiwzpgijwtxgz3r2
```
### Actual Result
```
==> Installing glib
==> Fetching file://MIRROR_DIR/glib/glib-2.53.1.tar.xz
==> Staging archive: WORKING_DIR/var/spack/stage/glib-2.53.1-5kpp7xlktyf2xswe3cvjwkyj4vbsvw7c/glib-2.53.1.tar.xz
==> Created stage in WORKING_DIR/var/spack/stage/glib-2.53.1-5kpp7xlktyf2xswe3cvjwkyj4vbsvw7c
==> Applied patch no-Werror=format-security.patch
==> Building glib [AutotoolsPackage]
==> Executing phase: 'autoreconf'
==> Executing phase: 'configure'
==> Error: KeyError: 'No spec with name python in glib@2.53.1%gcc@5.4.0~libmount patches=c325997b72a205ad1638bb3e3ba0e5b73e3d32ce63b2d0d3282f3e3a2ff4663c tracing= arch=linux-centos7-x86_64 ^bzip2@1.0.6%gcc@5.4.0+shared arch=linux-centos7-x86_64 ^gdbm@1.14.1%gcc@5.4.0 arch=linux-centos7-x86_64 ^gettext@0.19.8.1%gcc@5.4.0+bzip2+curses+git~libunistring+libxml2 patches=9acdb4e73f67c241b5ef32505c9ddf7cf6884ca8ea661692f21dca28483b04b8 +tar+xz arch=linux-centos7-x86_64 ^libffi@3.2.1%gcc@5.4.0 arch=linux-centos7-x86_64 ^libxml2@2.9.4%gcc@5.4.0~python arch=linux-centos7-x86_64 ^ncurses@6.0%gcc@5.4.0 patches=4110a40613b800da2b2888c352b64c75a82809d48341061e4de5861e8b28423f,f84b2708a42777aadcc7f502a261afe10ca5646a51c1ef8b5e60d2070d926b57 ~symlinks~termlib arch=linux-centos7-x86_64 ^pcre@8.41%gcc@5.4.0+jit+utf arch=linux-centos7-x86_64 ^perl@5.24.1%gcc@5.4.0+cpanm+shared arch=linux-centos7-x86_64 ^pkgconf@1.4.0%gcc@5.4.0 arch=linux-centos7-x86_64 ^readline@7.0%gcc@5.4.0 arch=linux-centos7-x86_64 ^tar@1.29%gcc@5.4.0 patches=08921fcbd732050c74ddf1de7d8ad95ffdbc09f8b4342456fa2f6a0dd02a957c,5c314db58d005043bf407abaf25eb9823b9032a22fd12a0b142d4bf548130fa4,d428578be7fb99b831eb61e53b8d88a859afe08b479a21238180899707d79ce4,e34d2470461037933737c0a60fbcc5d5ea905fefb6b414b4a2e88a440fcae23a arch=linux-centos7-x86_64 ^xz@5.2.3%gcc@5.4.0 arch=linux-centos7-x86_64 ^zlib@1.2.11%gcc@5.4.0+optimize+pic+shared arch=linux-centos7-x86_64'
KeyError: KeyError: 'No spec with name python in glib@2.53.1%gcc@5.4.0~libmount patches=c325997b72a205ad1638bb3e3ba0e5b73e3d32ce63b2d0d3282f3e3a2ff4663c tracing= arch=linux-centos7-x86_64 ^bzip2@1.0.6%gcc@5.4.0+shared arch=linux-centos7-x86_64 ^gdbm@1.14.1%gcc@5.4.0 arch=linux-centos7-x86_64 ^gettext@0.19.8.1%gcc@5.4.0+bzip2+curses+git~libunistring+libxml2 patches=9acdb4e73f67c241b5ef32505c9ddf7cf6884ca8ea661692f21dca28483b04b8 +tar+xz arch=linux-centos7-x86_64 ^libffi@3.2.1%gcc@5.4.0 arch=linux-centos7-x86_64 ^libxml2@2.9.4%gcc@5.4.0~python arch=linux-centos7-x86_64 ^ncurses@6.0%gcc@5.4.0 patches=4110a40613b800da2b2888c352b64c75a82809d48341061e4de5861e8b28423f,f84b2708a42777aadcc7f502a261afe10ca5646a51c1ef8b5e
60d2070d926b57 ~symlinks~termlib arch=linux-centos7-x86_64 ^pcre@8.41%gcc@5.4.0+jit+utf arch=linux-centos7-x86_64 ^perl@5.24.1%gcc@5.4.0+cpanm+shared arch=linux-centos7-x86_64 ^pkgconf@1.4.0%gcc@5.4.0 arch=linux-centos7-x86_64 ^readline@7.0%gcc@5.4.0 arch=linux-centos7-x86_64 ^tar@1.29%gcc@5.4.0 patches=08921fcbd732050c74ddf1de7d8ad95ffdbc09f8b4342456fa2f6a0dd02a957c,5c314db58d005043bf407abaf25eb9823b9032a22fd12a0b142d4bf548130fa4,d428578be7fb99b831eb61e53b8d88a859afe08b479a21238180899707d79ce4,e34d2470461037933737c0a60fbcc5d5ea905fefb6b414b4a2e88a440fcae23a arch=linux-centos7-x86_64 ^xz@5.2.3%gcc@5.4.0 arch=linux-centos7-x86_64 ^zlib@1.2.11%gcc@5.4.0+optimize+pic+shared arch=linux-centos7-x86_64'

WORKING_DIR/var/spack/repos/builtin/packages/glib/package.py:85, in configure_args:
     1             args = []
     2             args.extend(self.enable_or_disable('libmount'))
     3             args.append('--with-python={0}'.format(
  >> 4                 os.path.basename(self.spec['python'].command.path))
     5             )
     6             args.extend(self.enable_or_disable('tracing'))
     7             return args

See build log for details:
  WORKING_DIR/var/spack/stage/glib-2.53.1-5kpp7xlktyf2xswe3cvjwkyj4vbsvw7c/glib-2.53.1/spack-build.out
```
### Steps to reproduce the issue
```console
$ spack install r@3.3.2
```
/spack/linux-centos7-x86_64/gcc-5.4.0/


Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/glib/package.py b/var/spack/repos/builtin/packages/glib/package.py
--- a/var/spack/repos/builtin/packages/glib/package.py
+++ b/var/spack/repos/builtin/packages/glib/package.py
@@ -81,9 +81,10 @@ def url_for_version(self, version):
     def configure_args(self):
         args = []
         args.extend(self.enable_or_disable('libmount'))
-        args.append('--with-python={0}'.format(
-            os.path.basename(self.spec['python'].command.path))
-        )
+        if self.spec.satisfies('@2.53.4:'):
+            args.append('--with-python={0}'.format(
+                os.path.basename(self.spec['python'].command.path))
+            )
         args.extend(self.enable_or_disable('tracing'))
         return args
 


Test patch: