summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/orm/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/orm/models.py')
-rw-r--r--bitbake/lib/toaster/orm/models.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 88967a23f5..9183b0cd7c 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -1147,18 +1147,26 @@ class LayerIndexLayerSource(LayerSource):
1147 assert self.apiurl is not None 1147 assert self.apiurl is not None
1148 from django.db import transaction, connection 1148 from django.db import transaction, connection
1149 1149
1150 import urllib2, urlparse, json 1150 import json
1151 import os 1151 import os
1152
1153 try:
1154 from urllib.request import urlopen, URLError
1155 from urllib.parse import urlparse
1156 except ImportError:
1157 from urllib2 import urlopen, URLError
1158 from urlparse import urlparse
1159
1152 proxy_settings = os.environ.get("http_proxy", None) 1160 proxy_settings = os.environ.get("http_proxy", None)
1153 oe_core_layer = 'openembedded-core' 1161 oe_core_layer = 'openembedded-core'
1154 1162
1155 def _get_json_response(apiurl = self.apiurl): 1163 def _get_json_response(apiurl = self.apiurl):
1156 _parsedurl = urlparse.urlparse(apiurl) 1164 _parsedurl = urlparse(apiurl)
1157 path = _parsedurl.path 1165 path = _parsedurl.path
1158 1166
1159 try: 1167 try:
1160 res = urllib2.urlopen(apiurl) 1168 res = urlopen(apiurl)
1161 except urllib2.URLError as e: 1169 except URLError as e:
1162 raise Exception("Failed to read %s: %s" % (path, e.reason)) 1170 raise Exception("Failed to read %s: %s" % (path, e.reason))
1163 1171
1164 return json.loads(res.read()) 1172 return json.loads(res.read())