Repository: conda/conda-build

Issue:
conda inspect linkages raises TypeError is library comes from multiple packages
Running `conda inspect linkages` fails with a TypeError when evaluating a binary which links against a shared library provided by multiple packages.  For example:

```
$ conda create -n bug openblas libgcc
Fetching package metadata .........
Solving package specifications: .

Package plan for installation in environment /home/jhelmus/anaconda3/envs/bug:

The following NEW packages will be INSTALLED:

    libgcc:      5.2.0-0  defaults
    libgfortran: 3.0.0-1  defaults
    openblas:    0.2.19-0 defaults

Proceed ([y]/n)? ^Cfrom_docker ~/.../cio_conda_recipes/tensorflow-gpu$ cd
~$ conda create -n bug openblas libgcc
Fetching package metadata .........
Solving package specifications: .

Package plan for installation in environment /home/jhelmus/anaconda3/envs/bug:

The following NEW packages will be INSTALLED:

    libgcc:      5.2.0-0  defaults
    libgfortran: 3.0.0-1  defaults
    openblas:    0.2.19-0 defaults

Proceed ([y]/n)? y

#
# To activate this environment, use:
# > source activate bug
#
# To deactivate this environment, use:
# > source deactivate bug
#

~$ conda inspect linkages -n bug openblas
Traceback (most recent call last):
  File "/home/jhelmus/anaconda3/bin/conda-inspect", line 11, in <module>
    load_entry_point('conda-build', 'console_scripts', 'conda-inspect')()
  File "/home/jhelmus/devel/conda-build/conda_build/cli/main_inspect.py", line 204, in main
    return execute(sys.argv[1:])
  File "/home/jhelmus/devel/conda-build/conda_build/cli/main_inspect.py", line 191, in execute
    show_files=args.show_files, groupby=args.groupby))
  File "/home/jhelmus/devel/conda-build/conda_build/api.py", line 329, in inspect_linkages
    show_files=show_files, groupby=groupby)
  File "/home/jhelmus/devel/conda-build/conda_build/inspect.py", line 234, in inspect_linkages
    "packages: %s", path, comma_join(deps))
  File "/home/jhelmus/devel/conda-build/conda_build/utils.py", line 431, in comma_join
    return ' and '.join(items) if len(items) <= 2 else ', '.join(items[:-1]) + ', and ' + items[-1]
TypeError: sequence item 0: expected str instance, Dist found
~$ 
```

Although this error should not occur if packages are properly created, the logic to report this issue is faulty.  

I will submit a fix shortly.



Discussion:

Resolving patch:
diff --git a/conda_build/inspect.py b/conda_build/inspect.py
--- a/conda_build/inspect.py
+++ b/conda_build/inspect.py
@@ -230,8 +230,9 @@ def inspect_linkages(packages, prefix=sys.prefix, untracked=False,
                 if path.startswith(prefix):
                     deps = list(which_package(path))
                     if len(deps) > 1:
+                        deps_str = [str(dep) for dep in deps]
                         get_logger(__name__).warn("Warning: %s comes from multiple "
-                                                  "packages: %s", path, comma_join(deps))
+                                                  "packages: %s", path, comma_join(deps_str))
                     if not deps:
                         if exists(path):
                             depmap['untracked'].append((lib, path.split(prefix +


Test patch: