609 |
609 |
610 def cleanUpWindowsLinks(): |
610 def cleanUpWindowsLinks(): |
611 """ |
611 """ |
612 Clean up the Desktop and Start Menu entries for Windows. |
612 Clean up the Desktop and Start Menu entries for Windows. |
613 """ |
613 """ |
614 global doCleanDesktopLinks, forceCleanDesktopLinks |
614 if importlib.util.find_spec("pywintypes") is None: |
615 |
|
616 try: |
|
617 from pywintypes import com_error # __IGNORE_WARNING__ |
|
618 except ImportError: |
|
619 # links were not created by install.py |
615 # links were not created by install.py |
620 return |
616 return |
|
617 |
|
618 global doCleanDesktopLinks, forceCleanDesktopLinks |
621 |
619 |
622 regPath = ( |
620 regPath = ( |
623 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" |
621 "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer" |
624 + "\\User Shell Folders" |
622 + "\\User Shell Folders" |
625 ) |
623 ) |
1523 if sys.version_info < (3, 8, 0) or sys.version_info >= (3, 13, 0): |
1518 if sys.version_info < (3, 8, 0) or sys.version_info >= (3, 13, 0): |
1524 print("Sorry, you must have Python 3.8.0 or higher, but less 3.13.0.") |
1519 print("Sorry, you must have Python 3.8.0 or higher, but less 3.13.0.") |
1525 print("Yours is {0}.".format(".".join(str(v) for v in sys.version_info[:3]))) |
1520 print("Yours is {0}.".format(".".join(str(v) for v in sys.version_info[:3]))) |
1526 exit(5) |
1521 exit(5) |
1527 |
1522 |
1528 try: |
1523 if ( |
1529 import xml.etree # __IGNORE_WARNING__ |
1524 importlib.util.find_spec("xml") is None |
1530 except ImportError: |
1525 or importlib.util.find_spec("xml.etree") is None |
|
1526 ): |
1531 print("Your Python installation is missing the XML module.") |
1527 print("Your Python installation is missing the XML module.") |
1532 print("Please install it and try again.") |
1528 print("Please install it and try again.") |
1533 exit(5) |
1529 exit(5) |
1534 |
1530 |
1535 print("PyQt & Qt") |
1531 print("PyQt & Qt") |
1555 print("Sorry, please install PyQt6.") |
1551 print("Sorry, please install PyQt6.") |
1556 print("Error: {0}".format(msg)) |
1552 print("Error: {0}".format(msg)) |
1557 exit(1) |
1553 exit(1) |
1558 print("Found PyQt6") |
1554 print("Found PyQt6") |
1559 |
1555 |
1560 try: |
1556 pyuic = "pyuic6" |
1561 pyuic = "pyuic6" |
1557 if importlib.util.find_spec("PyQt6.uic") is None: |
1562 from PyQt6 import uic # __IGNORE_WARNING__ |
|
1563 except ImportError as err: |
|
1564 print("Sorry, {0} is not installed.".format(pyuic)) |
1558 print("Sorry, {0} is not installed.".format(pyuic)) |
1565 if verbose: |
|
1566 print("Error: {0}".format(err)) |
|
1567 exit(1) |
1559 exit(1) |
1568 print("Found {0}".format(pyuic)) |
1560 print("Found {0}".format(pyuic)) |
1569 |
1561 |
1570 try: |
1562 if importlib.util.find_spec("PyQt6.QtWebEngineWidgets") is None: |
1571 from PyQt6 import QtWebEngineWidgets # __IGNORE_WARNING__ |
|
1572 except ImportError as err: |
|
1573 if isSudo: |
1563 if isSudo: |
1574 print("Optional 'PyQt6-WebEngine' could not be detected.") |
1564 print("Optional 'PyQt6-WebEngine' could not be detected.") |
1575 else: |
1565 else: |
1576 msg = "Optional 'PyQt6-WebEngine' could not be detected.{0}".format( |
1566 msg = "Optional 'PyQt6-WebEngine' could not be detected." |
1577 "\nError: {0}".format(err) if verbose else "" |
|
1578 ) |
|
1579 pipInstall( |
1567 pipInstall( |
1580 "PyQt6-WebEngine>={0}".format( |
1568 "PyQt6-WebEngine>={0}".format( |
1581 versionToStr(requiredVersions["pyqt6-webengine"]) |
1569 versionToStr(requiredVersions["pyqt6-webengine"]) |
1582 ), |
1570 ), |
1583 msg, |
1571 msg, |
1584 ) |
1572 ) |
1585 print("Found PyQt6-WebEngine") |
1573 print("Found PyQt6-WebEngine") |
1586 |
1574 |
1587 try: |
1575 if importlib.util.find_spec("PyQt6.QtCharts") is None: |
1588 from PyQt6 import QtCharts # __IGNORE_WARNING__ |
|
1589 except ImportError as err: |
|
1590 if isSudo: |
1576 if isSudo: |
1591 print("Optional 'PyQt6-Charts' could not be detected.") |
1577 print("Optional 'PyQt6-Charts' could not be detected.") |
1592 else: |
1578 else: |
1593 msg = "Optional 'PyQt6-Charts' could not be detected.{0}".format( |
1579 msg = "Optional 'PyQt6-Charts' could not be detected." |
1594 "\nError: {0}".format(err) if verbose else "" |
|
1595 ) |
|
1596 pipInstall( |
1580 pipInstall( |
1597 "PyQt6-Charts>={0}".format( |
1581 "PyQt6-Charts>={0}".format( |
1598 versionToStr(requiredVersions["pyqt6-charts"]) |
1582 versionToStr(requiredVersions["pyqt6-charts"]) |
1599 ), |
1583 ), |
1600 msg, |
1584 msg, |
1601 ) |
1585 ) |
1602 print("Found PyQt6-Charts") |
1586 print("Found PyQt6-Charts") |
1603 |
1587 |
1604 try: |
1588 if importlib.util.find_spec("PyQt6.Qsci") is None: |
1605 from PyQt6 import Qsci # __IGNORE_WARNING__ |
1589 msg = "'PyQt6-QScintilla' could not be detected." |
1606 except ImportError as err: |
|
1607 msg = "'PyQt6-QScintilla' could not be detected.{0}".format( |
|
1608 "\nError: {0}".format(err) if verbose else "" |
|
1609 ) |
|
1610 installed = not isSudo and pipInstall( |
1590 installed = not isSudo and pipInstall( |
1611 "PyQt6-QScintilla>={0}".format( |
1591 "PyQt6-QScintilla>={0}".format( |
1612 versionToStr(requiredVersions["pyqt6-qscintilla"]) |
1592 versionToStr(requiredVersions["pyqt6-qscintilla"]) |
1613 ), |
1593 ), |
1614 msg, |
1594 msg, |
1615 ) |
1595 ) |
1616 if installed: |
1596 message = None if installed else "PyQt6-QScintilla could not be installed." |
1617 # try to import it again |
|
1618 try: |
|
1619 from PyQt6 import Qsci # __IGNORE_WARNING__ |
|
1620 |
|
1621 message = None |
|
1622 except ImportError as msg: |
|
1623 message = str(msg) |
|
1624 else: |
|
1625 message = "PyQt6-QScintilla could not be installed." |
|
1626 if message: |
1597 if message: |
1627 print("Sorry, please install QScintilla2 and") |
1598 print("Sorry, please install QScintilla2 and") |
1628 print("its PyQt6 wrapper.") |
1599 print("its PyQt6 wrapper.") |
1629 print("Error: {0}".format(message)) |
1600 print("Error: {0}".format(message)) |
1630 exit(1) |
1601 exit(1) |
1843 print("Please install another version.") |
1814 print("Please install another version.") |
1844 exit(5) |
1815 exit(5) |
1845 |
1816 |
1846 # print version info for additional modules |
1817 # print version info for additional modules |
1847 with contextlib.suppress(NameError, AttributeError): |
1818 with contextlib.suppress(NameError, AttributeError): |
1848 print("PyQt6-Charts:", QtCharts.PYQT_CHART_VERSION_STR) |
1819 from PyQt6.QtCharts import PYQT_CHART_VERSION_STR # noqa: I101, I102 |
|
1820 |
|
1821 print("PyQt6-Charts:", PYQT_CHART_VERSION_STR) |
1849 |
1822 |
1850 with contextlib.suppress(ImportError, AttributeError): |
1823 with contextlib.suppress(ImportError, AttributeError): |
1851 from PyQt6 import QtWebEngineCore # noqa: I101, I102 |
1824 from PyQt6 import QtWebEngineCore # noqa: I101, I102 |
1852 |
1825 |
1853 print("PyQt6-WebEngine:", QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR) |
1826 print("PyQt6-WebEngine:", QtWebEngineCore.PYQT_WEBENGINE_VERSION_STR) |