sb: Fix the downloader file:// URL to copy the file to the local path.

This commit is contained in:
Chris Johns
2015-06-16 20:57:06 +10:00
parent 18cea20a12
commit 5b5d6bff74
2 changed files with 19 additions and 5 deletions

View File

@@ -262,9 +262,9 @@ def _file_parser(source, pathkey, config, opts):
# #
_local_path(source, pathkey, config) _local_path(source, pathkey, config)
# #
# Symlink. # Get the paths sorted.
# #
source['symlink'] = source['local'] source['file'] = source['url'][6:]
parsers = { 'http': _http_parser, parsers = { 'http': _http_parser,
'ftp': _http_parser, 'ftp': _http_parser,
@@ -510,9 +510,11 @@ def _cvs_downloader(url, local, config, opts):
return True return True
def _file_downloader(url, local, config, opts): def _file_downloader(url, local, config, opts):
if path.exists(local): try:
path.copy(url[6:], local)
except:
return False
return True return True
return path.isdir(url)
downloaders = { 'http': _http_downloader, downloaders = { 'http': _http_downloader,
'ftp': _http_downloader, 'ftp': _http_downloader,

View File

@@ -167,6 +167,18 @@ def expand(name, paths):
l += [join(p, name)] l += [join(p, name)]
return l return l
def copy(src, dst):
hsrc = host(src)
hdst = host(dst)
try:
shutil.copy(hsrc, hdst)
except OSError, why:
if windows:
if WindowsError is not None and isinstance(why, WindowsError):
pass
else:
raise error.general('copying tree: %s -> %s: %s' % (hsrc, hdst, str(why)))
def copy_tree(src, dst): def copy_tree(src, dst):
trace = False trace = False