src/eric7/Utilities/__init__.py

branch
eric7
changeset 10944
ff77c9a96a80
parent 10928
46651e194fbe
child 10949
2057b1b198a5
equal deleted inserted replaced
10943:c29a9da41c92 10944:ff77c9a96a80
1051 except AttributeError: 1051 except AttributeError:
1052 sip_version_str = "sip version not available" 1052 sip_version_str = "sip version not available"
1053 1053
1054 sizeStr = "64-Bit" if sys.maxsize > 2**32 else "32-Bit" 1054 sizeStr = "64-Bit" if sys.maxsize > 2**32 else "32-Bit"
1055 1055
1056 info = ["Version Numbers:"] 1056 info = [
1057 1057 "Version Numbers",
1058 info.append(" Python {0}, {1}".format(sys.version.split()[0], sizeStr)) 1058 "===============",
1059 info.append(" Qt {0}".format(qVersion())) 1059 ]
1060 info.append(" PyQt6 {0}".format(PYQT_VERSION_STR)) 1060
1061 info.append(f" {Program} {Version}")
1062 info.append("")
1063
1064 info.append(f" Python {sys.version.split()[0]}, {sizeStr}")
1065 info.append(f" Qt {qVersion()}")
1066 info.append(f" PyQt6 {PYQT_VERSION_STR}")
1061 try: 1067 try:
1062 from PyQt6 import QtCharts # noqa: I101, I102 1068 from PyQt6 import QtCharts # noqa: I101, I102
1063 1069
1064 info.append(" PyQt6-Charts {0}".format(QtCharts.PYQT_CHART_VERSION_STR)) 1070 info.append(f" PyQt6-Charts {QtCharts.PYQT_CHART_VERSION_STR}")
1065 except (AttributeError, ImportError): 1071 except (AttributeError, ImportError):
1066 info.append(" PyQt6-Charts not installed") 1072 info.append(" PyQt6-Charts not installed")
1067 try: 1073 try:
1068 from PyQt6 import QtWebEngineCore # noqa: I101, I102 1074 from PyQt6 import QtWebEngineCore # noqa: I101, I102
1069 1075
1070 info.append( 1076 info.append(
1071 " PyQt6-WebEngine {0}".format(QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR) 1077 f" PyQt6-WebEngine {QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR}"
1072 ) 1078 )
1073 except (AttributeError, ImportError): 1079 except (AttributeError, ImportError):
1074 info.append(" PyQt6-WebEngine not installed") 1080 info.append(" PyQt6-WebEngine not installed")
1075 info.append(" PyQt6-QScintilla {0}".format(QSCINTILLA_VERSION_STR)) 1081 info.append(f" PyQt6-QScintilla {QSCINTILLA_VERSION_STR}")
1076 info.append(" sip {0}".format(sip_version_str)) 1082 info.append(f" sip {sip_version_str}")
1077 if bool(importlib.util.find_spec("PyQt6.QtWebEngineWidgets")): 1083 if bool(importlib.util.find_spec("PyQt6.QtWebEngineWidgets")):
1078 from eric7.WebBrowser.Tools import WebBrowserTools # noqa: I101 1084 from eric7.WebBrowser.Tools import WebBrowserTools # noqa: I101
1079 1085
1080 ( 1086 (
1081 chromiumVersion, 1087 chromiumVersion,
1082 chromiumSecurityVersion, 1088 chromiumSecurityVersion,
1083 ) = WebBrowserTools.getWebEngineVersions()[0:2] 1089 ) = WebBrowserTools.getWebEngineVersions()[0:2]
1084 info.append(" WebEngine {0}".format(chromiumVersion)) 1090 info.append(f" WebEngine {chromiumVersion}")
1085 if chromiumSecurityVersion: 1091 if chromiumSecurityVersion:
1086 info.append(" (Security) {0}".format(chromiumSecurityVersion)) 1092 info.append(f" (Security) {chromiumSecurityVersion}")
1087 info.append(" {0} {1}".format(Program, Version))
1088 info.append("") 1093 info.append("")
1089 info.append("Platform: {0}".format(sys.platform)) 1094 info.append("Platform")
1095 info.append("========")
1096 info.append(sys.platform)
1090 if os.environ.get("SOMMELIER_VERSION", ""): 1097 if os.environ.get("SOMMELIER_VERSION", ""):
1091 info[-1] += ", ChromeOS" 1098 info[-1] += ", ChromeOS"
1092 info.append(sys.version) 1099 info.append(f"Python {sys.version}")
1093 desktop = DesktopUtilities.desktopName() 1100 desktop = DesktopUtilities.desktopName()
1094 if desktop: 1101 if desktop:
1095 info.append("") 1102 info.append("")
1096 info.append("Desktop: {0}".format(desktop)) 1103 info.append(f"Desktop: {desktop}")
1097 session = DesktopUtilities.sessionType() 1104 session = DesktopUtilities.sessionType()
1098 if session: 1105 if session:
1099 info.append("") 1106 if not desktop:
1100 info.append("Session Type: {0}".format(session)) 1107 info.append("")
1108 info.append(f"Session Type: {session}")
1101 1109
1102 return linesep.join(info) 1110 return linesep.join(info)
1103 1111
1104 1112
1105 def generatePluginsVersionInfo(linesep="\n"): 1113 def generatePluginsVersionInfo(linesep="\n"):
1118 pm = app.getObject("PluginManager") 1126 pm = app.getObject("PluginManager")
1119 versions = {} 1127 versions = {}
1120 for pinfo in pm.getPluginInfos(): 1128 for pinfo in pm.getPluginInfos():
1121 versions[pinfo["module_name"]] = pinfo["version"] 1129 versions[pinfo["module_name"]] = pinfo["version"]
1122 1130
1123 info.append("Plugins Version Numbers:") 1131 info.append("Plugin Version Numbers")
1132 info.append("======================")
1124 for pluginModuleName in sorted(versions): 1133 for pluginModuleName in sorted(versions):
1125 info.append( 1134 info.append(
1126 " {0} {1}".format(pluginModuleName, versions[pluginModuleName]) 1135 f" {pluginModuleName} {versions[pluginModuleName]}"
1127 ) 1136 )
1128 1137
1129 return linesep.join(info) 1138 return linesep.join(info)
1130 1139
1131 1140
1140 """ 1149 """
1141 info = [] 1150 info = []
1142 if OSUtilities.isLinuxPlatform() or OSUtilities.isFreeBsdPlatform(): 1151 if OSUtilities.isLinuxPlatform() or OSUtilities.isFreeBsdPlatform():
1143 releaseList = glob.glob("/etc/*-release") 1152 releaseList = glob.glob("/etc/*-release")
1144 if releaseList: 1153 if releaseList:
1145 info.append("Distribution Info:") 1154 info.append("Distribution Info")
1155 info.append("=================")
1146 for rfile in releaseList: 1156 for rfile in releaseList:
1147 try: 1157 try:
1148 with open(rfile, "r") as f: 1158 with open(rfile, "r") as f:
1149 lines = f.read().splitlines() 1159 lines = f.read().splitlines()
1150 except OSError: 1160 except OSError:

eric ide

mercurial