scripts/install.py

branch
eric7
changeset 10983
8b9913066b8c
parent 10959
377ef1594e36
child 10994
e37149c2e4f9
diff -r 960fe726594c -r 8b9913066b8c scripts/install.py
--- a/scripts/install.py	Tue Oct 15 16:29:36 2024 +0200
+++ b/scripts/install.py	Wed Oct 16 17:38:35 2024 +0200
@@ -69,6 +69,9 @@
 installInfo = {}
 installCwd = ""
 
+# Windows specific stuff
+pywin32_installed = False
+
 # Define blocklisted versions of the prerequisites
 BlockLists = {
     "sip": [],
@@ -1119,25 +1122,14 @@
     """
     Create Desktop and Start Menu links.
     """
-    if importlib.util.find_spec("win32com") is None:
-        installed = pipInstall(
-            "pywin32",
-            "\nThe Python package 'pywin32' could not be imported.",
-            force=False,
-        )
-        if installed:
-            # create the links via an external script to get around some
-            # startup magic done by pywin32.pth
-            args = [
-                sys.executable,
-                os.path.join(os.path.dirname(__file__), "create_windows_links.py"),
-            ]
-            subprocess.run(args)  # secok
-        else:
-            print(
-                "\nThe Python package 'pywin32' is not installed. Desktop and"
-                " Start Menu entries will not be created."
-            )
+    if pywin32_installed:
+        # create the links via an external script to get around some
+        # startup magic done by pywin32.pth
+        args = [
+            sys.executable,
+            os.path.join(os.path.dirname(__file__), "create_windows_links.py"),
+        ]
+        subprocess.run(args)  # secok
         return
 
     regPath = (
@@ -1587,7 +1579,7 @@
     """
     Perform some dependency checks.
     """
-    global verbose
+    global pywin32_installed, verbose
 
     requiredVersions = {
         "pyqt6": 0x60200,  # v6.2.0
@@ -1808,7 +1800,9 @@
                 msg = "Optional '{0}' could not be detected.{1}".format(
                     optPackage, "\nError: {0}".format(err) if verbose else ""
                 )
-                pipInstall(optPackage + optModulesDict[optPackage][1], msg)
+                ok = pipInstall(optPackage + optModulesDict[optPackage][1], msg)
+                if optPackage == "pywin32" and ok:
+                    pywin32_installed = True
     if optionalMissing:
         print("Some optional packages are missing and could not be installed.")
         print("Install them manually with:")

eric ide

mercurial