1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-19 04:21:17 +00:00

resource getters: weaken File to also resove to directories

Because UNIX tells us that "everything is a file".
This commit is contained in:
Sergei Trofimov 2016-07-15 14:57:19 +01:00
parent f68cf4e317
commit ece33c1d68

View File

@ -235,8 +235,8 @@ class DependencyFileGetter(ResourceGetter):
remote_path = os.path.join(self.mount_point, self.relative_path, resource.path)
local_path = os.path.join(resource.owner.dependencies_directory, os.path.basename(resource.path))
if not os.path.isfile(local_path) or force:
if not os.path.isfile(remote_path):
if not os.path.exists(local_path) or force:
if not os.path.exists(remote_path):
return None
self.logger.debug('Copying {} to {}'.format(remote_path, local_path))
shutil.copy(remote_path, local_path)
@ -384,7 +384,7 @@ class HttpGetter(ResourceGetter):
url = urljoin(self.url, owner_name, asset['path'])
local_path = _f(os.path.join(settings.dependencies_directory, '__remote',
owner_name, asset['path'].replace('/', os.sep)))
if os.path.isfile(local_path) and not self.always_fetch:
if os.path.exists(local_path) and not self.always_fetch:
local_sha = sha256(local_path)
if local_sha == asset['sha256']:
self.logger.debug('Local SHA256 matches; not re-downloading')