diff --git a/tools/install_dependency/src/deploy/deploy_command_line.py b/tools/install_dependency/src/deploy/deploy_command_line.py index f2ebbc57acc8c7bd0bd496ba0434c1cd6a08fc80..9e3150503faf70e46272c30ea9babb40ed547b83 100644 --- a/tools/install_dependency/src/deploy/deploy_command_line.py +++ b/tools/install_dependency/src/deploy/deploy_command_line.py @@ -6,7 +6,7 @@ DEFAULT_YAML_PATH = "./machine.yaml" class CommandLine: yaml_path = DEFAULT_YAML_PATH iso_path = None - debug = False + silent = False @classmethod def add_options(cls, parser): @@ -14,13 +14,15 @@ class CommandLine: help="Assign yaml config file path. Default path is 'machine.yaml' in current directory.") parser.add_argument("-iso", action="store", dest="iso_path", default=None, help="Assign prepared iso file path.") - parser.add_argument("--debug", action="store_true", dest="debug", default=False, help="Open debug log.") + parser.add_argument("--debug", action="store_true", dest="debug", default=True, + help="Open debug log. Default is True.") + parser.add_argument("--silent", action="store_true", dest="silent", default=False, help="Close debug log.") @classmethod def process_args(cls, args): cls.yaml_path = args.yaml_path if args.yaml_path and args.yaml_path != "./" else DEFAULT_YAML_PATH cls.iso_path = args.iso_path - cls.debug = args.debug + cls.silent = args.silent return cls.yaml_path diff --git a/tools/install_dependency/src/deploy_main.py b/tools/install_dependency/src/deploy_main.py index 2393a78c1023e7149ca7cf838b5aba151417c80f..3069c2a731707684f6a9b93ce71c190c90999ca7 100644 --- a/tools/install_dependency/src/deploy_main.py +++ b/tools/install_dependency/src/deploy_main.py @@ -40,7 +40,7 @@ if __name__ == '__main__': try: process_command_line(program="deploy_tool", description="devkit-pipeline deploy_tool", class_list=[CommandLine]) - config_logging(CommandLine.debug) + config_logging(CommandLine.silent) config_dict = read_yaml_file(CommandLine.yaml_path) if CommandLine.iso_path: diff --git a/tools/install_dependency/src/download/download_utils.py b/tools/install_dependency/src/download/download_utils.py index 595180d83f069a154d7dc014a8504ec5c1051b74..72f1933262764fc896f9ce50be1a30d9a207fdb1 100644 --- a/tools/install_dependency/src/download/download_utils.py +++ b/tools/install_dependency/src/download/download_utils.py @@ -167,7 +167,7 @@ def download_dependence_file(shell_cmd, shell_dict): ) raise OSError(f"download error occurs: {str(e)}") - if not os.path.isfile(save_path): + if not os.path.isfile(save_path) or not str(os.path.getsize(save_path)) == file_size: print(f"[ERROR] Download dependencies failed. " f"Please visit following url and download dependencies to default directory." f"\n\t{url_}" diff --git a/tools/install_dependency/src/log.py b/tools/install_dependency/src/log.py index 1f1fe3dca78e56e6dca38a082f1eb63b3a850e05..64af387fbca6db2ca018b08c64c91469481571b7 100644 --- a/tools/install_dependency/src/log.py +++ b/tools/install_dependency/src/log.py @@ -2,7 +2,7 @@ import logging import sys -def config_logging(debug=False): +def config_logging(silent=False): logger = logging.getLogger("install_dependency") logger.setLevel(logging.DEBUG) @@ -12,7 +12,7 @@ def config_logging(debug=False): " %(message)s") handler = logging.StreamHandler(sys.stdout) - handler.setLevel(logging.DEBUG if debug else logging.INFO) + handler.setLevel(logging.INFO if silent else logging.DEBUG) handler.setFormatter(formatter) logger.addHandler(handler)