--- a/eric6/Utilities/__init__.py Wed Sep 30 19:32:19 2020 +0200 +++ b/eric6/Utilities/__init__.py Wed Sep 30 19:33:21 2020 +0200 @@ -1916,8 +1916,10 @@ """ Module function to generate a string with various version infos. - @param linesep string to be used to separate lines (string) - @return string with version infos (string) + @param linesep string to be used to separate lines + @type str + @return string with version infos + @rtype str """ try: try: @@ -1933,50 +1935,53 @@ else: sizeStr = "32-Bit" - info = "Version Numbers:{0} Python {1}, {2}{3}".format( - linesep, sys.version.split()[0], sizeStr, linesep) - info += " Qt {0}{1} PyQt {2}{3}".format( - qVersion(), linesep, PYQT_VERSION_STR, linesep) + info = ["Version Numbers:"] + + info.append(" Python {0}, {1}".format(sys.version.split()[0], sizeStr)) + info.append(" Qt {0}".format(qVersion())) + info.append(" PyQt {0}".format(PYQT_VERSION_STR)) try: from PyQt5 import QtChart - info += " PyQtChart {0}".format(QtChart.PYQT_CHART_VERSION_STR) + info.append(" PyQtChart {0}".format(QtChart.PYQT_CHART_VERSION_STR)) except (ImportError, AttributeError): - pass + info.append(" PyQtChart not installed") try: from PyQt5 import QtWebEngine - info += " PyQtWebEngine {0}".format( - QtWebEngine.PYQT_WEBENGINE_VERSION_STR) + info.append(" PyQtWebEngine {0}".format( + QtWebEngine.PYQT_WEBENGINE_VERSION_STR)) except (ImportError, AttributeError): - pass - info += " QScintilla {2}{3} sip {0}{1}".format( - sip_version_str, linesep, QSCINTILLA_VERSION_STR, linesep) + info.append(" PyQtWebEngine not installed") + info.append(" QScintilla {0}".format(QSCINTILLA_VERSION_STR)) + info.append(" sip {0}".format(sip_version_str)) try: from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__ from WebBrowser.Tools import WebBrowserTools chromeVersion = WebBrowserTools.getWebEngineVersions()[0] - info += " WebEngine {0}{1}".format(chromeVersion, linesep) + info.append(" WebEngine {0}".format(chromeVersion)) except ImportError: pass - info += " {0} {1}{2}".format( - Program, Version, linesep * 2) - info += "Platform: {0}{1}{2}{3}".format( - sys.platform, linesep, sys.version, linesep) + info.append(" {0} {1}".format(Program, Version)) + info.append("") + info.append("Platform: {0}".format(sys.platform)) + info.append(sys.version) desktop = desktopName() if desktop: - info += linesep - info += "Desktop: {0}{1}".format(desktop, linesep) + info.append("") + info.append("Desktop: {0}".format(desktop)) - return info + return linesep.join(info) def generatePluginsVersionInfo(linesep='\n'): """ Module function to generate a string with plugins version infos. - @param linesep string to be used to separate lines (string) - @return string with plugins version infos (string) + @param linesep string to be used to separate lines + @type str + @return string with plugins version infos + @rtype str """ - infoStr = "" + info = [] app = e5App() if app is not None: try: @@ -1985,29 +1990,30 @@ for info in pm.getPluginInfos(): versions[info["module_name"]] = info["version"] - infoStr = "Plugins Version Numbers:{0}".format(linesep) + info.append("Plugins Version Numbers:") for pluginModuleName in sorted(versions.keys()): - infoStr += " {0} {1}{2}".format( - pluginModuleName, versions[pluginModuleName], linesep) + info.append(" {0} {1}".format( + pluginModuleName, versions[pluginModuleName])) except KeyError: pass - return infoStr + return linesep.join(info) def generateDistroInfo(linesep='\n'): """ Module function to generate a string with distribution infos. - @param linesep string to be used to separate lines (string) - @return string with plugins version infos (string) + @param linesep string to be used to separate lines + @type str + @return string with distribution infos + @rtype str """ - infoStr = "" + info = [] if isLinuxPlatform(): releaseList = glob.glob("/etc/*-release") if releaseList: - infoStr = "Distribution Info:{0}".format(linesep) - infoParas = [] + info.append("Distribution Info:") for rfile in releaseList: try: f = open(rfile, "r") @@ -2016,11 +2022,11 @@ except IOError: continue - lines.insert(0, rfile) - infoParas.append(' ' + (linesep + ' ').join(lines)) - infoStr += (linesep + linesep).join(infoParas) + info.append(rfile) + info.extend([' {0}'.format(line) for line in lines]) + info.append("") - return infoStr + return linesep.join(info) def toBool(dataStr):