Repository: spack/spack

Issue:
Installation issue: python+tk
Spack is unable to "recursively locate tcl libraries" when analyzing the TCL spec before installing Python. Reproduced on a Centos7 & RHEL 7 system.

### Steps to reproduce the issue

```console
$ spack install python@2.7.15+tk
==> sqlite is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/sqlite-3.23.1-7wu32u4i7ccgwcv2udo6n7jbtcoecite
==> tcl is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/tcl-8.6.8-5nqkfcnctewdheju62zvqbsonnzszr6m
==> util-macros is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/util-macros-1.19.1-msje2yczxov5uvzlc5qk4phqmyeklg65
==> inputproto is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/inputproto-2.3.2-gap7to62273laqrsxu5rma2lx6fer54i
==> kbproto is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/kbproto-1.0.7-xjtsozlcf4ttj457t5nh4dr6dhayjjga
==> libpthread-stubs is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/libpthread-stubs-0.4-ysy56bbriodr76fgm4howfo77lkeojcl
==> xproto is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/xproto-7.0.31-wtblcw4bzn7mxb4qtfybhb6acqkll2a5
==> libxau is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/libxau-1.0.8-33gftuowo4ruozpjt464zlqmzuenn6ze
==> libxdmcp is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/libxdmcp-1.1.2-lsgxmwuzdd2y2dcs4pwdl7f5mv52577n
==> xcb-proto is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/xcb-proto-1.13-26i34vuhamx2yjy7or6z2rqqbvee6rnc
==> libxcb is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/libxcb-1.13-vswr5oiyybgfymo7b4a6vspqaoqznjyl
==> perl is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/perl-5.26.2-ka6syh2hjjqi345yvu6fq5johc7i57ij
==> xextproto is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/xextproto-7.3.0-kookqqj5xffsu7at4pbd75aqgju3tfyi
==> xtrans is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/xtrans-1.3.5-uuohg3zfok4nno6wicrisw3fj2lpgscw
==> libx11 is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/libx11-1.6.5-55psoehtec7dgfqceqmhrj5o3e5epe6h
==> tk is already installed in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/tk-8.6.8-uaspjhewvbjfgqt54bmzqy33rv5i5zij
==> Installing python
==> Using cached archive: spack/var/spack/cache/python/python-2.7.15.tgz
==> Staging archive: spack/var/spack/stage/python-2.7.15-uyxkdxvb3ywqae5maeok4omywaye7cza/Python-2.7.15.tgz
==> Created stage in spack/var/spack/stage/python-2.7.15-uyxkdxvb3ywqae5maeok4omywaye7cza
==> Applied patch ncurses.patch
==> Ran patch() for python
==> Building python [AutotoolsPackage]
==> Executing phase: 'autoreconf'
==> Executing phase: 'configure'
==> Error: RuntimeError: Unable to recursively locate tcl libraries in spack/opt/spack/linux-rhel7-x86_64/gcc-4.8.5/tcl-8.6.8-5nqkfcnctewdheju62zvqbsonnzszr6m

spack/var/spack/repos/builtin/packages/python/package.py:191, in configure_args: 
        188        # dependencies (which we need to get their 'libs') is to get them
        189        # using spec.__getitem__.
        190        ldflags = ' '.join(spec[dep.name].libs.search_flags
  >>    191                           for dep in link_deps)
        192
        193        config_args = ['CPPFLAGS=' + cppflags, 'LDFLAGS=' + ldflags]
        194
```

### Platform and user environment

```commandline
$ lsb_release -d
Description:    CentOS Linux release 7.4.1708 (Core)
```



Discussion:
@tgamblin suggested manually setting a property so an empty library list is returned.

Added the following to tk and tcl to get a successful build.
``` 
    @property
    def libs(self):
        return LibraryList([])
```

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/tcl/package.py b/var/spack/repos/builtin/packages/tcl/package.py
--- a/var/spack/repos/builtin/packages/tcl/package.py
+++ b/var/spack/repos/builtin/packages/tcl/package.py
@@ -93,6 +93,11 @@ def symlink_tclsh(self):
     # ========================================================================
     # Set up environment to make install easy for tcl extensions.
     # ========================================================================
+
+    @property
+    def libs(self):
+        return LibraryList([])
+
     @property
     def command(self):
         """Returns the tclsh command.
diff --git a/var/spack/repos/builtin/packages/tk/package.py b/var/spack/repos/builtin/packages/tk/package.py
--- a/var/spack/repos/builtin/packages/tk/package.py
+++ b/var/spack/repos/builtin/packages/tk/package.py
@@ -47,6 +47,10 @@ class Tk(AutotoolsPackage):
 
     configure_directory = 'unix'
 
+    @property
+    def libs(self):
+        return LibraryList([])
+
     def setup_environment(self, spack_env, run_env):
         # When using Tkinter from within spack provided python+tk, python
         # will not be able to find Tcl/Tk unless TK_LIBRARY is set.


Test patch: