summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorSofian Brabez <sbz@FreeBSD.org>2013-05-09 22:02:15 +0000
committerSofian Brabez <sbz@FreeBSD.org>2013-05-09 22:02:15 +0000
commitf88bb82d5fc8dcb2caa244751d7a6beb1ef3a129 (patch)
treed7a5e40ceac69b5cbba70149d7a102b52cd78a86 /Tools
parentwww/py27-django-mezzanine: Django content management platform [NEW PORT] (diff)
- 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 <christoph.mallon at gmx.de>
Notes
Notes: svn path=/head/; revision=317750
Diffstat (limited to 'Tools')
-rw-r--r--Tools/scripts/README.getpatch12
-rwxr-xr-xTools/scripts/getpatch18
2 files changed, 16 insertions, 14 deletions
diff --git a/Tools/scripts/README.getpatch b/Tools/scripts/README.getpatch
index 8c0bb97d632d..75501b699179 100644
--- a/Tools/scripts/README.getpatch
+++ b/Tools/scripts/README.getpatch
@@ -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] <pr-id>
@@ -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
diff --git a/Tools/scripts/getpatch b/Tools/scripts/getpatch
index baf762cd828b..25792eb8ec9a 100755
--- a/Tools/scripts/getpatch
+++ b/Tools/scripts/getpatch
@@ -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: