scripts/install.py

branch
eric7
changeset 9347
da982d5b0718
parent 9328
49a0a9cb2505
child 9356
803a7a85b071
--- a/scripts/install.py	Fri Sep 23 10:58:55 2022 +0200
+++ b/scripts/install.py	Fri Sep 23 11:47:42 2022 +0200
@@ -264,6 +264,9 @@
     text = text.replace("@MARKER@", "")
     text = text.replace("@PY_MARKER@", "")
 
+    dstPath = os.path.dirname(dst)
+    if not os.path.isdir(dstPath):
+        os.makedirs(dstPath)
     with open(dst, "w", encoding="utf-8") as f:
         f.write(text)
     os.chmod(dst, 0o644)
@@ -294,6 +297,9 @@
         .replace("@DATE@", time.strftime("%Y-%m-%d"))
     )
 
+    dstPath = os.path.dirname(dst)
+    if not os.path.isdir(dstPath):
+        os.makedirs(dstPath)
     with open(dst, "w", encoding="utf-8") as f:
         f.write(text)
     os.chmod(dst, 0o644)
@@ -906,8 +912,12 @@
         for progLanguage in progLanguages:
             apidir = os.path.join(cfg["apidir"], progLanguage.lower())
             print("Installing {0} API files to '{1}'.".format(progLanguage, apidir))
-            if not os.path.exists(apidir):
-                os.makedirs(apidir)
+            try:
+                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")
             ):

eric ide

mercurial