From patchwork Tue Nov 10 05:45:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 542181 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9A8AE140D69 for ; Tue, 10 Nov 2015 16:45:43 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=e6k/h7p4; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=g19fbVk6GdXVMZ6xbw7dOwUTTnyxUuk1VpEV72BY7I3CJqAVVnQks DCVMV/qiXIiq4C+zzxpoeE9x1yUrD4um0jN+IkVG9ph0Eu3ZZ7d67QgQhukNvUwI +XHssKTaQSBgsMrf97L9tjC/smizSgPb/XfGpervmkmappUkqTuauM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=lvk68fCMiqUoXf0u1WAc3FVhnjE=; b=e6k/h7p4+pFx2IrY1zH4G/DvRBAt Yj2+Xvf4qWQWQfQgUs1q72Ie/u8gGKQfxP0WvlLB8CmgwPL3sJ/fu3RInmPBA0Ih x8klCgTpJh4Hf1o5ioQOy6jYUttEGCSux9ak10uaJi7SnezO/If57dy7VNXG8ghv JxC6KNRnZyQtJIQ= Received: (qmail 52478 invoked by alias); 10 Nov 2015 05:45:34 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 52435 invoked by uid 89); 10 Nov 2015 05:45:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org From: Mike Frysinger To: libc-alpha@sourceware.org Subject: [PATCH] list-fixed-bugs: use argparse for the commandline Date: Tue, 10 Nov 2015 00:45:25 -0500 Message-Id: <1447134325-895-1-git-send-email-vapier@gentoo.org> This makes the interface more friendly to users. 2015-11-09 Mike Frysinger * scripts/list-fixed-bugs.py: Import argparse. Call main instead. (get_parser): New function. (main): New function. --- scripts/list-fixed-bugs.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/list-fixed-bugs.py b/scripts/list-fixed-bugs.py index 37e9a43..0a61adc 100755 --- a/scripts/list-fixed-bugs.py +++ b/scripts/list-fixed-bugs.py @@ -23,11 +23,21 @@ bugs marked as FIXED with that milestone, to be added to the NEWS file just before release. The output is in UTF-8. """ +import argparse import json import sys import textwrap import urllib.request + +def get_parser(): + """Return an argument parser for this module.""" + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('version', + help='Release version to look up') + return parser + + def list_fixed_bugs(version): """List the bugs fixed in a given version.""" url = ('https://sourceware.org/bugzilla/rest.cgi/bug?product=glibc' @@ -42,5 +52,13 @@ def list_fixed_bugs(version): subsequent_indent=' ') + '\n' sys.stdout.buffer.write(desc.encode('utf-8')) + +def main(argv): + """The main entry point.""" + parser = get_parser() + opts = parser.parse_args(argv) + list_fixed_bugs(opts.version) + + if __name__ == '__main__': - list_fixed_bugs(sys.argv[1]) + main(sys.argv[1:])