Skip to content

Commit 345f74a

Browse files
committed
config: return passed in tool by default
The tools in the tools key can either be a single string with the binary name or a complete path to a binary. This works for every tool expect for qemu since drivers can provide a fallback to the default tool. However qemu currently requires the user to supply the full binary path, which is unintuitive. Instead return the originally requested tool-name if no specialized path is found. And return the simple unexpanded path if a local tool with the same name can't be found. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> (cherry picked from commit 552a42c) Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
1 parent 78fecbf commit 345f74a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

labgrid/config.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,14 @@ def get_tool(self, tool):
9898
"""
9999
try:
100100
path = str(self.data['tools'][tool])
101-
return self.resolve_path(path)
102101
except KeyError:
103-
return None
102+
return tool
103+
104+
resolved = self.resolve_path(path)
105+
if os.path.exists(resolved):
106+
return resolved
107+
108+
return path
104109

105110
def get_image_path(self, kind):
106111
"""Retrieve an entry from the images subkey

0 commit comments

Comments
 (0)