summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-06-02 13:12:50 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-03 13:13:29 +0100
commitf6f10858e5464445016cd4eff20878804d4cb858 (patch)
treed515e89b815c72da32387531d1e53b8fadce33fb /scripts
parentee31bad7627a7c8590a5a7dd3ffc210872067f44 (diff)
downloadpoky-f6f10858e5464445016cd4eff20878804d4cb858.tar.gz
scripts: python3: fix urllib imports
Some functions and classes have been moved from urllib[2] to urllib.request and urllib.error in python 3. Used new imports to make the code working in python 3. (From OE-Core rev: ec3f1759e8b491a44a1fc1ecb6f89919dd30da97) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/contrib/verify-homepage.py4
-rwxr-xr-xscripts/send-error-report14
2 files changed, 9 insertions, 9 deletions
diff --git a/scripts/contrib/verify-homepage.py b/scripts/contrib/verify-homepage.py
index 265ff65d3c..18bb15b277 100755
--- a/scripts/contrib/verify-homepage.py
+++ b/scripts/contrib/verify-homepage.py
@@ -7,7 +7,7 @@
7import sys 7import sys
8import os 8import os
9import subprocess 9import subprocess
10import urllib2 10import urllib.request
11 11
12 12
13# Allow importing scripts/lib modules 13# Allow importing scripts/lib modules
@@ -47,7 +47,7 @@ def verifyHomepage(bbhandler):
47 homepage = data.getVar("HOMEPAGE", True) 47 homepage = data.getVar("HOMEPAGE", True)
48 if homepage: 48 if homepage:
49 try: 49 try:
50 urllib2.urlopen(homepage, timeout=5) 50 urllib.request.urlopen(homepage, timeout=5)
51 except Exception: 51 except Exception:
52 count = count + wgetHomepage(os.path.basename(realfn), homepage) 52 count = count + wgetHomepage(os.path.basename(realfn), homepage)
53 checked.append(realfn) 53 checked.append(realfn)
diff --git a/scripts/send-error-report b/scripts/send-error-report
index ed78bd6ebb..a9f6e42d17 100755
--- a/scripts/send-error-report
+++ b/scripts/send-error-report
@@ -7,7 +7,7 @@
7# Author: Andreea Proca <andreea.b.proca@intel.com> 7# Author: Andreea Proca <andreea.b.proca@intel.com>
8# Author: Michael Wood <michael.g.wood@intel.com> 8# Author: Michael Wood <michael.g.wood@intel.com>
9 9
10import urllib2 10import urllib.request, urllib.error
11import sys 11import sys
12import json 12import json
13import os 13import os
@@ -25,10 +25,10 @@ log = logging.getLogger("send-error-report")
25logging.basicConfig(format='%(levelname)s: %(message)s') 25logging.basicConfig(format='%(levelname)s: %(message)s')
26 26
27def getPayloadLimit(url): 27def getPayloadLimit(url):
28 req = urllib2.Request(url, None) 28 req = urllib.request.Request(url, None)
29 try: 29 try:
30 response = urllib2.urlopen(req) 30 response = urllib.request.urlopen(req)
31 except urllib2.URLError as e: 31 except urllib.error.URLError as e:
32 # Use this opportunity to bail out if we can't even contact the server 32 # Use this opportunity to bail out if we can't even contact the server
33 log.error("Could not contact server: " + url) 33 log.error("Could not contact server: " + url)
34 log.error(e.reason) 34 log.error(e.reason)
@@ -136,10 +136,10 @@ def send_data(data, args):
136 else: 136 else:
137 url = "http://"+args.server+"/ClientPost/" 137 url = "http://"+args.server+"/ClientPost/"
138 138
139 req = urllib2.Request(url, data=data, headers=headers) 139 req = urllib.request.Request(url, data=data, headers=headers)
140 try: 140 try:
141 response = urllib2.urlopen(req) 141 response = urllib.request.urlopen(req)
142 except urllib2.HTTPError, e: 142 except urllib.error.HTTPError as e:
143 logging.error(e.reason) 143 logging.error(e.reason)
144 sys.exit(1) 144 sys.exit(1)
145 145