Repository: conda/conda

Issue:
conda v4.1.0rc1 doesn't link conda or activate into created env
The trace below should demonstrate the problem.  As an aside, notice that PS1 is also mixed up: two round brackets and no space after '$' sign.

``` bash
ijstokes@petawawa ~ $ which conda
/Users/ijstokes/anaconda/bin/conda

ijstokes@petawawa ~ $ conda -V
conda 4.1.0rc1

ijstokes@petawawa ~ $ conda create -n testenv bokeh notebook
Using Anaconda Cloud api site https://api.anaconda.org
Fetching package metadata ...........
Solving package specifications ............

Package plan for installation in environment /Users/ijstokes/anaconda/envs/testenv:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    functools32-3.2.3.2        |           py27_0          15 KB
    markupsafe-0.23            |           py27_0          22 KB
    jsonschema-2.5.1           |           py27_0          55 KB
    singledispatch-3.4.0.3     |           py27_0          12 KB
    ipython-4.2.0              |           py27_0         930 KB
    ------------------------------------------------------------
                                           Total:         1.0 MB

The following NEW packages will be INSTALLED:

    appnope:            0.1.0-py27_0  
    backports:          1.0-py27_0    
    backports_abc:      0.4-py27_0    
    bokeh:              0.11.1-py27_0 
    configparser:       3.5.0b2-py27_1
    decorator:          4.0.9-py27_0  
    entrypoints:        0.2-py27_1    
    functools32:        3.2.3.2-py27_0
    futures:            3.0.5-py27_0  
    get_terminal_size:  1.0.0-py27_0  
    ipykernel:          4.3.1-py27_0  
    ipython:            4.2.0-py27_0  
    ipython_genutils:   0.1.0-py27_0  
    jinja2:             2.8-py27_0    
    jsonschema:         2.5.1-py27_0  
    jupyter_client:     4.2.2-py27_0  
    jupyter_core:       4.1.0-py27_0  
    markupsafe:         0.23-py27_0   
    mistune:            0.7.2-py27_1  
    mkl:                11.3.1-0      
    nbconvert:          4.2.0-py27_0  
    nbformat:           4.0.1-py27_0  
    notebook:           4.2.0-py27_0  
    numpy:              1.11.0-py27_0 
    openssl:            1.0.2h-0      
    path.py:            8.2.1-py27_0  
    pexpect:            4.0.1-py27_0  
    pickleshare:        0.5-py27_0    
    pip:                8.1.1-py27_1  
    ptyprocess:         0.5-py27_0    
    pygments:           2.1.3-py27_0  
    python:             2.7.11-0      
    python-dateutil:    2.5.2-py27_0  
    pyyaml:             3.11-py27_1   
    pyzmq:              15.2.0-py27_0 
    readline:           6.2-2         
    requests:           2.9.1-py27_0  
    setuptools:         20.7.0-py27_0 
    simplegeneric:      0.8.1-py27_0  
    singledispatch:     3.4.0.3-py27_0
    six:                1.10.0-py27_0 
    sqlite:             3.9.2-0       
    ssl_match_hostname: 3.4.0.2-py27_1
    terminado:          0.5-py27_1    
    tk:                 8.5.18-0      
    tornado:            4.3-py27_0    
    traitlets:          4.2.1-py27_0  
    wheel:              0.29.0-py27_0 
    yaml:               0.1.6-0       
    zlib:               1.2.8-0       

Proceed ([y]/n)? y

Fetching packages ...
functools32-3. 100% |############################################################################| Time: 0:00:00 245.53 kB/s
markupsafe-0.2 100% |############################################################################| Time: 0:00:00 267.15 kB/s
jsonschema-2.5 100% |############################################################################| Time: 0:00:01  55.12 kB/s
singledispatch 100% |############################################################################| Time: 0:00:00 204.19 kB/s
ipython-4.2.0- 100% |############################################################################| Time: 0:00:02 352.48 kB/s
Extracting packages ...
[      COMPLETE      ]|###############################################################################################| 100%
Linking packages ...
[      COMPLETE      ]|###############################################################################################| 100%
#
# To activate this environment, use:
# $ source activate testenv
#
# To deactivate this environment, use:
# $ source deactivate
#

ijstokes@petawawa ~ $ source activate testenv
prepending /Users/ijstokes/anaconda/envs/testenv/bin to PATH

((testenv)) ijstokes@petawawa ~ $conda info -a
-bash: conda: command not found

((testenv)) ijstokes@petawawa ~ $source activate root
-bash: activate: No such file or directory
```



Discussion:
```
((conda-test)) ls -al $CONDA_ENV_PATH/bin/bin
total 24
drwxr-xr-x   5 kfranz  staff   170B May 13 09:52 ./
drwxr-xr-x  32 kfranz  staff   1.1K May 13 09:52 ../
lrwxr-xr-x   1 kfranz  staff    19B May 13 09:52 activate@ -> /conda/bin/activate
lrwxr-xr-x   1 kfranz  staff    16B May 13 09:52 conda@ -> /conda/bin/conda
lrwxr-xr-x   1 kfranz  staff    21B May 13 09:52 deactivate@ -> /conda/bin/deactivate
```

CC @msarahan FYI.  Will fix this one today too.


Resolving patch:
diff --git a/conda/cli/activate.py b/conda/cli/activate.py
--- a/conda/cli/activate.py
+++ b/conda/cli/activate.py
@@ -147,13 +147,13 @@ def main():
 
         # this should throw an error and exit if the env or path can't be found.
         try:
-            binpath = binpath_from_arg(sys.argv[2], shelldict=shelldict)
+            prefix = prefix_from_arg(sys.argv[2], shelldict=shelldict)
         except ValueError as e:
             sys.exit(getattr(e, 'message', e))
 
         # Make sure an env always has the conda symlink
         try:
-            conda.install.symlink_conda(shelldict['path_from'](binpath[0]), root_dir, shell)
+            conda.install.symlink_conda(prefix, root_dir, shell)
         except (IOError, OSError) as e:
             if e.errno == errno.EPERM or e.errno == errno.EACCES:
                 msg = ("Cannot activate environment {0}, not have write access to conda symlink"


Test patch: