Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52FAAC433F5 for ; Tue, 23 Nov 2021 18:05:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C1AF38370D; Tue, 23 Nov 2021 19:04:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="FhiLKrI7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9A476836C9; Tue, 23 Nov 2021 19:04:29 +0100 (CET) Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CD361836AC for ; Tue, 23 Nov 2021 19:04:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oo1-xc2c.google.com with SMTP id x1-20020a4aea01000000b002c296d82604so20936ood.9 for ; Tue, 23 Nov 2021 10:04:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+qQrtmT0Oh4dloSu1kpUNs/bpigTI1ukY2Hwd/fu8wg=; b=FhiLKrI7NYt3mSxvId0yOhIgkRlN0HVRc/7rxLO0panoR1TZb3XWCKjUj7KUTQJ3ak AcwnurDjsCVRE8iQIKMu0LrQnIL2Z7YC2kM5K3iO7S1CMq47Ms8v8+mGqsgigZYBqaG2 1aBXlF3DJT3Jcni6Cwjx/hnwTkTFW6/ihLKko= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+qQrtmT0Oh4dloSu1kpUNs/bpigTI1ukY2Hwd/fu8wg=; b=1t3AROY7/VR/DyGsFCE8KHdu3307VgeUZYpTCsCLjAdJkxV4HL+lSjCqwDk+35Ezte nWPivOYvoVT18cukNtx7fkfhnXFY+a689//xnk3aMJWj5sKfaJw6YUSMNnG9zYH85kwv gZOgmqj5uImzNXGe3xgssf0Fw68Bh8sNoUPrJJ8DzBcxVpAQ4SECDmFnou8kpPQHXFaN /VcF84hSO5yUgpvnwFG1x93dYKYT/NvKy0ZiyNvG/QdDsZQ/Xi4Xr3O32Q7DTjMGHu6U +N1U7Nisy2CiLnjPi+UpXZ4aPOku9mwwwQpKS8trDJQASbkaDS8XQzLCRPhMl+2SB2Kc WL5w== X-Gm-Message-State: AOAM530qdDwDERwUwVoTYfVZxlR8DBfBSDaF8L+JujsaV5hloFvzq1ZB vUWCe0dqsPB6Jr5nm01Ae6+p7hygjP5Ntg== X-Google-Smtp-Source: ABdhPJz6rqf0X3L7cVkto60dUOeKs0WqGelKArZsNlMlzRI3TzAC+AbL7gSUNvgYTLK7CBiqqClRyg== X-Received: by 2002:a4a:dec8:: with SMTP id w8mr4397345oou.24.1637690656215; Tue, 23 Nov 2021 10:04:16 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c8sm2357514otk.40.2021.11.23.10.04.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Nov 2021 10:04:15 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 04/17] binman: Tidy up style in cmdline Date: Tue, 23 Nov 2021 11:03:41 -0700 Message-Id: <20211123180354.615946-5-sjg@chromium.org> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog In-Reply-To: <20211123180354.615946-1-sjg@chromium.org> References: <20211123180354.615946-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Update this file to improve the pylint score a little. The remaining item is: Function name "ParseArgs" doesn't conform to snake_case naming style which needs some binman-wide renaming. Signed-off-by: Simon Glass --- scripts/pylint.base | 2 +- tools/binman/cmdline.py | 45 ++++++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/scripts/pylint.base b/scripts/pylint.base index f4f226799c1..4e82dd4a616 100644 --- a/scripts/pylint.base +++ b/scripts/pylint.base @@ -2,7 +2,7 @@ _testing 0.83 atf_bl31 -6.00 binman.cbfs_util 7.70 binman.cbfs_util_test 9.19 -binman.cmdline 8.87 +binman.cmdline 9.06 binman.control 4.39 binman.elf 6.42 binman.elf_test 5.41 diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py index e73ff780956..14ec95c25be 100644 --- a/tools/binman/cmdline.py +++ b/tools/binman/cmdline.py @@ -2,18 +2,38 @@ # Copyright (c) 2016 Google, Inc # Written by Simon Glass # -# Command-line parser for binman -# + +"""Command-line parser for binman""" from argparse import ArgumentParser +def make_extract_parser(subparsers): + """make_extract_parser: Make a subparser for the 'extract' command + + Args: + subparsers (ArgumentParser): parser to add this one to + """ + extract_parser = subparsers.add_parser('extract', + help='Extract files from an image') + extract_parser.add_argument('-i', '--image', type=str, required=True, + help='Image filename to extract') + extract_parser.add_argument('-f', '--filename', type=str, + help='Output filename to write to') + extract_parser.add_argument('-O', '--outdir', type=str, default='', + help='Path to directory to use for output files') + extract_parser.add_argument('paths', type=str, nargs='*', + help='Paths within file to extract (wildcard)') + extract_parser.add_argument('-U', '--uncompressed', action='store_true', + help='Output raw uncompressed data for compressed entries') + def ParseArgs(argv): """Parse the binman command-line arguments Args: - argv: List of string arguments + argv (list of str): List of string arguments + Returns: - Tuple (options, args) with the command-line options and arugments. + tuple: (options, args) with the command-line options and arugments. options provides access to the options (e.g. option.debug) args is a list of string arguments """ @@ -74,8 +94,8 @@ controlled by a description in the board device tree.''' build_parser.add_argument('--update-fdt-in-elf', type=str, help='Update an ELF file with the output dtb: infile,outfile,begin_sym,end_sym') - entry_parser = subparsers.add_parser('entry-docs', - help='Write out entry documentation (see entries.rst)') + subparsers.add_parser( + 'entry-docs', help='Write out entry documentation (see entries.rst)') list_parser = subparsers.add_parser('ls', help='List files in an image') list_parser.add_argument('-i', '--image', type=str, required=True, @@ -83,18 +103,7 @@ controlled by a description in the board device tree.''' list_parser.add_argument('paths', type=str, nargs='*', help='Paths within file to list (wildcard)') - extract_parser = subparsers.add_parser('extract', - help='Extract files from an image') - extract_parser.add_argument('-i', '--image', type=str, required=True, - help='Image filename to extract') - extract_parser.add_argument('-f', '--filename', type=str, - help='Output filename to write to') - extract_parser.add_argument('-O', '--outdir', type=str, default='', - help='Path to directory to use for output files') - extract_parser.add_argument('paths', type=str, nargs='*', - help='Paths within file to extract (wildcard)') - extract_parser.add_argument('-U', '--uncompressed', action='store_true', - help='Output raw uncompressed data for compressed entries') + make_extract_parser(subparsers) replace_parser = subparsers.add_parser('replace', help='Replace entries in an image') -- 2.34.0.rc2.393.gf8c9666880-goog