From 1fdedb12de3d1f11e170f555fde46a56eef71fb0 Mon Sep 17 00:00:00 2001 From: cc <18856836718@163.com> Date: Wed, 24 Apr 2024 11:05:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E7=AD=89=E7=BA=A7=E5=9B=BA=E5=AE=9A=E4=B8=BA=20debug=EF=BC=8C?= =?UTF-8?q?=E5=B9=B6=E5=8F=AF=E4=BB=A5=E4=BD=BF=E7=94=A8silent=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=97=A5=E5=BF=97=E9=99=8D=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../install_dependency/src/deploy/deploy_command_line.py | 8 +++++--- tools/install_dependency/src/deploy_main.py | 2 +- tools/install_dependency/src/log.py | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/install_dependency/src/deploy/deploy_command_line.py b/tools/install_dependency/src/deploy/deploy_command_line.py index f2ebbc5..9e31505 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 2393a78..3069c2a 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/log.py b/tools/install_dependency/src/log.py index 1f1fe3d..64af387 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) -- Gitee From 6519dd696abf387b71d8fb97e6ab616e9b0e132d Mon Sep 17 00:00:00 2001 From: cc <18856836718@163.com> Date: Wed, 24 Apr 2024 12:48:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=97=A0=E7=BD=91?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=97=B6=E4=B8=8D=E6=8A=A5=E9=94=99=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/install_dependency/src/download/download_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/install_dependency/src/download/download_utils.py b/tools/install_dependency/src/download/download_utils.py index 595180d..72f1933 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_}" -- Gitee