Repository: conda/conda

Issue:
Condarc `pkgs_dirs` setting does not understand environment variables
Tested with Conda 4.3.11 on ubuntu 16.04 and centos 7

The existing `envs_dirs` setting will interpret environment variables (very useful feature).
This behavior does not seem to have carried over to the new `pkgs_dirs` option and instead, the environment variable is treated as a verbatim directory name.

A possible workaround is to use the `CONDA_PKGS_DIRS` environment variable.

Example `.condarc`:
```
envs_dirs:
  - $CONDA_WORKING_DIR/envs
pkgs_dirs:
  - $CONDA_WORKING_DIR/pkgs
```

Then:
```
$ export CONDA_WORKING_DIR=/home/tim/Anaconda
$ conda info

Current conda install:

               platform : linux-64
          conda version : 4.3.11
       conda is private : False
      conda-env version : 4.3.11
    conda-build version : not installed
         python version : 2.7.13.final.0
       requests version : 2.12.4
       root environment : /home/tim/miniconda2  (writable)
    default environment : /home/tim/miniconda2
       envs directories : /home/tim/Anaconda/envs
                          /home/tim/miniconda2/envs
                          /home/tim/.conda/envs
          package cache : $CONDA_WORKING_DIR/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : /home/tim/.condarc
           offline mode : False
             user-agent : conda/4.3.11 requests/2.12.4 CPython/2.7.13 Linux/4.4.0-59-generic debian/stretch/sid glibc/2.23
                UID:GID : 1000:1000
```


Condarc `pkgs_dirs` setting does not understand environment variables
Tested with Conda 4.3.11 on ubuntu 16.04 and centos 7

The existing `envs_dirs` setting will interpret environment variables (very useful feature).
This behavior does not seem to have carried over to the new `pkgs_dirs` option and instead, the environment variable is treated as a verbatim directory name.

A possible workaround is to use the `CONDA_PKGS_DIRS` environment variable.

Example `.condarc`:
```
envs_dirs:
  - $CONDA_WORKING_DIR/envs
pkgs_dirs:
  - $CONDA_WORKING_DIR/pkgs
```

Then:
```
$ export CONDA_WORKING_DIR=/home/tim/Anaconda
$ conda info

Current conda install:

               platform : linux-64
          conda version : 4.3.11
       conda is private : False
      conda-env version : 4.3.11
    conda-build version : not installed
         python version : 2.7.13.final.0
       requests version : 2.12.4
       root environment : /home/tim/miniconda2  (writable)
    default environment : /home/tim/miniconda2
       envs directories : /home/tim/Anaconda/envs
                          /home/tim/miniconda2/envs
                          /home/tim/.conda/envs
          package cache : $CONDA_WORKING_DIR/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : /home/tim/.condarc
           offline mode : False
             user-agent : conda/4.3.11 requests/2.12.4 CPython/2.7.13 Linux/4.4.0-59-generic debian/stretch/sid glibc/2.23
                UID:GID : 1000:1000
```




Discussion:

Resolving patch:
diff --git a/conda/base/context.py b/conda/base/context.py
--- a/conda/base/context.py
+++ b/conda/base/context.py
@@ -282,7 +282,7 @@ def envs_dirs(self):
     @property
     def pkgs_dirs(self):
         if self._pkgs_dirs:
-            return tuple(IndexedSet(self._pkgs_dirs))
+            return tuple(IndexedSet(expand(p) for p in self._pkgs_dirs))
         else:
             cache_dir_name = 'pkgs32' if context.force_32bit else 'pkgs'
             return tuple(IndexedSet(expand(join(p, cache_dir_name)) for p in (


Test patch: