scripts/install.py

branch
eric7
changeset 8318
962bce857696
parent 8314
e3642a6a1e71
child 8339
75908476226e
equal deleted inserted replaced
8316:0c7a44af84bc 8318:962bce857696
229 # it's the wheel 229 # it's the wheel
230 qtDataDir = os.path.join(pyqtDataDir, "Qt") 230 qtDataDir = os.path.join(pyqtDataDir, "Qt")
231 else: 231 else:
232 # determine dynamically 232 # determine dynamically
233 try: 233 try:
234 from PyQt5.QtCore import QLibraryInfo 234 from PyQt6.QtCore import QLibraryInfo
235 qtDataDir = QLibraryInfo.location(QLibraryInfo.DataPath) 235 qtDataDir = QLibraryInfo.path(QLibraryInfo.DataPath)
236 except ImportError: 236 except ImportError:
237 qtDataDir = None 237 qtDataDir = None
238 apisDir = os.path.join(qtDataDir, "qsci", "api") if qtDataDir else None 238 apisDir = os.path.join(qtDataDir, "qsci", "api") if qtDataDir else None
239 239
240 240
1099 wname = os.path.join(directories["exe"], "eric7") 1099 wname = os.path.join(directories["exe"], "eric7")
1100 1100
1101 # determine entry for DYLD_FRAMEWORK_PATH 1101 # determine entry for DYLD_FRAMEWORK_PATH
1102 dyldLine = "" 1102 dyldLine = ""
1103 try: 1103 try:
1104 from PyQt5.QtCore import QLibraryInfo 1104 from PyQt6.QtCore import QLibraryInfo
1105 qtLibraryDir = QLibraryInfo.location(QLibraryInfo.LibrariesPath) 1105 qtLibraryDir = QLibraryInfo.path(QLibraryInfo.LibrariesPath)
1106 except ImportError: 1106 except ImportError:
1107 qtLibraryDir = "" 1107 qtLibraryDir = ""
1108 if qtLibraryDir: 1108 if qtLibraryDir:
1109 dyldLine = "DYLD_FRAMEWORK_PATH={0}\n".format(qtLibraryDir) 1109 dyldLine = "DYLD_FRAMEWORK_PATH={0}\n".format(qtLibraryDir)
1110 1110
1442 print('Your Python installation is missing the XML module.') 1442 print('Your Python installation is missing the XML module.')
1443 print('Please install it and try again.') 1443 print('Please install it and try again.')
1444 exit(5) 1444 exit(5)
1445 1445
1446 try: 1446 try:
1447 from PyQt5.QtCore import qVersion 1447 from PyQt6.QtCore import qVersion
1448 except ImportError as msg: 1448 except ImportError as msg:
1449 installed = not isSudo and pipInstall( 1449 installed = not isSudo and pipInstall(
1450 "PyQt5>=5.12.1", 1450 "PyQt5>=5.12.1",
1451 "'PyQt5' could not be detected.\nError: {0}".format(msg) 1451 "'PyQt5' could not be detected.\nError: {0}".format(msg)
1452 ) 1452 )
1453 if installed: 1453 if installed:
1454 # try to import it again 1454 # try to import it again
1455 try: 1455 try:
1456 from PyQt5.QtCore import qVersion 1456 from PyQt6.QtCore import qVersion
1457 except ImportError as msg: 1457 except ImportError as msg:
1458 print('Sorry, please install PyQt5.') 1458 print('Sorry, please install PyQt5.')
1459 print('Error: {0}'.format(msg)) 1459 print('Error: {0}'.format(msg))
1460 exit(1) 1460 exit(1)
1461 else: 1461 else:
1464 exit(1) 1464 exit(1)
1465 print("Found PyQt5") 1465 print("Found PyQt5")
1466 1466
1467 try: 1467 try:
1468 pyuic = "pyuic5" 1468 pyuic = "pyuic5"
1469 from PyQt5 import uic # __IGNORE_WARNING__ 1469 from PyQt6 import uic # __IGNORE_WARNING__
1470 except ImportError as msg: 1470 except ImportError as msg:
1471 print("Sorry, {0} is not installed.".format(pyuic)) 1471 print("Sorry, {0} is not installed.".format(pyuic))
1472 print('Error: {0}'.format(msg)) 1472 print('Error: {0}'.format(msg))
1473 exit(1) 1473 exit(1)
1474 print("Found {0}".format(pyuic)) 1474 print("Found {0}".format(pyuic))
1475 1475
1476 try: 1476 try:
1477 from PyQt5 import QtWebEngineWidgets # __IGNORE_WARNING__ 1477 from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__
1478 except ImportError as msg: 1478 except ImportError as msg:
1479 from PyQt5.QtCore import PYQT_VERSION 1479 from PyQt6.QtCore import PYQT_VERSION
1480 if PYQT_VERSION >= 0x050c00: 1480 if PYQT_VERSION >= 0x050c00:
1481 # PyQt 5.12 separated QtWebEngine into a separate wheel 1481 # PyQt 5.12 separated QtWebEngine into a separate wheel
1482 if isSudo: 1482 if isSudo:
1483 print("Optional 'PyQtWebEngine' could not be detected.") 1483 print("Optional 'PyQtWebEngine' could not be detected.")
1484 else: 1484 else:
1487 "Optional 'PyQtWebEngine' could not be detected.\n" 1487 "Optional 'PyQtWebEngine' could not be detected.\n"
1488 "Error: {0}".format(msg) 1488 "Error: {0}".format(msg)
1489 ) 1489 )
1490 1490
1491 try: 1491 try:
1492 from PyQt5 import QtChart # __IGNORE_WARNING__ 1492 from PyQt6 import QtChart # __IGNORE_WARNING__
1493 except ImportError as msg: 1493 except ImportError as msg:
1494 if isSudo: 1494 if isSudo:
1495 print("Optional 'PyQtChart' could not be detected.") 1495 print("Optional 'PyQtChart' could not be detected.")
1496 else: 1496 else:
1497 pipInstall( 1497 pipInstall(
1499 "Optional 'PyQtChart' could not be detected.\n" 1499 "Optional 'PyQtChart' could not be detected.\n"
1500 "Error: {0}".format(msg) 1500 "Error: {0}".format(msg)
1501 ) 1501 )
1502 1502
1503 try: 1503 try:
1504 from PyQt5 import Qsci # __IGNORE_WARNING__ 1504 from PyQt6 import Qsci # __IGNORE_WARNING__
1505 except ImportError as msg: 1505 except ImportError as msg:
1506 installed = not isSudo and pipInstall( 1506 installed = not isSudo and pipInstall(
1507 "QScintilla", 1507 "QScintilla",
1508 "'QScintilla' could not be detected.\nError: {0}".format(msg) 1508 "'QScintilla' could not be detected.\nError: {0}".format(msg)
1509 ) 1509 )
1510 if installed: 1510 if installed:
1511 # try to import it again 1511 # try to import it again
1512 try: 1512 try:
1513 from PyQt5 import Qsci # __IGNORE_WARNING__ 1513 from PyQt6 import Qsci # __IGNORE_WARNING__
1514 message = None 1514 message = None
1515 except ImportError as msg: 1515 except ImportError as msg:
1516 message = str(msg) 1516 message = str(msg)
1517 else: 1517 else:
1518 message = "QScintilla could not be installed." 1518 message = "QScintilla could not be installed."
1616 exit(2) 1616 exit(2)
1617 1617
1618 # check version of sip 1618 # check version of sip
1619 with contextlib.suppress(ImportError, AttributeError): 1619 with contextlib.suppress(ImportError, AttributeError):
1620 try: 1620 try:
1621 from PyQt5 import sip 1621 from PyQt6 import sip
1622 except ImportError: 1622 except ImportError:
1623 import sip 1623 import sip
1624 sipVersion = sip.SIP_VERSION_STR 1624 sipVersion = sip.SIP_VERSION_STR
1625 print("sip Version:", sipVersion.strip()) 1625 print("sip Version:", sipVersion.strip())
1626 # always assume, that snapshots or dev versions are new enough 1626 # always assume, that snapshots or dev versions are new enough
1647 .format(vers)) 1647 .format(vers))
1648 print('Please install another version.') 1648 print('Please install another version.')
1649 exit(3) 1649 exit(3)
1650 1650
1651 # check version of PyQt 1651 # check version of PyQt
1652 from PyQt5.QtCore import PYQT_VERSION_STR 1652 from PyQt6.QtCore import PYQT_VERSION_STR
1653 pyqtVersion = PYQT_VERSION_STR 1653 pyqtVersion = PYQT_VERSION_STR
1654 print("PyQt Version:", pyqtVersion.strip()) 1654 print("PyQt Version:", pyqtVersion.strip())
1655 # always assume, that snapshots or dev versions are new enough 1655 # always assume, that snapshots or dev versions are new enough
1656 if "snapshot" not in pyqtVersion and "dev" not in pyqtVersion: 1656 if "snapshot" not in pyqtVersion and "dev" not in pyqtVersion:
1657 while pyqtVersion.count('.') < 2: 1657 while pyqtVersion.count('.') < 2:
1671 .format(vers)) 1671 .format(vers))
1672 print('Please install another version.') 1672 print('Please install another version.')
1673 exit(4) 1673 exit(4)
1674 1674
1675 # check version of QScintilla 1675 # check version of QScintilla
1676 from PyQt5.Qsci import QSCINTILLA_VERSION_STR 1676 from PyQt6.Qsci import QSCINTILLA_VERSION_STR
1677 scintillaVersion = QSCINTILLA_VERSION_STR 1677 scintillaVersion = QSCINTILLA_VERSION_STR
1678 print("QScintilla Version:", QSCINTILLA_VERSION_STR.strip()) 1678 print("QScintilla Version:", QSCINTILLA_VERSION_STR.strip())
1679 # always assume, that snapshots or dev versions are new enough 1679 # always assume, that snapshots or dev versions are new enough
1680 if "snapshot" not in scintillaVersion and "dev" not in scintillaVersion: 1680 if "snapshot" not in scintillaVersion and "dev" not in scintillaVersion:
1681 while scintillaVersion.count('.') < 2: 1681 while scintillaVersion.count('.') < 2:
1707 # print version info for additional modules 1707 # print version info for additional modules
1708 with contextlib.suppress(NameError, AttributeError): 1708 with contextlib.suppress(NameError, AttributeError):
1709 print("PyQtChart:", QtChart.PYQT_CHART_VERSION_STR) 1709 print("PyQtChart:", QtChart.PYQT_CHART_VERSION_STR)
1710 1710
1711 with contextlib.suppress(ImportError, AttributeError): 1711 with contextlib.suppress(ImportError, AttributeError):
1712 from PyQt5 import QtWebEngine 1712 from PyQt6 import QtWebEngine
1713 print("PyQtWebEngine.", QtWebEngine.PYQT_WEBENGINE_VERSION_STR) 1713 print("PyQtWebEngine.", QtWebEngine.PYQT_WEBENGINE_VERSION_STR)
1714 1714
1715 print("All dependencies ok.") 1715 print("All dependencies ok.")
1716 print() 1716 print()
1717 1717
1730 1730
1731 def compileUiFiles(): 1731 def compileUiFiles():
1732 """ 1732 """
1733 Compile the .ui files to Python sources. 1733 Compile the .ui files to Python sources.
1734 """ 1734 """
1735 from PyQt5.uic import compileUiDir 1735 from PyQt6.uic import compileUiDir
1736 compileUiDir(eric7SourceDir, True, __pyName) 1736 compileUiDir(eric7SourceDir, True, __pyName)
1737 1737
1738 1738
1739 def prepareInfoFile(fileName): 1739 def prepareInfoFile(fileName):
1740 """ 1740 """

eric ide

mercurial