Python 3 has restructured some packages. Specifically, __builtin__ has
been renamed to builtins and urlparse has been included in urllib.
Change-Id: I81f8f3942471db1043006a36abbad6e5a49e0a43
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/15994
Reviewed-by: Juha Jäykkä <juha.jaykka@arm.com>
@wraps(func)
def wrapper(url):
- from urlparse import parse_qs
+ try:
+ from urllib.parse import parse_qs
+ except ImportError:
+ # Python 2 fallback
+ from urlparse import parse_qs
from ast import literal_eval
qs = parse_qs(url.query, keep_blank_values=True)
"""
- from urlparse import urlsplit
+ try:
+ from urllib.parse import urlsplit
+ except ImportError:
+ # Python 2 fallback
+ from urlparse import urlsplit
parsed = urlsplit(url)
from __future__ import print_function
-import __builtin__
+try:
+ import builtins
+except ImportError:
+ # Python 2 fallback
+ import __builtin__ as builtins
import inspect
import os
import re
if self.formatter.globals and item in self.frame.f_globals:
return self.frame.f_globals[item]
- if item in __builtin__.__dict__:
- return __builtin__.__dict__[item]
+ if item in builtins.__dict__:
+ return builtins.__dict__[item]
try:
item = int(item)