scripts/install.py

branch
eric7
changeset 9314
7ba79b00ea96
parent 9278
36448ca469c2
child 9328
49a0a9cb2505
equal deleted inserted replaced
9313:6bac6775abb2 9314:7ba79b00ea96
1736 print("its PyQt6 wrapper.") 1736 print("its PyQt6 wrapper.")
1737 print("Error: {0}".format(message)) 1737 print("Error: {0}".format(message))
1738 exit(1) 1738 exit(1)
1739 print("Found PyQt6-QScintilla") 1739 print("Found PyQt6-QScintilla")
1740 1740
1741 impModulesList = [ 1741 pyqt6BaseModulesList = [
1742 "PyQt6.QtGui", 1742 "PyQt6.QtGui",
1743 "PyQt6.QtNetwork", 1743 "PyQt6.QtNetwork",
1744 "PyQt6.QtPrintSupport", 1744 "PyQt6.QtPrintSupport",
1745 "PyQt6.QtSql", 1745 "PyQt6.QtSql",
1746 "PyQt6.QtSvg", 1746 "PyQt6.QtSvg",
1747 "PyQt6.QtSvgWidgets", 1747 "PyQt6.QtSvgWidgets",
1748 "PyQt6.QtWidgets", 1748 "PyQt6.QtWidgets",
1749 ] 1749 ]
1750 optionalModulesList = { 1750 requiredModulesList = {
1751 # key is pip project name 1751 # key is pip project name
1752 # value is tuple of package name, pip install constraint 1752 # value is tuple of package name, pip install constraint
1753 "docutils": ("docutils", ""),
1754 "Markdown": ("markdown", ""),
1755 "pyyaml": ("yaml", ""),
1756 "tomlkit": ("tomlkit", ""), 1753 "tomlkit": ("tomlkit", ""),
1757 "chardet": ("chardet", ""),
1758 "asttokens": ("asttokens", ""), 1754 "asttokens": ("asttokens", ""),
1759 "EditorConfig": ("editorconfig", ""), 1755 "EditorConfig": ("editorconfig", ""),
1760 "Send2Trash": ("send2trash", ""),
1761 "Pygments": ("pygments", ""), 1756 "Pygments": ("pygments", ""),
1762 "pyenchant": ("enchant", ""),
1763 "wheel": ("wheel", ""),
1764 "parso": ("parso", ""), 1757 "parso": ("parso", ""),
1765 "jedi": ("jedi", ""), 1758 "jedi": ("jedi", ""),
1766 "packaging": ("packaging", ""), 1759 "packaging": ("packaging", ""),
1767 "cyclonedx-python-lib": ("cyclonedx", ""), 1760 "cyclonedx-python-lib": ("cyclonedx", ""),
1768 "cyclonedx-bom": ("cyclonedx_py", ""), 1761 "cyclonedx-bom": ("cyclonedx_py", ""),
1769 "trove-classifiers": ("trove_classifiers", ""), 1762 "trove-classifiers": ("trove_classifiers", ""),
1770 "black": ("black", ">=22.6.0"), 1763 "black": ("black", ">=22.6.0"),
1771 } 1764 }
1765 optionalModulesList = {
1766 # key is pip project name
1767 # value is tuple of package name, pip install constraint
1768 "docutils": ("docutils", ""),
1769 "Markdown": ("markdown", ""),
1770 "pyyaml": ("yaml", ""),
1771 "chardet": ("chardet", ""),
1772 "Send2Trash": ("send2trash", ""),
1773 "pyenchant": ("enchant", ""),
1774 "wheel": ("wheel", ""),
1775 }
1772 if not ignorePyqt6Tools: 1776 if not ignorePyqt6Tools:
1773 optionalModulesList["qt6-applications"] = ("qt6_applications", "") 1777 optionalModulesList["qt6-applications"] = ("qt6_applications", "")
1774 1778
1775 # check mandatory modules 1779 # check mandatory PyQt6 modules
1776 modulesOK = True 1780 modulesOK = True
1777 for impModule in impModulesList: 1781 for pyqt6BaseModule in pyqt6BaseModulesList:
1778 name = impModule.split(".")[1] 1782 name = pyqt6BaseModule.split(".")[1]
1779 try: 1783 try:
1780 __import__(impModule) 1784 __import__(pyqt6BaseModule)
1781 print("Found", name) 1785 print("Found", name)
1782 except ImportError as err: 1786 except ImportError as err:
1783 print("Sorry, please install {0}.".format(name)) 1787 print("Sorry, please install {0}.".format(name))
1784 if verbose: 1788 if verbose:
1785 print("Error: {0}".format(err)) 1789 print("Error: {0}".format(err))
1786 modulesOK = False 1790 modulesOK = False
1787 if not modulesOK: 1791 if not modulesOK:
1788 exit(1) 1792 exit(1)
1789 1793
1794 # check required modules
1795 requiredMissing = False
1796 for requiredPackage in requiredModulesList:
1797 try:
1798 __import__(requiredModulesList[requiredPackage][0])
1799 print("Found", requiredPackage)
1800 except ImportError as err:
1801 if isSudo:
1802 print("Required '{0}' could not be detected.".format(requiredPackage))
1803 requiredMissing = True
1804 else:
1805 msg = "Required '{0}' could not be detected.{1}".format(
1806 requiredPackage, "\nError: {0}".format(err) if verbose else ""
1807 )
1808 pipInstall(
1809 requiredPackage + requiredModulesList[requiredPackage][1],
1810 msg,
1811 force=True,
1812 )
1813 if requiredMissing:
1814 print("Some required packages are missing and could not be installed.")
1815 print("Install them manually with:")
1816 print(" {0} install-dependencies.py --required".format(sys.executable))
1817
1790 # check optional modules 1818 # check optional modules
1819 optionalMissing = False
1791 for optPackage in optionalModulesList: 1820 for optPackage in optionalModulesList:
1792 try: 1821 try:
1793 __import__(optionalModulesList[optPackage][0]) 1822 __import__(optionalModulesList[optPackage][0])
1794 print("Found", optPackage) 1823 print("Found", optPackage)
1795 except ImportError as err: 1824 except ImportError as err:
1796 if isSudo: 1825 if isSudo:
1797 print("Optional '{0}' could not be detected.".format(optPackage)) 1826 print("Optional '{0}' could not be detected.".format(optPackage))
1827 optionalMissing = True
1798 else: 1828 else:
1799 msg = "Optional '{0}' could not be detected.{1}".format( 1829 msg = "Optional '{0}' could not be detected.{1}".format(
1800 optPackage, "\nError: {0}".format(err) if verbose else "" 1830 optPackage, "\nError: {0}".format(err) if verbose else ""
1801 ) 1831 )
1802 pipInstall(optPackage + optionalModulesList[optPackage][1], msg) 1832 pipInstall(optPackage + optionalModulesList[optPackage][1], msg)
1833 if optionalMissing:
1834 print("Some optional packages are missing and could not be installed.")
1835 print("Install them manually with:")
1836 print(" {0} install-dependencies.py --optional".format(sys.executable))
1837
1838 if requiredMissing and optionalMissing:
1839 print("Alternatively you may install all of them with:")
1840 print(" {0} install-dependencies.py --all".format(sys.executable))
1803 1841
1804 # determine the platform dependent black list 1842 # determine the platform dependent black list
1805 if sys.platform.startswith(("win", "cygwin")): 1843 if sys.platform.startswith(("win", "cygwin")):
1806 PlatformBlackLists = PlatformsBlackLists["windows"] 1844 PlatformBlackLists = PlatformsBlackLists["windows"]
1807 elif sys.platform.startswith("linux"): 1845 elif sys.platform.startswith("linux"):

eric ide

mercurial