mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
binman: Make the tooldir configurable
Add a command-line argument for setting the tooldir, so that the default can be overridden. Add this directory to the toolpath automatically. Create the directory if it does not already exist. Put the default in the argument parser instead of the class, so that it is more obvious. Update a few tests that expect the utility name to be provided without any path (e.g. 'futility'), so they can accept a path, e.g. /path/to/futility Update the documentation and add a few tests. Improve the help for --toolpath while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -51,8 +51,9 @@ class Bintool:
|
||||
# List of bintools to regard as missing
|
||||
missing_list = []
|
||||
|
||||
# Directory to store tools
|
||||
tooldir = os.path.join(os.getenv('HOME'), '.binman-tools')
|
||||
# Directory to store tools. Note that this set up by set_tool_dir() which
|
||||
# must be called before this class is used.
|
||||
tooldir = ''
|
||||
|
||||
def __init__(self, name, desc, version_regex=None, version_args='-V'):
|
||||
self.name = name
|
||||
@@ -113,6 +114,11 @@ class Bintool:
|
||||
obj = cls(name)
|
||||
return obj
|
||||
|
||||
@classmethod
|
||||
def set_tool_dir(cls, pathname):
|
||||
"""Set the path to use to store and find tools"""
|
||||
cls.tooldir = pathname
|
||||
|
||||
def show(self):
|
||||
"""Show a line of information about a bintool"""
|
||||
if self.is_present():
|
||||
@@ -210,6 +216,7 @@ class Bintool:
|
||||
if result is not True:
|
||||
fname, tmpdir = result
|
||||
dest = os.path.join(self.tooldir, self.name)
|
||||
os.makedirs(self.tooldir, exist_ok=True)
|
||||
print(f"- writing to '{dest}'")
|
||||
shutil.move(fname, dest)
|
||||
if tmpdir:
|
||||
|
Reference in New Issue
Block a user