forked from qt-creator/qt-creator
Squish: Improve Python2/Python3 compatibility
Change-Id: I49dc9ee2f4ef52900b403ed94f0c6cd5925239b6 Reviewed-by: Robert Löhning <robert.loehning@qt.io>
This commit is contained in:
@@ -23,7 +23,10 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
import __builtin__
|
||||
try:
|
||||
import __builtin__ # Python 2
|
||||
except ImportError:
|
||||
import builtins as __builtin__ # Python 3
|
||||
|
||||
# for easier re-usage (because Python hasn't an enum type)
|
||||
class Targets:
|
||||
|
@@ -34,7 +34,10 @@ import subprocess;
|
||||
import sys
|
||||
import errno;
|
||||
from datetime import datetime,timedelta;
|
||||
import __builtin__
|
||||
try:
|
||||
import __builtin__ # Python 2
|
||||
except ImportError:
|
||||
import builtins as __builtin__ # Python 3
|
||||
|
||||
srcPath = ''
|
||||
SettingsPath = []
|
||||
@@ -120,7 +123,7 @@ def waitForCleanShutdown(timeOut=10):
|
||||
while not shutdownDone:
|
||||
try:
|
||||
os.kill(appCtxt.pid,0)
|
||||
except OSError, err:
|
||||
except OSError as err:
|
||||
if err.errno == errno.EPERM or err.errno == errno.ESRCH:
|
||||
shutdownDone=True
|
||||
if not shutdownDone and datetime.utcnow() > endtime:
|
||||
@@ -208,7 +211,7 @@ def substituteCdb(settingsDir):
|
||||
try:
|
||||
serverIni = readFile(os.path.join(os.getenv("APPDATA"), "froglogic",
|
||||
"Squish", "ver1", "server.ini"))
|
||||
autLine = filter(lambda line: "AUT/qtcreator" in line, serverIni.splitlines())[0]
|
||||
autLine = list(filter(lambda line: "AUT/qtcreator" in line, serverIni.splitlines()))[0]
|
||||
autPath = autLine.split("\"")[1]
|
||||
return os.path.exists(os.path.join(autPath, "..", "lib", "qtcreatorcdbext64"))
|
||||
except:
|
||||
|
@@ -23,8 +23,6 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
import __builtin__
|
||||
|
||||
# appends to line, by typing <typeWhat> after <insertAfterLine> text into <codeArea> widget
|
||||
def appendToLine(codeArea, insertAfterLine, typeWhat):
|
||||
if not placeCursorToLine(codeArea, insertAfterLine):
|
||||
|
@@ -23,7 +23,10 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
import urllib2
|
||||
try:
|
||||
from urllib2 import ProxyHandler, build_opener, install_opener, urlopen # Python 2
|
||||
except ImportError:
|
||||
from urllib.request import ProxyHandler, build_opener, install_opener, urlopen # Python 3
|
||||
|
||||
################ workarounds for issues tracked inside jira #################
|
||||
|
||||
@@ -43,7 +46,7 @@ class JIRA:
|
||||
def __init__(self, number, bugType=Bug.CREATOR):
|
||||
if JIRA.__instance__ == None:
|
||||
JIRA.__instance__ = JIRA.__impl(number, bugType)
|
||||
JIRA.__dict__['_JIRA__instance__'] = JIRA.__instance__
|
||||
setattr(JIRA, '__instance__', JIRA.__instance__)
|
||||
else:
|
||||
JIRA.__instance__._bugType = bugType
|
||||
JIRA.__instance__._number = number
|
||||
@@ -102,10 +105,10 @@ class JIRA:
|
||||
proxy = os.getenv("SYSTEST_PROXY", None)
|
||||
try:
|
||||
if proxy:
|
||||
proxy = urllib2.ProxyHandler({'https': proxy})
|
||||
opener = urllib2.build_opener(proxy)
|
||||
urllib2.install_opener(opener)
|
||||
bugReport = urllib2.urlopen('%s/%s' % (JIRA_URL, bug))
|
||||
proxy = ProxyHandler({'https': proxy})
|
||||
opener = build_opener(proxy)
|
||||
install_opener(opener)
|
||||
bugReport = urlopen('%s/%s' % (JIRA_URL, bug))
|
||||
data = bugReport.read()
|
||||
except:
|
||||
data = self.__tryExternalTools__(proxy)
|
||||
@@ -118,6 +121,8 @@ class JIRA:
|
||||
test.fatal("No resolution info for %s" % bug)
|
||||
self._resolution = 'Done'
|
||||
else:
|
||||
if isinstance(data, (bytes)):
|
||||
data = str(data)
|
||||
data = data.replace("\r", "").replace("\n", "")
|
||||
resPattern = re.compile('<span\s+id="resolution-val".*?>(?P<resolution>.*?)</span>')
|
||||
resolution = resPattern.search(data)
|
||||
|
@@ -24,7 +24,6 @@
|
||||
############################################################################
|
||||
|
||||
source("../../shared/qtcreator.py")
|
||||
import __builtin__
|
||||
|
||||
cppEditorStr = ":Qt Creator_CppEditor::Internal::CPPEditorWidget"
|
||||
originalSources = os.path.abspath(os.path.join(os.getcwd(), "..", "shared", "simplePlainCPP"))
|
||||
|
Reference in New Issue
Block a user