From owner-svn-ports-all@FreeBSD.ORG Thu May 9 22:02:16 2013 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DC3D321C; Thu, 9 May 2013 22:02:16 +0000 (UTC) (envelope-from sbz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BD2EF62B; Thu, 9 May 2013 22:02:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r49M2Gh9060550; Thu, 9 May 2013 22:02:16 GMT (envelope-from sbz@svn.freebsd.org) Received: (from sbz@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r49M2GGm060548; Thu, 9 May 2013 22:02:16 GMT (envelope-from sbz@svn.freebsd.org) Message-Id: <201305092202.r49M2GGm060548@svn.freebsd.org> From: Sofian Brabez Date: Thu, 9 May 2013 22:02:16 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r317750 - head/Tools/scripts X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 May 2013 22:02:16 -0000 Author: sbz Date: Thu May 9 22:02:15 2013 New Revision: 317750 URL: http://svnweb.freebsd.org/changeset/ports/317750 Log: - Use literal instead of constructor to avoid CALL_FUNCTION bytecode instruction - Add add_patch method [1] - Update README wording and fix typo PR: ports/175984 [1] Submitted by: Christoph Mallon Modified: head/Tools/scripts/README.getpatch (contents, props changed) head/Tools/scripts/getpatch Modified: head/Tools/scripts/README.getpatch ============================================================================== --- head/Tools/scripts/README.getpatch Thu May 9 21:38:13 2013 (r317749) +++ head/Tools/scripts/README.getpatch Thu May 9 22:02:15 2013 (r317750) @@ -1,7 +1,7 @@ GETPATCH(1) FreeBSD General Commands Manual GETPATCH(1) NAME - getpatch - A utility to download patch attachments on Bug Tracking Systems + getpatch - Utility to download patch attachments on Bug Tracking Systems SYNOPSIS getpatch [-h] [--mode gnats|bz] [--last] [--stdout] @@ -11,7 +11,7 @@ DESCRIPTION Systems such Gnats and Bugzilla. It supports retrieving multiple attachments from the command line. - It's written in python witout any extra dependencies. In addition to the + It's written in python without any extra dependencies. In addition to the functionalities offered by other similar tools suchs as getpr, it does web scrapping on the BTS web interface in order to retrieve the patches attached to PR. @@ -20,7 +20,7 @@ DESCRIPTION -h Prints a multi-line help message and exits. - --mode Specifies the BTS. Currently "gnats" and "bz" are. + --mode Specifies the BTS. Currently "gnats" and "bz" are supported. --last Only retrieves the latest iteration of a patch. @@ -33,7 +33,7 @@ FILES ${PORTSDIR}/Tools/scripts/getpatch EXAMPLES - Retrieve all patches attached to PR ports/166692 from a Gnats BTS: + Retrieve all patches attached to PR ports/166692 from Gnats BTS: getpatch --mode gnats ports/166692 @@ -43,7 +43,7 @@ EXAMPLES Gnats is the default BTS and category isn't mandatory. - Retrieve all patches attached to PR ports/166692 from a Bugzilla BTS: + Retrieve all patches attached to PR ports/166692 from Bugzilla BTS: getpatch --mode bz ports/166692 @@ -51,7 +51,7 @@ EXAMPLES getpatch --last ports/166692 - Retrieve a patch on dump it to standard output + Retrieve a patch and dump it to standard output getpatch --stdout ports/166692 Modified: head/Tools/scripts/getpatch ============================================================================== --- head/Tools/scripts/getpatch Thu May 9 21:38:13 2013 (r317749) +++ head/Tools/scripts/getpatch Thu May 9 22:02:15 2013 (r317750) @@ -30,7 +30,6 @@ import argparse import codecs -import locale import re import sys if sys.version_info.major == 3: @@ -47,11 +46,11 @@ class GetPatch(object): def __init__(self, pr, category='ports'): self.pr = pr self.category = category - self.patchs = list() - self.url = str() - self.patch = str() + self.patchs = [] + self.url = "" + self.patch = "" self.output_stdout = False - self.default_locale = locale.getdefaultlocale()[1].lower() + self.default_locale = sys.getdefaultencoding() def fetch(self, *largs, **kwargs): raise NotImplementedError() @@ -86,6 +85,9 @@ class GetPatch(object): else: self.write(p, data) + def add_patch(self, url, name): + self.patchs.append({'url': url, 'name': name}) + def out(self, s): if not self.output_stdout: print(s) @@ -111,7 +113,7 @@ class GnatsGetPatch(GetPatch): sys.exit(1) for patchs in re.findall(pattern, str(data)): - self.patchs.append({'url': patchs[0], 'name': patchs[1]}) + self.add_patch(patchs[0], patchs[1]) class BzGetPatch(GetPatch): @@ -159,7 +161,7 @@ class BzGetPatch(GetPatch): sys.exit(1) for i in range(nb_urls): - self.patchs.append({'url': urls[i], 'name': names[i]}) + self.add_patch(urls[i], names[i]) def main(): @@ -181,7 +183,7 @@ def main(): args = parser.parse_args() - category = str() + category = "" pr = str(args.pr[0]) if '/' in pr and pr is not None: