diff -r 29feb4027695 -r 75908476226e scripts/install.py --- a/scripts/install.py Thu May 20 19:22:05 2021 +0200 +++ b/scripts/install.py Thu May 20 19:52:44 2021 +0200 @@ -41,7 +41,7 @@ forceCleanDesktopLinks = False doCompile = True yes2All = False -ignorePyqt5Tools = False +ignorePyqt6Tools = False cfg = {} progLanguages = ["Python", "Ruby", "QSS"] sourceDir = "eric" @@ -65,25 +65,25 @@ # Define blacklisted versions of the prerequisites BlackLists = { "sip": [], - "PyQt5": [], + "PyQt6": [], "QScintilla2": [], } PlatformsBlackLists = { "windows": { "sip": [], - "PyQt5": [], + "PyQt6": [], "QScintilla2": [], }, "linux": { "sip": [], - "PyQt5": [], + "PyQt6": [], "QScintilla2": [], }, "mac": { "sip": [], - "PyQt5": [], + "PyQt6": [], "QScintilla2": [], }, } @@ -162,8 +162,8 @@ print(" --clean-desktop delete desktop links before installation") print(" --no-info don't create the install info file") if sys.platform != "darwin": - print(" --no-tools don't ask for installation of pyqt5-tools" - "/qt5-applications") + print(" --no-tools don't ask for installation of pyqt6-tools" + "/qt6-applications") print(" -x don't perform dependency checks (use on your own" " risk)") print(" -z don't compile the installed python files") @@ -221,7 +221,7 @@ modDir = distutils.sysconfig.get_python_lib(True) pyModDir = modDir - pyqtDataDir = os.path.join(modDir, "PyQt5") + pyqtDataDir = os.path.join(modDir, "PyQt6") if os.path.exists(os.path.join(pyqtDataDir, "qsci")): # it's the installer qtDataDir = pyqtDataDir @@ -517,8 +517,6 @@ "eric7_pluginrepository", "eric7_sqlbrowser", "eric7_iconeditor", "eric7_snap", "eric7_hexeditor", "eric7_browser", "eric7_shell", - # from Python2 era - "eric7_webbrowser", ] try: @@ -586,13 +584,13 @@ "/usr/share/applications/eric7.desktop", "/usr/share/appdata/eric7.appdata.xml", "/usr/share/metainfo/eric7.appdata.xml", - "/usr/share/applications/eric7_browser.desktop", "/usr/share/pixmaps/eric.png", - "/usr/share/pixmaps/ericWeb.png", "/usr/share/icons/eric.png", - "/usr/share/icons/ericWeb.png", - # from Python2 era - "/usr/share/applications/eric7_webbrowser.desktop", + + # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released + #~ "/usr/share/applications/eric7_browser.desktop", + #~ "/usr/share/pixmaps/ericWeb.png", + #~ "/usr/share/icons/ericWeb.png", ]: if os.path.exists(name): os.remove(name) @@ -602,13 +600,13 @@ "~/.local/share/applications/eric7.desktop", "~/.local/share/appdata/eric7.appdata.xml", "~/.local/share/metainfo/eric7.appdata.xml", - "~/.local/share/applications/eric7_browser.desktop", "~/.local/share/pixmaps/eric.png", - "~/.local/share/pixmaps/ericWeb.png", "~/.local/share/icons/eric.png", - "~/.local/share/icons/ericWeb.png", - # from Python2 era - "/usr/share/applications/eric7_webbrowser.desktop", + + # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released + #~ "~/.local/share/applications/eric7_browser.desktop", + #~ "~/.local/share/pixmaps/ericWeb.png", + #~ "~/.local/share/icons/ericWeb.png", ]: path = os.path.expanduser(name) if os.path.exists(path): @@ -711,13 +709,14 @@ wnames = [] for name in ["eric7_api", "eric7_doc"]: wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir, False)) + # TODO: add "eric7_browser" once PyQt 6.2.0/Qt 6.2.0 is released for name in ["eric7_compare", "eric7_configure", "eric7_diff", "eric7_editor", "eric7_hexeditor", "eric7_iconeditor", "eric7_plugininstall", "eric7_pluginrepository", "eric7_pluginuninstall", "eric7_qregularexpression", "eric7_re", "eric7_snap", "eric7_sqlbrowser", "eric7_tray", "eric7_trpreviewer", "eric7_uipreviewer", "eric7_unittest", - "eric7_browser", "eric7_shell", "eric7"]: + "eric7_shell", "eric7"]: wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir)) # set install prefix, if not None @@ -800,10 +799,12 @@ os.path.join(eric7SourceDir, "UI", "data"), os.path.join(cfg['ericDir'], "UI", "data"), ['*.css']) - copyTree( - os.path.join(eric7SourceDir, "WebBrowser"), - os.path.join(cfg['ericDir'], "WebBrowser"), - ['*.xbel', '*.xml', '*.html', '*.png', '*.gif', '*.js']) + # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released + if False: + copyTree( + os.path.join(eric7SourceDir, "WebBrowser"), + os.path.join(cfg['ericDir'], "WebBrowser"), + ['*.xbel', '*.xml', '*.html', '*.png', '*.gif', '*.js']) # copy the wrappers for wname in wnames: @@ -945,9 +946,11 @@ os.makedirs(dst) copyDesktopFile(os.path.join(sourceDir, "linux", "eric7.desktop.in"), os.path.join(dst, "eric7.desktop")) - copyDesktopFile( - os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), - os.path.join(dst, "eric7_browser.desktop")) + # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released + if False: + copyDesktopFile( + os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), + os.path.join(dst, "eric7_browser.desktop")) dst = os.path.normpath( os.path.join(distDir, "usr/share/metainfo")) if not os.path.exists(dst): @@ -973,9 +976,11 @@ shutilCopy( os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), "/usr/share/icons/ericWeb.png") - copyDesktopFile( - os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), - "/usr/share/applications/eric7_browser.desktop") + # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released + if False: + copyDesktopFile( + os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), + "/usr/share/applications/eric7_browser.desktop") elif os.getuid() >= 1000: # it is assumed, that user ids start at 1000 localPath = os.path.join(os.path.expanduser("~"), @@ -1002,9 +1007,11 @@ shutilCopy( os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), os.path.join(localPath, "icons", "ericWeb.png")) - copyDesktopFile( - os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), - os.path.join(localPath, "applications", "eric7_browser.desktop")) + # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released + if False: + copyDesktopFile( + os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), + os.path.join(localPath, "applications", "eric7_browser.desktop")) def createWindowsLinks(): @@ -1447,25 +1454,25 @@ from PyQt6.QtCore import qVersion except ImportError as msg: installed = not isSudo and pipInstall( - "PyQt5>=5.12.1", - "'PyQt5' could not be detected.\nError: {0}".format(msg) + "PyQt6>=6.1.0", + "'PyQt6' could not be detected.\nError: {0}".format(msg) ) if installed: # try to import it again try: from PyQt6.QtCore import qVersion except ImportError as msg: - print('Sorry, please install PyQt5.') + print('Sorry, please install PyQt6.') print('Error: {0}'.format(msg)) exit(1) else: - print('Sorry, please install PyQt5.') + print('Sorry, please install PyQt6.') print('Error: {0}'.format(msg)) exit(1) - print("Found PyQt5") + print("Found PyQt6") try: - pyuic = "pyuic5" + pyuic = "pyuic6" from PyQt6 import uic # __IGNORE_WARNING__ except ImportError as msg: print("Sorry, {0} is not installed.".format(pyuic)) @@ -1473,29 +1480,28 @@ exit(1) print("Found {0}".format(pyuic)) - try: - from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__ - except ImportError as msg: - from PyQt6.QtCore import PYQT_VERSION - if PYQT_VERSION >= 0x050c00: - # PyQt 5.12 separated QtWebEngine into a separate wheel + # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released + if False: + try: + from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__ + except ImportError as msg: if isSudo: - print("Optional 'PyQtWebEngine' could not be detected.") + print("Optional 'PyQt6-WebEngine' could not be detected.") else: pipInstall( - "PyQtWebEngine>=5.12.1", - "Optional 'PyQtWebEngine' could not be detected.\n" + "PyQt6-WebEngine>=6.2.0", + "Optional 'PyQt6-WebEngine' could not be detected.\n" "Error: {0}".format(msg) ) try: - from PyQt6 import QtChart # __IGNORE_WARNING__ + from PyQt6 import QtCharts # __IGNORE_WARNING__ except ImportError as msg: if isSudo: - print("Optional 'PyQtChart' could not be detected.") + print("Optional 'PyQt6-Charts' could not be detected.") else: pipInstall( - "PyQtChart>=5.12.1", + "PyQt6-Charts>=6.1.0", "Optional 'PyQtChart' could not be detected.\n" "Error: {0}".format(msg) ) @@ -1504,8 +1510,8 @@ from PyQt6 import Qsci # __IGNORE_WARNING__ except ImportError as msg: installed = not isSudo and pipInstall( - "QScintilla", - "'QScintilla' could not be detected.\nError: {0}".format(msg) + "PyQt6-QScintilla", + "'PyQt6-QScintilla' could not be detected.\nError: {0}".format(msg) ) if installed: # try to import it again @@ -1515,22 +1521,23 @@ except ImportError as msg: message = str(msg) else: - message = "QScintilla could not be installed." + message = "PyQt6-QScintilla could not be installed." if message: print("Sorry, please install QScintilla2 and") - print("its PyQt5 wrapper.") + print("its PyQt6 wrapper.") print('Error: {0}'.format(message)) exit(1) - print("Found QScintilla2") + print("Found PyQt6-QScintilla") impModulesList = [ - "PyQt5.QtGui", "PyQt5.QtNetwork", "PyQt5.QtPrintSupport", - "PyQt5.QtSql", "PyQt5.QtSvg", "PyQt5.QtWidgets", + "PyQt6.QtGui", "PyQt6.QtNetwork", "PyQt6.QtPrintSupport", + "PyQt6.QtSql", "PyQt6.QtSvg", "PyQt6.QtSvgWidgets", "PyQt6.QtWidgets", ] altModulesList = [ # Tuple with alternatives, flag indicating it's ok to not be # available (e.g. for 32-Bit Windows) - (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32), + # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released + #~ (("PyQt6.QtWebEngineWidgets", ), sys.maxsize <= 2**32), ] optionalModulesList = { # key is pip project name @@ -1548,9 +1555,10 @@ "pyenchant": ("enchant", ""), } # dict with tuples of package name and install constraint - if sys.platform != "darwin" and not ignorePyqt5Tools: - optionalModulesList["qt5-applications"] = ("qt5_applications", - "<5.15.2") + # TODO: enable this once qt6_applications is released + if False: + if sys.platform != "darwin" and not ignorePyqt6Tools: + optionalModulesList["qt6-applications"] = ("qt6_applications", "") # check mandatory modules modulesOK = True @@ -1611,8 +1619,8 @@ qtMajor = int(qVersion().split('.')[0]) qtMinor = int(qVersion().split('.')[1]) print("Qt Version: {0}".format(qVersion().strip())) - if qtMajor == 5 and qtMinor < 12: - print('Sorry, you must have Qt version 5.12.0 or better.') + if qtMajor == 6 and qtMinor < 1: + print('Sorry, you must have Qt version 6.1.0 or better.') exit(2) # check version of sip @@ -1627,16 +1635,16 @@ if "snapshot" not in sipVersion and "dev" not in sipVersion: while sipVersion.count('.') < 2: sipVersion += '.0' - (major, minor, pat) = sipVersion.split('.') + (major, minor, pat) = sipVersion.split('.')[:3] major = int(major) minor = int(minor) pat = int(pat) if ( - major < 5 or - (major == 5 and minor < 0) or - (major == 5 and minor == 0 and pat < 0) + major < 6 or + (major == 6 and minor < 0) or + (major == 6 and minor == 1 and pat < 0) ): - print('Sorry, you must have sip 5.0.0 or higher or' + print('Sorry, you must have sip 6.1.0 or higher or' ' a recent snapshot release.') exit(3) # check for blacklisted versions @@ -1656,16 +1664,16 @@ if "snapshot" not in pyqtVersion and "dev" not in pyqtVersion: while pyqtVersion.count('.') < 2: pyqtVersion += '.0' - (major, minor, pat) = pyqtVersion.split('.') + (major, minor, pat) = pyqtVersion.split('.')[:3] major = int(major) minor = int(minor) pat = int(pat) - if major == 5 and minor < 12: - print('Sorry, you must have PyQt 5.12.0 or better or' + if major == 6 and minor < 1: + print('Sorry, you must have PyQt 6.1.0 or better or' ' a recent snapshot release.') exit(4) # check for blacklisted versions - for vers in BlackLists["PyQt5"] + PlatformBlackLists["PyQt5"]: + for vers in BlackLists["PyQt6"] + PlatformBlackLists["PyQt6"]: if vers == pyqtVersion: print('Sorry, PyQt version {0} is not compatible with eric.' .format(vers)) @@ -1675,21 +1683,22 @@ # check version of QScintilla from PyQt6.Qsci import QSCINTILLA_VERSION_STR scintillaVersion = QSCINTILLA_VERSION_STR - print("QScintilla Version:", QSCINTILLA_VERSION_STR.strip()) + print("PyQt6-QScintilla Version:", QSCINTILLA_VERSION_STR.strip()) # always assume, that snapshots or dev versions are new enough if "snapshot" not in scintillaVersion and "dev" not in scintillaVersion: while scintillaVersion.count('.') < 2: scintillaVersion += '.0' - (major, minor, pat) = scintillaVersion.split('.') + (major, minor, pat) = scintillaVersion.split('.')[:3] major = int(major) minor = int(minor) pat = int(pat) if ( major < 2 or - (major == 2 and minor < 11) or - (major == 2 and minor == 11 and pat < 1) + (major == 2 and minor < 12) or + # TODO: raise pat once QScintilla 2.12.2 is released + (major == 2 and minor == 12 and pat < 1) ): - print('Sorry, you must have QScintilla 2.11.1 or higher or' + print('Sorry, you must have PyQt6-QScintilla 2.12.1 or higher or' ' a recent snapshot release.') exit(5) # check for blacklisted versions @@ -1706,11 +1715,11 @@ # print version info for additional modules with contextlib.suppress(NameError, AttributeError): - print("PyQtChart:", QtChart.PYQT_CHART_VERSION_STR) + print("PyQt6-Chart:", QtCharts.PYQT_CHART_VERSION_STR) with contextlib.suppress(ImportError, AttributeError): from PyQt6 import QtWebEngine - print("PyQtWebEngine.", QtWebEngine.PYQT_WEBENGINE_VERSION_STR) + print("PyQt6-WebEngine.", QtWebEngine.PYQT_WEBENGINE_VERSION_STR) print("All dependencies ok.") print() @@ -1841,9 +1850,10 @@ ("eric7 (Python {0}.{1}).lnk", os.path.join(cfg["bindir"], "eric7.cmd"), os.path.join(cfg["ericPixDir"], "eric7.ico")), - ("eric7 Browser (Python {0}.{1}).lnk", - os.path.join(cfg["bindir"], "eric7_browse.cmd"), - os.path.join(cfg["ericPixDir"], "ericWeb48.ico")), + # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released + #~ ("eric7 Browser (Python {0}.{1}).lnk", + #~ os.path.join(cfg["bindir"], "eric7_browse.cmd"), + #~ os.path.join(cfg["ericPixDir"], "ericWeb48.ico")), ] return [ @@ -1878,7 +1888,7 @@ global macAppBundlePath, macAppBundleName, macPythonExe global installApis, doCleanDesktopLinks, yes2All global createInstallInfoFile, installCwd - global ignorePyqt5Tools + global ignorePyqt6Tools if sys.version_info < (3, 6, 0) or sys.version_info > (3, 99, 99): print('Sorry, eric requires at least Python 3.6 for running.') @@ -1955,7 +1965,7 @@ elif opt == "--yes": yes2All = True elif opt == "--no-tools": - ignorePyqt5Tools = True + ignorePyqt6Tools = True elif opt == "--no-info": createInstallInfoFile = False