Commit cbb906c0 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'enh/local_manifest' into 'master'

Enh/local manifest

See merge request fsl/conda/installer!1
parents 3fa8bb05 eaa746ae
......@@ -34,13 +34,9 @@ import traceback
# TODO check py2/3
try:
import urllib
import urllib.parse as urlparse
import urllib.request as urlrequest
except ImportError:
import urllib2 as urllib
import urllib2 as urlparse
import urllib2 as urlrequest
import urllib as urlrequest
try: import queue
except ImportError: import Queue as queue
......@@ -783,6 +779,10 @@ def download_file(url, destination, progress=None, blocksize=131072):
log.debug('Downloading %s ...', url)
# Path to local file
if op.exists(url):
url = 'file:' + urlrequest.pathname2url(op.abspath(url))
req = None
try:
# py2: urlopen result cannot be
......@@ -1681,6 +1681,10 @@ def parse_args(argv=None):
if not op.exists(args.workdir):
os.mkdir(args.workdir)
# accept local path for manifest
if args.manifest is not None and op.exists(args.manifest):
args.manifest = op.abspath(args.manifest)
return args
......
......@@ -168,6 +168,14 @@ def test_download_file():
with open('copy', 'rt') as f:
assert f.read() == 'hello\n'
# download_file should also work
# with a path to a local file
os.remove('copy')
inst.download_file('file', 'copy')
with open('copy', 'rt') as f:
assert f.read() == 'hello\n'
def test_patch_file():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment