[Buildroot] [PATCH 15/19] support/check-uniq-files: use argparse to enfore required options

Yann E. MORIN yann.morin.1998 at free.fr
Mon Jan 7 22:05:37 UTC 2019


Signed-off-by: "Yann E. MORIN" <yann.morin.1998 at free.fr>
---
 support/scripts/check-uniq-files | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/support/scripts/check-uniq-files b/support/scripts/check-uniq-files
index f42edeb534..2cee95d048 100755
--- a/support/scripts/check-uniq-files
+++ b/support/scripts/check-uniq-files
@@ -20,21 +20,13 @@ def str_decode(s):
 
 def main():
     parser = argparse.ArgumentParser()
-    parser.add_argument('packages_file_list', nargs='*',
+    parser.add_argument('packages_file_list', nargs=1,
                         help='The packages-file-list to check from')
-    parser.add_argument('-t', '--type', metavar="TYPE",
+    parser.add_argument('-t', '--type', metavar="TYPE", required=True,
                         help='Report as a TYPE file (TYPE is either target, staging, or host)')
 
     args = parser.parse_args()
 
-    if not len(args.packages_file_list) == 1:
-        sys.stderr.write('No packages-file-list was provided.\n')
-        return False
-
-    if args.type is None:
-        sys.stderr.write('No type was provided\n')
-        return False
-
     file_to_pkg = defaultdict(set)
     file_md5 = defaultdict(set)
     for record in parse_pkg_file_list(args.packages_file_list[0]):
-- 
2.14.1




More information about the buildroot mailing list