diff options
Diffstat (limited to 'morphlib/util.py')
-rw-r--r-- | morphlib/util.py | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/morphlib/util.py b/morphlib/util.py index e1bb1ebe..7b610001 100644 --- a/morphlib/util.py +++ b/morphlib/util.py @@ -18,10 +18,8 @@ import os import pipes import re import subprocess -import sys import textwrap -import cliapp import fs.osfs import morphlib @@ -121,8 +119,7 @@ def get_git_resolve_cache_server(settings): # pragma: no cover return None -def new_artifact_caches(settings, status_cb=None, runcmd=cliapp.runcmd, - verbose=False): # pragma: no cover +def new_artifact_caches(settings, status_cb=None): # pragma: no cover '''Create new objects for local and remote artifact caches. This includes creating the directories on disk, if missing. @@ -138,7 +135,7 @@ def new_artifact_caches(settings, status_cb=None, runcmd=cliapp.runcmd, # fs.osfs.OSFS(artifact_cachedir)) lac = morphlib.ostreeartifactcache.OSTreeArtifactCache( - artifact_cachedir, status_cb=status_cb, runcmd=runcmd, verbose=verbose) + artifact_cachedir, status_cb=status_cb) rac_url = get_artifact_cache_server(settings) rac = None @@ -682,25 +679,3 @@ def write_from_dict(filepath, d, validate=lambda x, y: True): #pragma: no cover os.fchown(f.fileno(), 0, 0) os.fchmod(f.fileno(), 0644) - - -def fetch_url(url, target_path, runcmd=cliapp.runcmd, - progress_on_stdout=False): # pragma: no cover - '''Fetch a remote HTTP URL to the local machine. - - Unlike shutil.copyfileobj(), this method makes it easy to show progress - info to the user, which is important when downloading large files like - build artifacts. - - ''' - if progress_on_stdout: - verbosity_flags = [] - kwargs = dict(stderr=sys.stdout) - else: - verbosity_flags = ['--quiet'] - kwargs = dict() - - def wget_command(): - return ['wget'] + verbosity_flags + ['-O', target_path, url] - - runcmd(wget_command(), **kwargs) |