From d7d2523a24e80a323429308bdb73f117f8f8b6c8 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 1 Mar 2018 16:30:14 -0800 Subject: utils: Reenable UHD_IMAGES_DIR env var for uhd_images_downloader This was forgotten in the transition to the new downloader. The command line options --install-location will still override the env variable if it exists. --- host/utils/uhd_images_downloader.py.in | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'host/utils') diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in index 73a29bad5..607e933ec 100644 --- a/host/utils/uhd_images_downloader.py.in +++ b/host/utils/uhd_images_downloader.py.in @@ -57,7 +57,8 @@ def parse_args(): parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('-t', '--types', type=str, default="", help="RegEx to select image sets from the manifest file.") - parser.add_argument('-i', '--install-location', type=str, default=_DEFAULT_INSTALL_PATH, + parser.add_argument('-i', '--install-location', + default=None, help="Set custom install location for images") parser.add_argument('-m', '--manifest-location', type=str, default="", help="Set custom location for the manifest file") @@ -272,7 +273,14 @@ def main(): global _LOG_LEVEL log("TRACE", "Default log level: {}".format(_LOG_LEVEL)) _LOG_LEVEL = _LOG_LEVEL - args.verbose + args.quiet - images_dir = args.install_location + images_dir = _DEFAULT_INSTALL_PATH + if args.install_location: + images_dir = args.install_location + elif os.environ.get("UHD_IMAGES_DIR") != None and os.environ.get("UHD_IMAGES_DIR") != "": + images_dir = os.environ.get("UHD_IMAGES_DIR") + log("DEBUG", + "UHD_IMAGES_DIR environment variable is set, using to set " + "install location.") log("INFO", "Images destination: {}".format(os.path.abspath(images_dir))) try: # If we're given a path to a manifest file, use it @@ -308,7 +316,7 @@ def main(): if os.path.isfile(args.inventory_location): inventory_fn = args.inventory_location else: - inventory_fn = os.path.join(args.install_location, _INVENTORY_FILENAME) + inventory_fn = os.path.join(images_dir, _INVENTORY_FILENAME) inventory = parse_inventory(inventory_fn=inventory_fn) log("TRACE", "Inventory: {}\n{}".format( os.path.abspath(inventory_fn), -- cgit v1.2.3