From: "André Erdmann" <dywi@mailerd.de>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 02/13] autobuild-run, python3: urllib.request<>urllib2
Date: Wed, 25 Feb 2015 22:17:19 +0100 [thread overview]
Message-ID: <1424899050-24932-3-git-send-email-dywi@mailerd.de> (raw)
In-Reply-To: <1424899050-24932-1-git-send-email-dywi@mailerd.de>
urllib2 has been split into several modules,
urlopen() is now part of urllib.request.
Py2k compatibility: import urllib2 if python version < 3
Signed-off-by: Andr? Erdmann <dywi@mailerd.de>
---
scripts/autobuild-run | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/scripts/autobuild-run b/scripts/autobuild-run
index 2354893..be2f482 100755
--- a/scripts/autobuild-run
+++ b/scripts/autobuild-run
@@ -59,7 +59,6 @@
from __future__ import print_function
-import urllib2
import csv
from random import randint
import subprocess
@@ -73,6 +72,13 @@ import hashlib
import argparse
import ConfigParser
+if sys.hexversion >= 0x3000000:
+ import urllib.request as _urllib
+else:
+ import urllib2 as _urllib
+
+urlopen = _urllib.urlopen
+
MAX_DURATION = 60 * 60 * 4
VERSION = 1
@@ -81,7 +87,7 @@ def log_write(logf, msg):
logf.flush()
def check_version():
- r = urllib2.urlopen('http://autobuild.buildroot.org/version')
+ r = urlopen('http://autobuild.buildroot.org/version')
version = int(r.readline().strip())
if version > VERSION:
print("ERROR: script version too old, please upgrade.")
@@ -136,7 +142,7 @@ def get_toolchain_configs():
- contents: an array of lines of the defconfig
"""
- r = urllib2.urlopen('http://autobuild.buildroot.org/toolchains/configs/toolchain-configs.csv')
+ r = urlopen('http://autobuild.buildroot.org/toolchains/configs/toolchain-configs.csv')
l = r.readlines()
configs = []
for row in csv.reader(l):
@@ -151,7 +157,7 @@ def get_toolchain_configs():
if hostarch != config["hostarch"]:
continue
config["libc"] = row[2]
- r = urllib2.urlopen(config["url"])
+ r = urlopen(config["url"])
config["contents"] = r.readlines()
configs.append(config)
return configs
--
2.3.0
next prev parent reply other threads:[~2015-02-25 21:17 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 21:17 [Buildroot] [PATCH 00/13] autobuild-run: python3 compat and misc improvements André Erdmann
2015-02-25 21:17 ` [Buildroot] [PATCH 01/13] autobuild-run, python3: print is a function André Erdmann
2015-02-25 21:17 ` André Erdmann [this message]
2015-02-25 21:17 ` [Buildroot] [PATCH 03/13] autobuild-run, python3: bytes<>str, decode() André Erdmann
2015-02-25 21:17 ` [Buildroot] [PATCH 04/13] autobuild-run, python3: configparser<>ConfigParser André Erdmann
2015-02-25 21:17 ` [Buildroot] [PATCH 05/13] autobuild-run: remove unneeded vars André Erdmann
2015-02-25 21:17 ` [Buildroot] [PATCH 06/13] autobuild-run: explicitly close web file handles André Erdmann
2015-02-25 21:17 ` [Buildroot] [PATCH 07/13] autobuild-run: get host arch once André Erdmann
2015-02-25 21:17 ` [Buildroot] [PATCH 08/13] autobuild-run: sort imports alphabetically André Erdmann
2015-02-25 21:17 ` [Buildroot] [PATCH 09/13] autobuild-run: unify "which <prog>" code André Erdmann
2015-02-25 21:17 ` [Buildroot] [PATCH 10/13] autobuild-run: use a built-in has_prog() implementation André Erdmann
2015-02-25 21:17 ` [Buildroot] [PATCH 11/13] autobuild-run: move check_requirements() to SystemInfo André Erdmann
2015-02-25 21:17 ` [Buildroot] [PATCH 12/13] autobuild-run: encapsulate subprocess calls André Erdmann
2015-02-25 21:17 ` [Buildroot] [PATCH 13/13] autobuild-run: set locale to en_US or C André Erdmann
2015-02-26 10:08 ` [Buildroot] [PATCH 00/13] autobuild-run: python3 compat and misc improvements Thomas Petazzoni
2015-02-26 19:25 ` Thomas De Schampheleire
2015-03-01 0:09 ` André Erdmann
2015-03-01 21:17 ` Thomas De Schampheleire
2015-03-01 21:37 ` André Erdmann
2015-03-01 21:52 ` Thomas De Schampheleire
2015-03-02 8:36 ` Thomas Petazzoni
2015-03-02 20:00 ` André Erdmann
2015-03-15 13:36 ` Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1424899050-24932-3-git-send-email-dywi@mailerd.de \
--to=dywi@mailerd.de \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox