scripts/install.py

branch
eric7
changeset 9366
57980203d6f8
parent 9361
718bc86e1c3f
child 9371
1da8bc75946f
child 9377
b9c8dc3b7da1
diff -r 25f6183494e2 -r 57980203d6f8 scripts/install.py
--- a/scripts/install.py	Wed Sep 28 16:15:56 2022 +0200
+++ b/scripts/install.py	Thu Sep 29 11:18:50 2022 +0200
@@ -920,29 +920,23 @@
 
     # install the API file
     if installApis:
-        for progLanguage in progLanguages:
-            apidir = os.path.join(cfg["apidir"], progLanguage)
-            print("Installing {0} API files to '{1}'.".format(progLanguage, apidir))
-            try:
+        if os.access(cfg["apidir"], os.W_OK):
+            for progLanguage in progLanguages:
+                apidir = os.path.join(cfg["apidir"], progLanguage)
+                print("Installing {0} API files to '{1}'.".format(progLanguage, apidir))
                 if not os.path.exists(apidir):
                     os.makedirs(apidir)
-            except OSError:
-                print("Could not create '{0}' (no permission).".format(apidir))
-                continue
-            for apiName in glob.glob(
-                os.path.join(eric7SourceDir, "APIs", progLanguage, "*.api")
-            ):
-                try:
+                for apiName in glob.glob(
+                    os.path.join(eric7SourceDir, "APIs", progLanguage, "*.api")
+                ):
                     shutilCopy(apiName, apidir)
-                except OSError:
-                    print("Could not install '{0}' (no permission).".format(apiName))
-            for apiName in glob.glob(
-                os.path.join(eric7SourceDir, "APIs", progLanguage, "*.bas")
-            ):
-                try:
+                for apiName in glob.glob(
+                    os.path.join(eric7SourceDir, "APIs", progLanguage, "*.bas")
+                ):
                     shutilCopy(apiName, apidir)
-                except OSError:
-                    print("Could not install '{0}' (no permission).".format(apiName))
+        else:
+            print("The API directory '{0}' is not writable.".format(cfg["apidir"]))
+            print("Use the API files provided by the 'API Files' plug-in.")
 
     # Create menu entry for Linux systems
     if sys.platform.startswith("linux"):

eric ide

mercurial