Improved the post install script to create some more non-existing directories. eric7

Fri, 23 Sep 2022 10:58:55 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 23 Sep 2022 10:58:55 +0200
branch
eric7
changeset 9346
eda0bdb22e67
parent 9345
58a1e7c960b8
child 9347
da982d5b0718

Improved the post install script to create some more non-existing directories.

src/eric7/eric7_post_install.py file | annotate | diff | comparison | revisions
--- a/src/eric7/eric7_post_install.py	Thu Sep 22 19:45:29 2022 +0200
+++ b/src/eric7/eric7_post_install.py	Fri Sep 23 10:58:55 2022 +0200
@@ -189,7 +189,8 @@
     for desktop in ["eric7.desktop", "eric7_browser.desktop"]:
         copyDesktopFile(
             os.path.join(linuxDir, desktop),
-            os.path.join(dstDir, "applications", desktop),
+            os.path.join(dstDir, "applications"),
+            desktop,
             scriptsDir,
         )
 
@@ -212,19 +213,27 @@
     os.chmod(dstname, 0o644)
 
 
-def copyDesktopFile(src, dst, scriptsdir):
+def copyDesktopFile(src, dstPath, dstFile, scriptsdir):
     """
     Modify a desktop file and write it to its destination.
 
-    @param src source file name (string)
-    @param dst destination file name (string)
-    @param scriptsdir directory containing the scripts (string)
+    @param src source file name
+    @type str
+    @param dstPath path name of the directory for the file to be written
+    @type str
+    @param dstFile name of the file to be written
+    @type str
+    @param scriptsdir directory containing the scripts
+    @type str
     """
     with open(src, "r", encoding="utf-8") as f:
         text = f.read()
 
     text = text.replace("@BINDIR@", scriptsdir)
 
+    if not os.path.isdir(dstPath):
+        os.makedirs(dstPath)
+    dst = os.path.join(dstPath, dstFile)
     with open(dst, "w", encoding="utf-8") as f:
         f.write(text)
     os.chmod(dst, 0o644)

eric ide

mercurial