diff --git a/conda/config.py b/conda/config.py index dcc6a2cc1b9..228c83f4b2d 100644 --- a/conda/config.py +++ b/conda/config.py @@ -324,7 +324,7 @@ def url_channel(url): return None, '' channel = url.rsplit('/', 2)[0] schannel = canonical_channel_name(channel) - return channel, schannel + return channel + '/', schannel # ----- allowed channels ----- diff --git a/conda/fetch.py b/conda/fetch.py index cf7945f41f4..0d8d1bfa840 100644 --- a/conda/fetch.py +++ b/conda/fetch.py @@ -297,7 +297,9 @@ def fetch_pkg(info, dst_dir=None, session=None): session = session or CondaSession() fn = info['fn'] - url = info['channel'] + fn + url = info.get('url') + if url is None: + url = info['channel'] + fn log.debug("url=%r" % url) if dst_dir is None: dst_dir = dirname(find_new_location(fn[:-8])[0]) diff --git a/conda/misc.py b/conda/misc.py index f6427c84b4c..87e0ae5ad2d 100644 --- a/conda/misc.py +++ b/conda/misc.py @@ -8,11 +8,13 @@ import shutil import sys from collections import defaultdict -from os.path import (abspath, basename, dirname, expanduser, exists, +from os.path import (abspath, dirname, expanduser, exists, isdir, isfile, islink, join, relpath) from conda import config from conda import install +from conda import utils +from conda import fetch from conda.api import get_index from conda.compat import iteritems from conda.instructions import RM_EXTRACTED, EXTRACT, UNLINK, LINK @@ -253,17 +255,22 @@ def clone_env(prefix1, prefix2, verbose=True, quiet=False, index=None): def install_local_packages(prefix, paths, verbose=False): # copy packages to pkgs dir - pkgs_dir = config.pkgs_dirs[0] dists = [] for src_path in paths: assert src_path.endswith('.tar.bz2') - fn = basename(src_path) - dists.append(fn[:-8]) - dst_path = join(pkgs_dir, fn) - if abspath(src_path) == abspath(dst_path): - continue - shutil.copyfile(src_path, dst_path) - + src_path = abspath(src_path) + src_dir, fn = os.path.split(src_path) + dist = fn[:-8] + schannel = None + for dd in config.pkgs_dirs: + if src_dir == abspath(dd): + schannel = install.load_meta(dd, dist) + if not schannel: + url = utils.url_path(src_path) + _, schannel = config.url_channel(url) + info = {'fn': fn, 'url': url, 'schannel': schannel, 'md5': None} + fetch.fetch_pkg(info) + dists.append('%s::%s' % (schannel, dist)) force_extract_and_link(dists, prefix, verbose=verbose)