Repository: spack/spack

Issue:
libxml2+python broken. Without +python it installs
libxml2@2.9.4+python:

```
[spackapps@lo-login-02 bin]$ spack install libxml2@2.9.4+python ^pkg-config@0.29.2 ^python@2.7.13+tk ^xz@5.2.3 ^zlib@1.2.11 ^xproto@7.0.29 ^libpthread-stubs@0.3 ^libx11@1.6.3 %gcc@4.8.5 arch=linux-centos7-x86_64
==> python is already installed in /cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/python-2.7.13-i6cs7ws2tfdy7o5neizq3qmjqx4l4xuc
==> xz is already installed in /cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/xz-5.2.3-gla7wvbtt5igzfbgwlazihdhqxz43avb
==> zlib is already installed in /cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/zlib-1.2.11-bq2w5h6vcd64cmfueygcbug4fksi4eb4
==> pkg-config is already installed in /cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/pkg-config-0.29.2-zmu2xavzg7kxq6njevjjwsmgwbo7o3cg
==> Installing libxml2
==> Fetching http://xmlsoft.org/sources/libxml2-2.9.4.tar.gz
######################################################################## 100.0%
==> Staging archive: /cluster/apps/spack/var/spack/stage/libxml2-2.9.4-xhz5rynikdrgh7gf4cgvzkxxhaedq5nx/libxml2-2.9.4.tar.gz
==> Created stage in /cluster/apps/spack/var/spack/stage/libxml2-2.9.4-xhz5rynikdrgh7gf4cgvzkxxhaedq5nx
==> Ran patch() for libxml2
==> Building libxml2 [AutotoolsPackage]
==> Executing phase : 'autoreconf'
==> Executing phase : 'configure'
==> Error: AttributeError: 'Spec' object has no attribute 'home'
/cluster/apps/spack/var/spack/repos/builtin/packages/libxml2/package.py:52, in configure_args:
     48       def configure_args(self):
     49           spec = self.spec
     50           if '+python' in spec:
     51               python_args = [
  >> 52                   '--with-python={0}'.format(spec['python'].home),
     53                   '--with-python-install-dir={0}'.format(site_packages_dir)
     54               ]
     55           else:
     56               python_args = ['--without-python']
     57   
     58           return python_args

See build log for details:
  /scratch/spackapps/spack-stage/spack-stage-Caqaa7/libxml2-2.9.4/spack-build.out
[spackapps@lo-login-02 bin]$
```

libxml2@2.9.4:

```
[spackapps@lo-login-02 bin]$ spack install libxml2@2.9.4 ^pkg-config@0.29.2 ^xz@5.2.3 ^zlib@1.2.11 %$SSTDCOMP arch=$OS_ARCH
==> xz is already installed in /cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/xz-5.2.3-gla7wvbtt5igzfbgwlazihdhqxz43avb
==> zlib is already installed in /cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/zlib-1.2.11-bq2w5h6vcd64cmfueygcbug4fksi4eb4
==> pkg-config is already installed in /cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/pkg-config-0.29.2-zmu2xavzg7kxq6njevjjwsmgwbo7o3cg
==> Installing libxml2
==> Using cached archive: /cluster/apps/spack/var/spack/cache/libxml2/libxml2-2.9.4.tar.gz
==> Staging archive: /cluster/apps/spack/var/spack/stage/libxml2-2.9.4-wdimbtxlcskbvorduy2gdl6akorvijag/libxml2-2.9.4.tar.gz
==> Created stage in /cluster/apps/spack/var/spack/stage/libxml2-2.9.4-wdimbtxlcskbvorduy2gdl6akorvijag
==> Ran patch() for libxml2
==> Building libxml2 [AutotoolsPackage]
==> Executing phase : 'autoreconf'
==> Executing phase : 'configure'
==> Executing phase : 'build'
==> Executing phase : 'install'
==> Successfully installed libxml2
  Fetch: 0.03s.  Build: 19.83s.  Total: 19.85s.
[+] /cluster/spack/apps/linux-centos7-x86_64/gcc-4.8.5/libxml2-2.9.4-wdimbtxlcskbvorduy2gdl6akorvijag
[spackapps@lo-login-02 bin]$
```





Discussion:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -531,6 +531,8 @@ def setup_dependent_package(self, module, dependent_spec):
         module.site_packages_dir = join_path(dependent_spec.prefix,
                                              self.site_packages_dir)
 
+        self.spec.home = self.home
+
         # Make the site packages directory for extensions
         if dependent_spec.package.is_extension:
             mkdirp(module.site_packages_dir)


Test patch: