Skip to content

Commit

Permalink
Print the fetching repodata dot after the repodata is fetched
Browse files Browse the repository at this point in the history
Previously it was printed when the connection was initialized, which isn't
very helpful when ten connections are initialized at once.
  • Loading branch information
asmeurer committed Oct 10, 2014
1 parent c862fed commit b5664f8
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions conda/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import sys
import getpass
import warnings
from functools import wraps

from conda import config
from conda.utils import memoized
Expand Down Expand Up @@ -52,10 +53,21 @@ def add_http_value_to_dict(u, http_key, d, dict_key):
if value:
d[dict_key] = value

# We need a decorator so that the dot gets printed *after* the repodata is fetched
class dotlog_on_return(object):
def __init__(self, msg):
self.msg = msg

def fetch_repodata(url, cache_dir=None, use_cache=False, session=None):
dotlog.debug("fetching repodata: %s ..." % url)
def __call__(self, f):
@wraps(f)
def func(*args, **kwargs):
res = f(*args, **kwargs)
dotlog.debug("%s args %s kwargs %s" % (self.msg, args, kwargs))
return res
return func

@dotlog_on_return("fetching repodata:")
def fetch_repodata(url, cache_dir=None, use_cache=False, session=None):
if not config.ssl_verify:
try:
from requests.packages.urllib3.connectionpool import InsecureRequestWarning
Expand Down

0 comments on commit b5664f8

Please sign in to comment.