scripts/install.py

branch
eric7
changeset 8339
75908476226e
parent 8318
962bce857696
child 8343
242d5dae2937
equal deleted inserted replaced
8338:29feb4027695 8339:75908476226e
39 doCleanup = True 39 doCleanup = True
40 doCleanDesktopLinks = False 40 doCleanDesktopLinks = False
41 forceCleanDesktopLinks = False 41 forceCleanDesktopLinks = False
42 doCompile = True 42 doCompile = True
43 yes2All = False 43 yes2All = False
44 ignorePyqt5Tools = False 44 ignorePyqt6Tools = False
45 cfg = {} 45 cfg = {}
46 progLanguages = ["Python", "Ruby", "QSS"] 46 progLanguages = ["Python", "Ruby", "QSS"]
47 sourceDir = "eric" 47 sourceDir = "eric"
48 eric7SourceDir = os.path.join(sourceDir, "eric7") 48 eric7SourceDir = os.path.join(sourceDir, "eric7")
49 configName = 'eric7config.py' 49 configName = 'eric7config.py'
63 installCwd = "" 63 installCwd = ""
64 64
65 # Define blacklisted versions of the prerequisites 65 # Define blacklisted versions of the prerequisites
66 BlackLists = { 66 BlackLists = {
67 "sip": [], 67 "sip": [],
68 "PyQt5": [], 68 "PyQt6": [],
69 "QScintilla2": [], 69 "QScintilla2": [],
70 } 70 }
71 PlatformsBlackLists = { 71 PlatformsBlackLists = {
72 "windows": { 72 "windows": {
73 "sip": [], 73 "sip": [],
74 "PyQt5": [], 74 "PyQt6": [],
75 "QScintilla2": [], 75 "QScintilla2": [],
76 }, 76 },
77 77
78 "linux": { 78 "linux": {
79 "sip": [], 79 "sip": [],
80 "PyQt5": [], 80 "PyQt6": [],
81 "QScintilla2": [], 81 "QScintilla2": [],
82 }, 82 },
83 83
84 "mac": { 84 "mac": {
85 "sip": [], 85 "sip": [],
86 "PyQt5": [], 86 "PyQt6": [],
87 "QScintilla2": [], 87 "QScintilla2": [],
88 }, 88 },
89 } 89 }
90 90
91 91
160 print(" -c don't cleanup old installation first") 160 print(" -c don't cleanup old installation first")
161 if sys.platform.startswith(("win", "cygwin")): 161 if sys.platform.startswith(("win", "cygwin")):
162 print(" --clean-desktop delete desktop links before installation") 162 print(" --clean-desktop delete desktop links before installation")
163 print(" --no-info don't create the install info file") 163 print(" --no-info don't create the install info file")
164 if sys.platform != "darwin": 164 if sys.platform != "darwin":
165 print(" --no-tools don't ask for installation of pyqt5-tools" 165 print(" --no-tools don't ask for installation of pyqt6-tools"
166 "/qt5-applications") 166 "/qt6-applications")
167 print(" -x don't perform dependency checks (use on your own" 167 print(" -x don't perform dependency checks (use on your own"
168 " risk)") 168 " risk)")
169 print(" -z don't compile the installed python files") 169 print(" -z don't compile the installed python files")
170 print(" --yes answer 'yes' to all questions") 170 print(" --yes answer 'yes' to all questions")
171 print() 171 print()
219 platBinDirOld = "/usr/local/bin" 219 platBinDirOld = "/usr/local/bin"
220 220
221 modDir = distutils.sysconfig.get_python_lib(True) 221 modDir = distutils.sysconfig.get_python_lib(True)
222 pyModDir = modDir 222 pyModDir = modDir
223 223
224 pyqtDataDir = os.path.join(modDir, "PyQt5") 224 pyqtDataDir = os.path.join(modDir, "PyQt6")
225 if os.path.exists(os.path.join(pyqtDataDir, "qsci")): 225 if os.path.exists(os.path.join(pyqtDataDir, "qsci")):
226 # it's the installer 226 # it's the installer
227 qtDataDir = pyqtDataDir 227 qtDataDir = pyqtDataDir
228 elif os.path.exists(os.path.join(pyqtDataDir, "Qt", "qsci")): 228 elif os.path.exists(os.path.join(pyqtDataDir, "Qt", "qsci")):
229 # it's the wheel 229 # it's the wheel
515 "eric7_tray", "eric7_editor", 515 "eric7_tray", "eric7_editor",
516 "eric7_plugininstall", "eric7_pluginuninstall", 516 "eric7_plugininstall", "eric7_pluginuninstall",
517 "eric7_pluginrepository", "eric7_sqlbrowser", 517 "eric7_pluginrepository", "eric7_sqlbrowser",
518 "eric7_iconeditor", "eric7_snap", "eric7_hexeditor", 518 "eric7_iconeditor", "eric7_snap", "eric7_hexeditor",
519 "eric7_browser", "eric7_shell", 519 "eric7_browser", "eric7_shell",
520 # from Python2 era
521 "eric7_webbrowser",
522 ] 520 ]
523 521
524 try: 522 try:
525 dirs = [platBinDir, getConfig('bindir')] 523 dirs = [platBinDir, getConfig('bindir')]
526 if platBinDirOld: 524 if platBinDirOld:
584 if os.getuid() == 0: 582 if os.getuid() == 0:
585 for name in [ 583 for name in [
586 "/usr/share/applications/eric7.desktop", 584 "/usr/share/applications/eric7.desktop",
587 "/usr/share/appdata/eric7.appdata.xml", 585 "/usr/share/appdata/eric7.appdata.xml",
588 "/usr/share/metainfo/eric7.appdata.xml", 586 "/usr/share/metainfo/eric7.appdata.xml",
589 "/usr/share/applications/eric7_browser.desktop",
590 "/usr/share/pixmaps/eric.png", 587 "/usr/share/pixmaps/eric.png",
591 "/usr/share/pixmaps/ericWeb.png",
592 "/usr/share/icons/eric.png", 588 "/usr/share/icons/eric.png",
593 "/usr/share/icons/ericWeb.png", 589
594 # from Python2 era 590 # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released
595 "/usr/share/applications/eric7_webbrowser.desktop", 591 #~ "/usr/share/applications/eric7_browser.desktop",
592 #~ "/usr/share/pixmaps/ericWeb.png",
593 #~ "/usr/share/icons/ericWeb.png",
596 ]: 594 ]:
597 if os.path.exists(name): 595 if os.path.exists(name):
598 os.remove(name) 596 os.remove(name)
599 elif os.getuid() >= 1000: 597 elif os.getuid() >= 1000:
600 # it is assumed that user ids start at 1000 598 # it is assumed that user ids start at 1000
601 for name in [ 599 for name in [
602 "~/.local/share/applications/eric7.desktop", 600 "~/.local/share/applications/eric7.desktop",
603 "~/.local/share/appdata/eric7.appdata.xml", 601 "~/.local/share/appdata/eric7.appdata.xml",
604 "~/.local/share/metainfo/eric7.appdata.xml", 602 "~/.local/share/metainfo/eric7.appdata.xml",
605 "~/.local/share/applications/eric7_browser.desktop",
606 "~/.local/share/pixmaps/eric.png", 603 "~/.local/share/pixmaps/eric.png",
607 "~/.local/share/pixmaps/ericWeb.png",
608 "~/.local/share/icons/eric.png", 604 "~/.local/share/icons/eric.png",
609 "~/.local/share/icons/ericWeb.png", 605
610 # from Python2 era 606 # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released
611 "/usr/share/applications/eric7_webbrowser.desktop", 607 #~ "~/.local/share/applications/eric7_browser.desktop",
608 #~ "~/.local/share/pixmaps/ericWeb.png",
609 #~ "~/.local/share/icons/ericWeb.png",
612 ]: 610 ]:
613 path = os.path.expanduser(name) 611 path = os.path.expanduser(name)
614 if os.path.exists(path): 612 if os.path.exists(path):
615 os.remove(path) 613 os.remove(path)
616 614
709 if not os.path.isdir(scriptsDir): 707 if not os.path.isdir(scriptsDir):
710 os.mkdir(scriptsDir) 708 os.mkdir(scriptsDir)
711 wnames = [] 709 wnames = []
712 for name in ["eric7_api", "eric7_doc"]: 710 for name in ["eric7_api", "eric7_doc"]:
713 wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir, False)) 711 wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir, False))
712 # TODO: add "eric7_browser" once PyQt 6.2.0/Qt 6.2.0 is released
714 for name in ["eric7_compare", "eric7_configure", "eric7_diff", 713 for name in ["eric7_compare", "eric7_configure", "eric7_diff",
715 "eric7_editor", "eric7_hexeditor", "eric7_iconeditor", 714 "eric7_editor", "eric7_hexeditor", "eric7_iconeditor",
716 "eric7_plugininstall", "eric7_pluginrepository", 715 "eric7_plugininstall", "eric7_pluginrepository",
717 "eric7_pluginuninstall", "eric7_qregularexpression", 716 "eric7_pluginuninstall", "eric7_qregularexpression",
718 "eric7_re", "eric7_snap", "eric7_sqlbrowser", "eric7_tray", 717 "eric7_re", "eric7_snap", "eric7_sqlbrowser", "eric7_tray",
719 "eric7_trpreviewer", "eric7_uipreviewer", "eric7_unittest", 718 "eric7_trpreviewer", "eric7_uipreviewer", "eric7_unittest",
720 "eric7_browser", "eric7_shell", "eric7"]: 719 "eric7_shell", "eric7"]:
721 wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir)) 720 wnames.append(createPyWrapper(cfg['ericDir'], name, scriptsDir))
722 721
723 # set install prefix, if not None 722 # set install prefix, if not None
724 if distDir: 723 if distDir:
725 for key in list(cfg.keys()): 724 for key in list(cfg.keys()):
798 ['*.xpm']) 797 ['*.xpm'])
799 copyTree( 798 copyTree(
800 os.path.join(eric7SourceDir, "UI", "data"), 799 os.path.join(eric7SourceDir, "UI", "data"),
801 os.path.join(cfg['ericDir'], "UI", "data"), 800 os.path.join(cfg['ericDir'], "UI", "data"),
802 ['*.css']) 801 ['*.css'])
803 copyTree( 802 # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released
804 os.path.join(eric7SourceDir, "WebBrowser"), 803 if False:
805 os.path.join(cfg['ericDir'], "WebBrowser"), 804 copyTree(
806 ['*.xbel', '*.xml', '*.html', '*.png', '*.gif', '*.js']) 805 os.path.join(eric7SourceDir, "WebBrowser"),
806 os.path.join(cfg['ericDir'], "WebBrowser"),
807 ['*.xbel', '*.xml', '*.html', '*.png', '*.gif', '*.js'])
807 808
808 # copy the wrappers 809 # copy the wrappers
809 for wname in wnames: 810 for wname in wnames:
810 shutilCopy(wname, cfg['bindir'], perm=0o755) 811 shutilCopy(wname, cfg['bindir'], perm=0o755)
811 os.remove(wname) 812 os.remove(wname)
943 os.path.join(distDir, "usr/share/applications")) 944 os.path.join(distDir, "usr/share/applications"))
944 if not os.path.exists(dst): 945 if not os.path.exists(dst):
945 os.makedirs(dst) 946 os.makedirs(dst)
946 copyDesktopFile(os.path.join(sourceDir, "linux", "eric7.desktop.in"), 947 copyDesktopFile(os.path.join(sourceDir, "linux", "eric7.desktop.in"),
947 os.path.join(dst, "eric7.desktop")) 948 os.path.join(dst, "eric7.desktop"))
948 copyDesktopFile( 949 # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released
949 os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), 950 if False:
950 os.path.join(dst, "eric7_browser.desktop")) 951 copyDesktopFile(
952 os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"),
953 os.path.join(dst, "eric7_browser.desktop"))
951 dst = os.path.normpath( 954 dst = os.path.normpath(
952 os.path.join(distDir, "usr/share/metainfo")) 955 os.path.join(distDir, "usr/share/metainfo"))
953 if not os.path.exists(dst): 956 if not os.path.exists(dst):
954 os.makedirs(dst) 957 os.makedirs(dst)
955 copyAppStreamFile( 958 copyAppStreamFile(
971 os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"), 974 os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"),
972 "/usr/share/appdata/eric7.appdata.xml") 975 "/usr/share/appdata/eric7.appdata.xml")
973 shutilCopy( 976 shutilCopy(
974 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), 977 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
975 "/usr/share/icons/ericWeb.png") 978 "/usr/share/icons/ericWeb.png")
976 copyDesktopFile( 979 # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released
977 os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), 980 if False:
978 "/usr/share/applications/eric7_browser.desktop") 981 copyDesktopFile(
982 os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"),
983 "/usr/share/applications/eric7_browser.desktop")
979 elif os.getuid() >= 1000: 984 elif os.getuid() >= 1000:
980 # it is assumed, that user ids start at 1000 985 # it is assumed, that user ids start at 1000
981 localPath = os.path.join(os.path.expanduser("~"), 986 localPath = os.path.join(os.path.expanduser("~"),
982 ".local", "share") 987 ".local", "share")
983 # create directories first 988 # create directories first
1000 os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"), 1005 os.path.join(sourceDir, "linux", "eric7.appdata.xml.in"),
1001 os.path.join(localPath, "appdata", "eric7.appdata.xml")) 1006 os.path.join(localPath, "appdata", "eric7.appdata.xml"))
1002 shutilCopy( 1007 shutilCopy(
1003 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"), 1008 os.path.join(eric7SourceDir, "pixmaps", "ericWeb48_icon.png"),
1004 os.path.join(localPath, "icons", "ericWeb.png")) 1009 os.path.join(localPath, "icons", "ericWeb.png"))
1005 copyDesktopFile( 1010 # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released
1006 os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"), 1011 if False:
1007 os.path.join(localPath, "applications", "eric7_browser.desktop")) 1012 copyDesktopFile(
1013 os.path.join(sourceDir, "linux", "eric7_browser.desktop.in"),
1014 os.path.join(localPath, "applications", "eric7_browser.desktop"))
1008 1015
1009 1016
1010 def createWindowsLinks(): 1017 def createWindowsLinks():
1011 """ 1018 """
1012 Create Desktop and Start Menu links. 1019 Create Desktop and Start Menu links.
1445 1452
1446 try: 1453 try:
1447 from PyQt6.QtCore import qVersion 1454 from PyQt6.QtCore import qVersion
1448 except ImportError as msg: 1455 except ImportError as msg:
1449 installed = not isSudo and pipInstall( 1456 installed = not isSudo and pipInstall(
1450 "PyQt5>=5.12.1", 1457 "PyQt6>=6.1.0",
1451 "'PyQt5' could not be detected.\nError: {0}".format(msg) 1458 "'PyQt6' could not be detected.\nError: {0}".format(msg)
1452 ) 1459 )
1453 if installed: 1460 if installed:
1454 # try to import it again 1461 # try to import it again
1455 try: 1462 try:
1456 from PyQt6.QtCore import qVersion 1463 from PyQt6.QtCore import qVersion
1457 except ImportError as msg: 1464 except ImportError as msg:
1458 print('Sorry, please install PyQt5.') 1465 print('Sorry, please install PyQt6.')
1459 print('Error: {0}'.format(msg)) 1466 print('Error: {0}'.format(msg))
1460 exit(1) 1467 exit(1)
1461 else: 1468 else:
1462 print('Sorry, please install PyQt5.') 1469 print('Sorry, please install PyQt6.')
1463 print('Error: {0}'.format(msg)) 1470 print('Error: {0}'.format(msg))
1464 exit(1) 1471 exit(1)
1465 print("Found PyQt5") 1472 print("Found PyQt6")
1466 1473
1467 try: 1474 try:
1468 pyuic = "pyuic5" 1475 pyuic = "pyuic6"
1469 from PyQt6 import uic # __IGNORE_WARNING__ 1476 from PyQt6 import uic # __IGNORE_WARNING__
1470 except ImportError as msg: 1477 except ImportError as msg:
1471 print("Sorry, {0} is not installed.".format(pyuic)) 1478 print("Sorry, {0} is not installed.".format(pyuic))
1472 print('Error: {0}'.format(msg)) 1479 print('Error: {0}'.format(msg))
1473 exit(1) 1480 exit(1)
1474 print("Found {0}".format(pyuic)) 1481 print("Found {0}".format(pyuic))
1475 1482
1476 try: 1483 # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released
1477 from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__ 1484 if False:
1478 except ImportError as msg: 1485 try:
1479 from PyQt6.QtCore import PYQT_VERSION 1486 from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__
1480 if PYQT_VERSION >= 0x050c00: 1487 except ImportError as msg:
1481 # PyQt 5.12 separated QtWebEngine into a separate wheel
1482 if isSudo: 1488 if isSudo:
1483 print("Optional 'PyQtWebEngine' could not be detected.") 1489 print("Optional 'PyQt6-WebEngine' could not be detected.")
1484 else: 1490 else:
1485 pipInstall( 1491 pipInstall(
1486 "PyQtWebEngine>=5.12.1", 1492 "PyQt6-WebEngine>=6.2.0",
1487 "Optional 'PyQtWebEngine' could not be detected.\n" 1493 "Optional 'PyQt6-WebEngine' could not be detected.\n"
1488 "Error: {0}".format(msg) 1494 "Error: {0}".format(msg)
1489 ) 1495 )
1490 1496
1491 try: 1497 try:
1492 from PyQt6 import QtChart # __IGNORE_WARNING__ 1498 from PyQt6 import QtCharts # __IGNORE_WARNING__
1493 except ImportError as msg: 1499 except ImportError as msg:
1494 if isSudo: 1500 if isSudo:
1495 print("Optional 'PyQtChart' could not be detected.") 1501 print("Optional 'PyQt6-Charts' could not be detected.")
1496 else: 1502 else:
1497 pipInstall( 1503 pipInstall(
1498 "PyQtChart>=5.12.1", 1504 "PyQt6-Charts>=6.1.0",
1499 "Optional 'PyQtChart' could not be detected.\n" 1505 "Optional 'PyQtChart' could not be detected.\n"
1500 "Error: {0}".format(msg) 1506 "Error: {0}".format(msg)
1501 ) 1507 )
1502 1508
1503 try: 1509 try:
1504 from PyQt6 import Qsci # __IGNORE_WARNING__ 1510 from PyQt6 import Qsci # __IGNORE_WARNING__
1505 except ImportError as msg: 1511 except ImportError as msg:
1506 installed = not isSudo and pipInstall( 1512 installed = not isSudo and pipInstall(
1507 "QScintilla", 1513 "PyQt6-QScintilla",
1508 "'QScintilla' could not be detected.\nError: {0}".format(msg) 1514 "'PyQt6-QScintilla' could not be detected.\nError: {0}".format(msg)
1509 ) 1515 )
1510 if installed: 1516 if installed:
1511 # try to import it again 1517 # try to import it again
1512 try: 1518 try:
1513 from PyQt6 import Qsci # __IGNORE_WARNING__ 1519 from PyQt6 import Qsci # __IGNORE_WARNING__
1514 message = None 1520 message = None
1515 except ImportError as msg: 1521 except ImportError as msg:
1516 message = str(msg) 1522 message = str(msg)
1517 else: 1523 else:
1518 message = "QScintilla could not be installed." 1524 message = "PyQt6-QScintilla could not be installed."
1519 if message: 1525 if message:
1520 print("Sorry, please install QScintilla2 and") 1526 print("Sorry, please install QScintilla2 and")
1521 print("its PyQt5 wrapper.") 1527 print("its PyQt6 wrapper.")
1522 print('Error: {0}'.format(message)) 1528 print('Error: {0}'.format(message))
1523 exit(1) 1529 exit(1)
1524 print("Found QScintilla2") 1530 print("Found PyQt6-QScintilla")
1525 1531
1526 impModulesList = [ 1532 impModulesList = [
1527 "PyQt5.QtGui", "PyQt5.QtNetwork", "PyQt5.QtPrintSupport", 1533 "PyQt6.QtGui", "PyQt6.QtNetwork", "PyQt6.QtPrintSupport",
1528 "PyQt5.QtSql", "PyQt5.QtSvg", "PyQt5.QtWidgets", 1534 "PyQt6.QtSql", "PyQt6.QtSvg", "PyQt6.QtSvgWidgets", "PyQt6.QtWidgets",
1529 ] 1535 ]
1530 altModulesList = [ 1536 altModulesList = [
1531 # Tuple with alternatives, flag indicating it's ok to not be 1537 # Tuple with alternatives, flag indicating it's ok to not be
1532 # available (e.g. for 32-Bit Windows) 1538 # available (e.g. for 32-Bit Windows)
1533 (("PyQt5.QtWebEngineWidgets", ), sys.maxsize <= 2**32), 1539 # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released
1540 #~ (("PyQt6.QtWebEngineWidgets", ), sys.maxsize <= 2**32),
1534 ] 1541 ]
1535 optionalModulesList = { 1542 optionalModulesList = {
1536 # key is pip project name 1543 # key is pip project name
1537 # value is tuple of package name, pip install constraint 1544 # value is tuple of package name, pip install constraint
1538 "docutils": ("docutils", ""), 1545 "docutils": ("docutils", ""),
1546 "Pygments": ("pygments", ""), 1553 "Pygments": ("pygments", ""),
1547 "mercurial": ("mercurial", ""), 1554 "mercurial": ("mercurial", ""),
1548 "pyenchant": ("enchant", ""), 1555 "pyenchant": ("enchant", ""),
1549 } 1556 }
1550 # dict with tuples of package name and install constraint 1557 # dict with tuples of package name and install constraint
1551 if sys.platform != "darwin" and not ignorePyqt5Tools: 1558 # TODO: enable this once qt6_applications is released
1552 optionalModulesList["qt5-applications"] = ("qt5_applications", 1559 if False:
1553 "<5.15.2") 1560 if sys.platform != "darwin" and not ignorePyqt6Tools:
1561 optionalModulesList["qt6-applications"] = ("qt6_applications", "")
1554 1562
1555 # check mandatory modules 1563 # check mandatory modules
1556 modulesOK = True 1564 modulesOK = True
1557 for impModule in impModulesList: 1565 for impModule in impModulesList:
1558 name = impModule.split(".")[1] 1566 name = impModule.split(".")[1]
1609 1617
1610 # check version of Qt 1618 # check version of Qt
1611 qtMajor = int(qVersion().split('.')[0]) 1619 qtMajor = int(qVersion().split('.')[0])
1612 qtMinor = int(qVersion().split('.')[1]) 1620 qtMinor = int(qVersion().split('.')[1])
1613 print("Qt Version: {0}".format(qVersion().strip())) 1621 print("Qt Version: {0}".format(qVersion().strip()))
1614 if qtMajor == 5 and qtMinor < 12: 1622 if qtMajor == 6 and qtMinor < 1:
1615 print('Sorry, you must have Qt version 5.12.0 or better.') 1623 print('Sorry, you must have Qt version 6.1.0 or better.')
1616 exit(2) 1624 exit(2)
1617 1625
1618 # check version of sip 1626 # check version of sip
1619 with contextlib.suppress(ImportError, AttributeError): 1627 with contextlib.suppress(ImportError, AttributeError):
1620 try: 1628 try:
1625 print("sip Version:", sipVersion.strip()) 1633 print("sip Version:", sipVersion.strip())
1626 # always assume, that snapshots or dev versions are new enough 1634 # always assume, that snapshots or dev versions are new enough
1627 if "snapshot" not in sipVersion and "dev" not in sipVersion: 1635 if "snapshot" not in sipVersion and "dev" not in sipVersion:
1628 while sipVersion.count('.') < 2: 1636 while sipVersion.count('.') < 2:
1629 sipVersion += '.0' 1637 sipVersion += '.0'
1630 (major, minor, pat) = sipVersion.split('.') 1638 (major, minor, pat) = sipVersion.split('.')[:3]
1631 major = int(major) 1639 major = int(major)
1632 minor = int(minor) 1640 minor = int(minor)
1633 pat = int(pat) 1641 pat = int(pat)
1634 if ( 1642 if (
1635 major < 5 or 1643 major < 6 or
1636 (major == 5 and minor < 0) or 1644 (major == 6 and minor < 0) or
1637 (major == 5 and minor == 0 and pat < 0) 1645 (major == 6 and minor == 1 and pat < 0)
1638 ): 1646 ):
1639 print('Sorry, you must have sip 5.0.0 or higher or' 1647 print('Sorry, you must have sip 6.1.0 or higher or'
1640 ' a recent snapshot release.') 1648 ' a recent snapshot release.')
1641 exit(3) 1649 exit(3)
1642 # check for blacklisted versions 1650 # check for blacklisted versions
1643 for vers in BlackLists["sip"] + PlatformBlackLists["sip"]: 1651 for vers in BlackLists["sip"] + PlatformBlackLists["sip"]:
1644 if vers == sipVersion: 1652 if vers == sipVersion:
1654 print("PyQt Version:", pyqtVersion.strip()) 1662 print("PyQt Version:", pyqtVersion.strip())
1655 # always assume, that snapshots or dev versions are new enough 1663 # always assume, that snapshots or dev versions are new enough
1656 if "snapshot" not in pyqtVersion and "dev" not in pyqtVersion: 1664 if "snapshot" not in pyqtVersion and "dev" not in pyqtVersion:
1657 while pyqtVersion.count('.') < 2: 1665 while pyqtVersion.count('.') < 2:
1658 pyqtVersion += '.0' 1666 pyqtVersion += '.0'
1659 (major, minor, pat) = pyqtVersion.split('.') 1667 (major, minor, pat) = pyqtVersion.split('.')[:3]
1660 major = int(major) 1668 major = int(major)
1661 minor = int(minor) 1669 minor = int(minor)
1662 pat = int(pat) 1670 pat = int(pat)
1663 if major == 5 and minor < 12: 1671 if major == 6 and minor < 1:
1664 print('Sorry, you must have PyQt 5.12.0 or better or' 1672 print('Sorry, you must have PyQt 6.1.0 or better or'
1665 ' a recent snapshot release.') 1673 ' a recent snapshot release.')
1666 exit(4) 1674 exit(4)
1667 # check for blacklisted versions 1675 # check for blacklisted versions
1668 for vers in BlackLists["PyQt5"] + PlatformBlackLists["PyQt5"]: 1676 for vers in BlackLists["PyQt6"] + PlatformBlackLists["PyQt6"]:
1669 if vers == pyqtVersion: 1677 if vers == pyqtVersion:
1670 print('Sorry, PyQt version {0} is not compatible with eric.' 1678 print('Sorry, PyQt version {0} is not compatible with eric.'
1671 .format(vers)) 1679 .format(vers))
1672 print('Please install another version.') 1680 print('Please install another version.')
1673 exit(4) 1681 exit(4)
1674 1682
1675 # check version of QScintilla 1683 # check version of QScintilla
1676 from PyQt6.Qsci import QSCINTILLA_VERSION_STR 1684 from PyQt6.Qsci import QSCINTILLA_VERSION_STR
1677 scintillaVersion = QSCINTILLA_VERSION_STR 1685 scintillaVersion = QSCINTILLA_VERSION_STR
1678 print("QScintilla Version:", QSCINTILLA_VERSION_STR.strip()) 1686 print("PyQt6-QScintilla Version:", QSCINTILLA_VERSION_STR.strip())
1679 # always assume, that snapshots or dev versions are new enough 1687 # always assume, that snapshots or dev versions are new enough
1680 if "snapshot" not in scintillaVersion and "dev" not in scintillaVersion: 1688 if "snapshot" not in scintillaVersion and "dev" not in scintillaVersion:
1681 while scintillaVersion.count('.') < 2: 1689 while scintillaVersion.count('.') < 2:
1682 scintillaVersion += '.0' 1690 scintillaVersion += '.0'
1683 (major, minor, pat) = scintillaVersion.split('.') 1691 (major, minor, pat) = scintillaVersion.split('.')[:3]
1684 major = int(major) 1692 major = int(major)
1685 minor = int(minor) 1693 minor = int(minor)
1686 pat = int(pat) 1694 pat = int(pat)
1687 if ( 1695 if (
1688 major < 2 or 1696 major < 2 or
1689 (major == 2 and minor < 11) or 1697 (major == 2 and minor < 12) or
1690 (major == 2 and minor == 11 and pat < 1) 1698 # TODO: raise pat once QScintilla 2.12.2 is released
1699 (major == 2 and minor == 12 and pat < 1)
1691 ): 1700 ):
1692 print('Sorry, you must have QScintilla 2.11.1 or higher or' 1701 print('Sorry, you must have PyQt6-QScintilla 2.12.1 or higher or'
1693 ' a recent snapshot release.') 1702 ' a recent snapshot release.')
1694 exit(5) 1703 exit(5)
1695 # check for blacklisted versions 1704 # check for blacklisted versions
1696 for vers in ( 1705 for vers in (
1697 BlackLists["QScintilla2"] + 1706 BlackLists["QScintilla2"] +
1704 print('Please install another version.') 1713 print('Please install another version.')
1705 exit(5) 1714 exit(5)
1706 1715
1707 # print version info for additional modules 1716 # print version info for additional modules
1708 with contextlib.suppress(NameError, AttributeError): 1717 with contextlib.suppress(NameError, AttributeError):
1709 print("PyQtChart:", QtChart.PYQT_CHART_VERSION_STR) 1718 print("PyQt6-Chart:", QtCharts.PYQT_CHART_VERSION_STR)
1710 1719
1711 with contextlib.suppress(ImportError, AttributeError): 1720 with contextlib.suppress(ImportError, AttributeError):
1712 from PyQt6 import QtWebEngine 1721 from PyQt6 import QtWebEngine
1713 print("PyQtWebEngine.", QtWebEngine.PYQT_WEBENGINE_VERSION_STR) 1722 print("PyQt6-WebEngine.", QtWebEngine.PYQT_WEBENGINE_VERSION_STR)
1714 1723
1715 print("All dependencies ok.") 1724 print("All dependencies ok.")
1716 print() 1725 print()
1717 1726
1718 1727
1839 majorVersion, minorVersion = sys.version_info[:2] 1848 majorVersion, minorVersion = sys.version_info[:2]
1840 entriesTemplates = [ 1849 entriesTemplates = [
1841 ("eric7 (Python {0}.{1}).lnk", 1850 ("eric7 (Python {0}.{1}).lnk",
1842 os.path.join(cfg["bindir"], "eric7.cmd"), 1851 os.path.join(cfg["bindir"], "eric7.cmd"),
1843 os.path.join(cfg["ericPixDir"], "eric7.ico")), 1852 os.path.join(cfg["ericPixDir"], "eric7.ico")),
1844 ("eric7 Browser (Python {0}.{1}).lnk", 1853 # TODO: enable this once PyQt 6.2.0/Qt 6.2.0 is released
1845 os.path.join(cfg["bindir"], "eric7_browse.cmd"), 1854 #~ ("eric7 Browser (Python {0}.{1}).lnk",
1846 os.path.join(cfg["ericPixDir"], "ericWeb48.ico")), 1855 #~ os.path.join(cfg["bindir"], "eric7_browse.cmd"),
1856 #~ os.path.join(cfg["ericPixDir"], "ericWeb48.ico")),
1847 ] 1857 ]
1848 1858
1849 return [ 1859 return [
1850 (e[0].format(majorVersion, minorVersion), e[1], e[2]) 1860 (e[0].format(majorVersion, minorVersion), e[1], e[2])
1851 for e in entriesTemplates 1861 for e in entriesTemplates
1876 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir 1886 global progName, modDir, doCleanup, doCompile, distDir, cfg, apisDir
1877 global sourceDir, eric7SourceDir, configName 1887 global sourceDir, eric7SourceDir, configName
1878 global macAppBundlePath, macAppBundleName, macPythonExe 1888 global macAppBundlePath, macAppBundleName, macPythonExe
1879 global installApis, doCleanDesktopLinks, yes2All 1889 global installApis, doCleanDesktopLinks, yes2All
1880 global createInstallInfoFile, installCwd 1890 global createInstallInfoFile, installCwd
1881 global ignorePyqt5Tools 1891 global ignorePyqt6Tools
1882 1892
1883 if sys.version_info < (3, 6, 0) or sys.version_info > (3, 99, 99): 1893 if sys.version_info < (3, 6, 0) or sys.version_info > (3, 99, 99):
1884 print('Sorry, eric requires at least Python 3.6 for running.') 1894 print('Sorry, eric requires at least Python 3.6 for running.')
1885 exit(5) 1895 exit(5)
1886 1896
1953 elif opt == "--clean-desktop": 1963 elif opt == "--clean-desktop":
1954 doCleanDesktopLinks = True 1964 doCleanDesktopLinks = True
1955 elif opt == "--yes": 1965 elif opt == "--yes":
1956 yes2All = True 1966 yes2All = True
1957 elif opt == "--no-tools": 1967 elif opt == "--no-tools":
1958 ignorePyqt5Tools = True 1968 ignorePyqt6Tools = True
1959 elif opt == "--no-info": 1969 elif opt == "--no-info":
1960 createInstallInfoFile = False 1970 createInstallInfoFile = False
1961 1971
1962 infoName = "" 1972 infoName = ""
1963 installFromSource = not os.path.isdir(sourceDir) 1973 installFromSource = not os.path.isdir(sourceDir)

eric ide

mercurial