diff options
author | sbz <sbz@FreeBSD.org> | 2012-09-18 00:34:54 +0800 |
---|---|---|
committer | sbz <sbz@FreeBSD.org> | 2012-09-18 00:34:54 +0800 |
commit | 29f2dff4b0b6ce1d0727fcaa88851ac1bcf308d8 (patch) | |
tree | 77af5eab933c7ba1df1e60653c8bf193dd54158a /Tools/scripts | |
parent | cfebaa122f069899bdfa4a4d3c8bfed3fbdc27ae (diff) | |
download | freebsd-ports-gnome-29f2dff4b0b6ce1d0727fcaa88851ac1bcf308d8.tar.gz freebsd-ports-gnome-29f2dff4b0b6ce1d0727fcaa88851ac1bcf308d8.tar.zst freebsd-ports-gnome-29f2dff4b0b6ce1d0727fcaa88851ac1bcf308d8.zip |
- Fix bytes problem returned by urlopen when using Python 3.x
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-x | Tools/scripts/getpatch | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Tools/scripts/getpatch b/Tools/scripts/getpatch index d8729ec93d3a..9c278ccd0086 100755 --- a/Tools/scripts/getpatch +++ b/Tools/scripts/getpatch @@ -57,7 +57,7 @@ class GetPatch(object): if filename.endswith(('.patch', '.txt')): filename = filename[:filename.rindex('.')]+'.diff' f=open(filename, 'w') - f.write(data) + f.write(data.decode()) f.close() self.out("[+] %s created" % filename) @@ -79,7 +79,7 @@ class GetPatch(object): data = urllib2.urlopen(url).read() if self.output_stdout: - sys.stdout.write(data) + sys.stdout.write(data.decode()) else: self.write(p, data) @@ -107,7 +107,7 @@ class GnatsGetPatch(GetPatch): self.out("[-] No patch found") sys.exit(1) - for patchs in re.findall(pattern, data): + for patchs in re.findall(pattern, str(data)): self.patchs.append({'url': patchs[0], 'name': patchs[1]}) class BzGetPatch(GetPatch): @@ -155,7 +155,7 @@ class BzGetPatch(GetPatch): self.out("[-] No patch found") sys.exit(1) - for i in xrange(nb_urls): + for i in range(nb_urls): self.patchs.append({'url': urls[i], 'name': names[i]}) def main(): |