mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-18 20:11:20 +00:00
getters: fix some issues
- get_by_extension was comparing the expected extension to the entire tuple returned by os.path.splitext(), rather than just the extension part. - UserDirectory getter was looking in the root dependencies directory, rather than the subdirectory for the owner. - Filer getter was not handling non-existing paths properly.
This commit is contained in:
parent
4006e998c2
commit
fed454fc74
@ -52,7 +52,7 @@ def get_by_extension(path, ext):
|
|||||||
|
|
||||||
found = []
|
found = []
|
||||||
for entry in os.listdir(path):
|
for entry in os.listdir(path):
|
||||||
entry_ext = os.path.splitext(entry)
|
entry_ext = os.path.splitext(entry)[1]
|
||||||
if entry_ext == ext:
|
if entry_ext == ext:
|
||||||
found.append(os.path.join(path, entry))
|
found.append(os.path.join(path, entry))
|
||||||
return found
|
return found
|
||||||
@ -112,7 +112,8 @@ class UserDirectory(ResourceGetter):
|
|||||||
|
|
||||||
def get(self, resource):
|
def get(self, resource):
|
||||||
basepath = settings.dependencies_directory
|
basepath = settings.dependencies_directory
|
||||||
return get_from_location(basepath, resource)
|
directory = _d(os.path.join(basepath, resource.owner.name))
|
||||||
|
return get_from_location(directory, resource)
|
||||||
|
|
||||||
|
|
||||||
class Http(ResourceGetter):
|
class Http(ResourceGetter):
|
||||||
@ -318,7 +319,9 @@ class Filer(ResourceGetter):
|
|||||||
result = get_from_location(local_path, resource)
|
result = get_from_location(local_path, resource)
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
if remote_path:
|
if not os.path.exists(local_path):
|
||||||
|
return None
|
||||||
|
if os.path.exists(remote_path):
|
||||||
# Didn't find it cached locally; now check the remoted
|
# Didn't find it cached locally; now check the remoted
|
||||||
result = get_from_location(remote_path, resource)
|
result = get_from_location(remote_path, resource)
|
||||||
if not result:
|
if not result:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user