220 # it's the wheel |
220 # it's the wheel |
221 qtDataDir = os.path.join(pyqtDataDir, "Qt6") |
221 qtDataDir = os.path.join(pyqtDataDir, "Qt6") |
222 else: |
222 else: |
223 # determine dynamically |
223 # determine dynamically |
224 try: |
224 try: |
225 from PyQt6.QtCore import QLibraryInfo |
225 from PyQt6.QtCore import QLibraryInfo # noqa: I101, I102 |
226 |
226 |
227 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath) |
227 qtDataDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.DataPath) |
228 except ImportError: |
228 except ImportError: |
229 qtDataDir = None |
229 qtDataDir = None |
230 apisDir = os.path.join(qtDataDir, "qsci", "api") if qtDataDir else None |
230 apisDir = os.path.join(qtDataDir, "qsci", "api") if qtDataDir else None |
272 @param src source file name (string) |
272 @param src source file name (string) |
273 @param dst destination file name (string) |
273 @param dst destination file name (string) |
274 """ |
274 """ |
275 if os.path.exists(os.path.join("eric", "src", "eric7", "UI", "Info.py")): |
275 if os.path.exists(os.path.join("eric", "src", "eric7", "UI", "Info.py")): |
276 # Installing from installer archive |
276 # Installing from installer archive |
277 from eric.src.eric7.UI.Info import Version |
277 from eric.src.eric7.UI.Info import Version # noqa: I101, I102 |
278 elif os.path.exists(os.path.join("src", "eric7", "UI", "Info.py")): |
278 elif os.path.exists(os.path.join("src", "eric7", "UI", "Info.py")): |
279 # Installing from source tree |
279 # Installing from source tree |
280 from src.eric7.UI.Info import Version |
280 from src.eric7.UI.Info import Version # noqa: I101, I102 |
281 else: |
281 else: |
282 Version = "Unknown" |
282 Version = "Unknown" |
283 |
283 |
284 with open(src, "r", encoding="utf-8") as f: |
284 with open(src, "r", encoding="utf-8") as f: |
285 text = f.read() |
285 text = f.read() |
950 elif sys.platform.startswith(("win", "cygwin")): |
950 elif sys.platform.startswith(("win", "cygwin")): |
951 createWindowsLinks() |
951 createWindowsLinks() |
952 |
952 |
953 # Create a Mac application bundle |
953 # Create a Mac application bundle |
954 elif sys.platform == "darwin": |
954 elif sys.platform == "darwin": |
955 createMacAppBundle(cfg["ericDir"]) |
955 createMacAppBundle() |
956 |
956 |
957 return 0 |
957 return 0 |
958 |
958 |
959 |
959 |
960 def createLinuxSpecifics(): |
960 def createLinuxSpecifics(): |
1155 for linkName, targetPath, iconPath in windowsDesktopEntries(): |
1155 for linkName, targetPath, iconPath in windowsDesktopEntries(): |
1156 linkPath = os.path.join(eric7EntryPath, linkName) |
1156 linkPath = os.path.join(eric7EntryPath, linkName) |
1157 createWindowsShortcut(linkPath, targetPath, iconPath) |
1157 createWindowsShortcut(linkPath, targetPath, iconPath) |
1158 |
1158 |
1159 |
1159 |
1160 def createMacAppBundle(pydir): |
1160 def createMacAppBundle(): |
1161 """ |
1161 """ |
1162 Create a Mac application bundle. |
1162 Create a Mac application bundle. |
1163 |
|
1164 @param pydir the name of the directory where the Python script will |
|
1165 eventually be installed |
|
1166 @type str |
|
1167 """ |
1163 """ |
1168 global cfg, macAppBundleName, macPythonExe, macAppBundlePath |
1164 global cfg, macAppBundleName, macPythonExe, macAppBundlePath |
1169 |
1165 |
1170 directories = { |
1166 directories = { |
1171 "contents": "{0}/{1}/Contents/".format(macAppBundlePath, macAppBundleName), |
1167 "contents": "{0}/{1}/Contents/".format(macAppBundlePath, macAppBundleName), |
1185 wname = os.path.join(directories["exe"], "eric7_ide") |
1181 wname = os.path.join(directories["exe"], "eric7_ide") |
1186 |
1182 |
1187 # determine entry for DYLD_FRAMEWORK_PATH |
1183 # determine entry for DYLD_FRAMEWORK_PATH |
1188 dyldLine = "" |
1184 dyldLine = "" |
1189 try: |
1185 try: |
1190 from PyQt6.QtCore import QLibraryInfo |
1186 from PyQt6.QtCore import QLibraryInfo # noqa: I101, I102 |
1191 |
1187 |
1192 qtLibraryDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.LibrariesPath) |
1188 qtLibraryDir = QLibraryInfo.path(QLibraryInfo.LibraryPath.LibrariesPath) |
1193 except ImportError: |
1189 except ImportError: |
1194 qtLibraryDir = "" |
1190 qtLibraryDir = "" |
1195 if qtLibraryDir: |
1191 if qtLibraryDir: |
1223 os.path.join(directories["icns"], "eric.icns"), |
1219 os.path.join(directories["icns"], "eric.icns"), |
1224 ) |
1220 ) |
1225 |
1221 |
1226 if os.path.exists(os.path.join("eric", "eric7", "UI", "Info.py")): |
1222 if os.path.exists(os.path.join("eric", "eric7", "UI", "Info.py")): |
1227 # Installing from archive |
1223 # Installing from archive |
1228 from eric.eric7.UI.Info import CopyrightShort, Version |
1224 from eric.eric7.UI.Info import CopyrightShort, Version # noqa: I101, I102 |
1229 elif os.path.exists(os.path.join("eric7", "UI", "Info.py")): |
1225 elif os.path.exists(os.path.join("eric7", "UI", "Info.py")): |
1230 # Installing from source tree |
1226 # Installing from source tree |
1231 from eric7.UI.Info import CopyrightShort, Version |
1227 from eric7.UI.Info import CopyrightShort, Version # noqa: I101 |
1232 else: |
1228 else: |
1233 Version = "Unknown" |
1229 Version = "Unknown" |
1234 CopyrightShort = "(c) 2002 - 2023 Detlev Offenbach" |
1230 CopyrightShort = "(c) 2002 - 2023 Detlev Offenbach" |
1235 |
1231 |
1236 copyToFile( |
1232 copyToFile( |
1593 exit(5) |
1589 exit(5) |
1594 |
1590 |
1595 print("PyQt & Qt") |
1591 print("PyQt & Qt") |
1596 print("---------") |
1592 print("---------") |
1597 try: |
1593 try: |
1598 from PyQt6.QtCore import qVersion |
1594 from PyQt6.QtCore import qVersion # noqa: I101, I102 |
1599 except ImportError as err: |
1595 except ImportError as err: |
1600 msg = "'PyQt6' could not be detected.{0}".format( |
1596 msg = "'PyQt6' could not be detected.{0}".format( |
1601 "\nError: {0}".format(err) if verbose else "" |
1597 "\nError: {0}".format(err) if verbose else "" |
1602 ) |
1598 ) |
1603 installed = not isSudo and pipInstall( |
1599 installed = not isSudo and pipInstall( |
1604 "PyQt6>={0}".format(versionToStr(requiredVersions["pyqt6"])), msg |
1600 "PyQt6>={0}".format(versionToStr(requiredVersions["pyqt6"])), msg |
1605 ) |
1601 ) |
1606 if installed: |
1602 if installed: |
1607 # try to import it again |
1603 # try to import it again |
1608 try: |
1604 try: |
1609 from PyQt6.QtCore import qVersion |
1605 from PyQt6.QtCore import qVersion # noqa: I101, I102 |
1610 except ImportError as msg: |
1606 except ImportError as msg: |
1611 print("Sorry, please install PyQt6.") |
1607 print("Sorry, please install PyQt6.") |
1612 print("Error: {0}".format(msg)) |
1608 print("Error: {0}".format(msg)) |
1613 exit(1) |
1609 exit(1) |
1614 else: |
1610 else: |
1821 |
1817 |
1822 # check version of sip |
1818 # check version of sip |
1823 # ==================== |
1819 # ==================== |
1824 with contextlib.suppress(ImportError, AttributeError): |
1820 with contextlib.suppress(ImportError, AttributeError): |
1825 try: |
1821 try: |
1826 from PyQt6 import sip |
1822 from PyQt6 import sip # noqa: I101, I102 |
1827 except ImportError: |
1823 except ImportError: |
1828 import sip |
1824 import sip # noqa: I101, I102 |
1829 print("sip:", sip.SIP_VERSION_STR.strip()) |
1825 print("sip:", sip.SIP_VERSION_STR.strip()) |
1830 # always assume, that snapshots or dev versions are new enough |
1826 # always assume, that snapshots or dev versions are new enough |
1831 if "snapshot" not in sip.SIP_VERSION_STR and "dev" not in sip.SIP_VERSION_STR: |
1827 if "snapshot" not in sip.SIP_VERSION_STR and "dev" not in sip.SIP_VERSION_STR: |
1832 if sip.SIP_VERSION < requiredVersions["sip"]: |
1828 if sip.SIP_VERSION < requiredVersions["sip"]: |
1833 print( |
1829 print( |
1848 print("Please install another version.") |
1844 print("Please install another version.") |
1849 exit(3) |
1845 exit(3) |
1850 |
1846 |
1851 # check version of PyQt6 |
1847 # check version of PyQt6 |
1852 # ====================== |
1848 # ====================== |
1853 from PyQt6.QtCore import PYQT_VERSION, PYQT_VERSION_STR |
1849 from PyQt6.QtCore import PYQT_VERSION, PYQT_VERSION_STR # noqa: I101, I102 |
1854 |
1850 |
1855 print("PyQt6:", PYQT_VERSION_STR.strip()) |
1851 print("PyQt6:", PYQT_VERSION_STR.strip()) |
1856 # always assume, that snapshots or dev versions are new enough |
1852 # always assume, that snapshots or dev versions are new enough |
1857 if "snapshot" not in PYQT_VERSION_STR and "dev" not in PYQT_VERSION_STR: |
1853 if "snapshot" not in PYQT_VERSION_STR and "dev" not in PYQT_VERSION_STR: |
1858 if PYQT_VERSION < requiredVersions["pyqt6"]: |
1854 if PYQT_VERSION < requiredVersions["pyqt6"]: |
1874 print("Please install another version.") |
1870 print("Please install another version.") |
1875 exit(4) |
1871 exit(4) |
1876 |
1872 |
1877 # check version of QScintilla |
1873 # check version of QScintilla |
1878 # =========================== |
1874 # =========================== |
1879 from PyQt6.Qsci import QSCINTILLA_VERSION, QSCINTILLA_VERSION_STR |
1875 from PyQt6.Qsci import ( # noqa: I101, I102 |
|
1876 QSCINTILLA_VERSION, |
|
1877 QSCINTILLA_VERSION_STR, |
|
1878 ) |
1880 |
1879 |
1881 print("PyQt6-QScintilla:", QSCINTILLA_VERSION_STR.strip()) |
1880 print("PyQt6-QScintilla:", QSCINTILLA_VERSION_STR.strip()) |
1882 # always assume, that snapshots or dev versions are new enough |
1881 # always assume, that snapshots or dev versions are new enough |
1883 if "snapshot" not in QSCINTILLA_VERSION_STR and "dev" not in QSCINTILLA_VERSION_STR: |
1882 if "snapshot" not in QSCINTILLA_VERSION_STR and "dev" not in QSCINTILLA_VERSION_STR: |
1884 if QSCINTILLA_VERSION < requiredVersions["pyqt6-qscintilla"]: |
1883 if QSCINTILLA_VERSION < requiredVersions["pyqt6-qscintilla"]: |
1902 # print version info for additional modules |
1901 # print version info for additional modules |
1903 with contextlib.suppress(NameError, AttributeError): |
1902 with contextlib.suppress(NameError, AttributeError): |
1904 print("PyQt6-Charts:", QtCharts.PYQT_CHART_VERSION_STR) |
1903 print("PyQt6-Charts:", QtCharts.PYQT_CHART_VERSION_STR) |
1905 |
1904 |
1906 with contextlib.suppress(ImportError, AttributeError): |
1905 with contextlib.suppress(ImportError, AttributeError): |
1907 from PyQt6 import QtWebEngineCore |
1906 from PyQt6 import QtWebEngineCore # noqa: I101, I102 |
1908 |
1907 |
1909 print("PyQt6-WebEngine:", QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR) |
1908 print("PyQt6-WebEngine:", QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR) |
1910 |
1909 |
1911 print() |
1910 print() |
1912 print("All dependencies ok.") |
1911 print("All dependencies ok.") |
1933 @type str |
1932 @type str |
1934 @param mapFunc function to change directory and/or name of the resulting Python file |
1933 @param mapFunc function to change directory and/or name of the resulting Python file |
1935 (defaults to None) |
1934 (defaults to None) |
1936 @type func (optional) |
1935 @type func (optional) |
1937 """ |
1936 """ |
1938 from PyQt6.uic import compileUi |
1937 from PyQt6.uic import compileUi # noqa: I102 |
1939 |
1938 |
1940 py_dir, py_file = os.path.split(ui_path[:-3] + ".py") |
1939 py_dir, py_file = os.path.split(ui_path[:-3] + ".py") |
1941 |
1940 |
1942 # Allow the caller to change the name of the .py file or generate |
1941 # Allow the caller to change the name of the .py file or generate |
1943 # it in a different directory. |
1942 # it in a different directory. |
2074 @param targetPath path the shortcut shall point to |
2073 @param targetPath path the shortcut shall point to |
2075 @type str |
2074 @type str |
2076 @param iconPath path of the icon file |
2075 @param iconPath path of the icon file |
2077 @type str |
2076 @type str |
2078 """ |
2077 """ |
2079 from pywintypes import com_error |
2078 from pywintypes import com_error # noqa: I102 |
2080 from win32com.client import Dispatch |
2079 from win32com.client import Dispatch # noqa: I102 |
2081 |
2080 |
2082 with contextlib.suppress(com_error): |
2081 with contextlib.suppress(com_error): |
2083 shell = Dispatch("WScript.Shell") |
2082 shell = Dispatch("WScript.Shell") |
2084 shortcut = shell.CreateShortCut(linkPath) |
2083 shortcut = shell.CreateShortCut(linkPath) |
2085 shortcut.Targetpath = targetPath |
2084 shortcut.Targetpath = targetPath |