scripts/install-dependencies.py

branch
eric7
changeset 9314
7ba79b00ea96
parent 9221
bf71ee032bb4
child 9324
7f7f3e47b238
diff -r 6bac6775abb2 -r 7ba79b00ea96 scripts/install-dependencies.py
--- a/scripts/install-dependencies.py	Tue Sep 06 13:39:18 2022 +0200
+++ b/scripts/install-dependencies.py	Tue Sep 06 15:08:41 2022 +0200
@@ -9,10 +9,26 @@
 Installation script for the eric IDE dependencies.
 """
 
+import contextlib
 import subprocess
 import sys
 
 
+def exit(rcode=0):
+    """
+    Exit the install script.
+
+    @param rcode result code to report back (integer)
+    """
+    print()
+
+    if sys.platform.startswith(("win", "cygwin")):
+        with contextlib.suppress():
+            input("Press enter to continue...")  # secok
+
+    sys.exit(rcode)
+
+
 def pipInstall(packageName):
     """
     Install the given package via pip.
@@ -43,29 +59,51 @@
     """
     Function to install the eric dependencies.
     """
-    packages = (
-        "wheel",
+    requiredPackages = (
         "PyQt6>=6.2.0",
         "PyQt6-Charts>=6.2.0",
         "PyQt6-WebEngine>=6.2.0",
         "PyQt6-QScintilla>=2.13.0",
-        "docutils",
-        "Markdown",
-        "pyyaml",
         "tomlkit",
-        "chardet",
         "asttokens",
         "EditorConfig",
-        "Send2Trash",
         "Pygments",
         "parso",
         "jedi",
         "packaging",
-        "pipdeptree",
         "cyclonedx-python-lib",
         "cyclonedx-bom",
         "trove-classifiers",
+        "black>=22.6.0",
     )
+    optionalPackages = (
+        "docutils",
+        "Markdown",
+        "pyyaml",
+        "chardet",
+        "Send2Trash",
+        "pyenchant",
+        "wheel",
+    )
+
+    packages = []
+    if len(sys.argv) == 2:
+        if sys.argv[1] == "--all":
+            packages = requiredPackages + optionalPackages
+        elif sys.argv[1] == "--required":
+            packages = requiredPackages
+        elif sys.argv[1] == "--optional":
+            packages = optionalPackages
+
+    if not packages:
+        print("Usage:")
+        print("    install-dependencies --all | --optional | --required")
+        print("where:")
+        print("    --all         install all dependencies")
+        print("    --optional    install all optional dependencies")
+        print("    --required    install all required dependencies")
+
+        exit(42)
 
     failedPackages = []
     for package in packages:
@@ -83,6 +121,8 @@
     else:
         print("All packages installed successfully.")
 
+    exit(0)
+
 
 if __name__ == "__main__":
     main()

eric ide

mercurial