Merged with changes done on my Raspberry Pi 4. eric7

Fri, 23 Sep 2022 13:43:06 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 23 Sep 2022 13:43:06 +0200
branch
eric7
changeset 9349
df34d520c63b
parent 9348
f61d71d95cb1 (current diff)
parent 9347
da982d5b0718 (diff)
child 9350
8d2b507f8588

Merged with changes done on my Raspberry Pi 4.

--- a/scripts/install.py	Wed Sep 21 17:08:29 2022 +0200
+++ b/scripts/install.py	Fri Sep 23 13:43:06 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")
             ):
--- a/src/eric7/Globals/__init__.py	Wed Sep 21 17:08:29 2022 +0200
+++ b/src/eric7/Globals/__init__.py	Fri Sep 23 13:43:06 2022 +0200
@@ -17,11 +17,12 @@
 import sys
 
 from PyQt6.QtCore import (
-    QDir,
     QByteArray,
     QCoreApplication,
+    QDir,
+    QLibraryInfo,
+    QProcess,
     QT_VERSION,
-    QProcess,
     qVersion,
 )
 
@@ -388,7 +389,15 @@
             if not os.path.exists(binPath):
                 binPath = ""
 
-    # step 3: determine from used Python interpreter (designer is test object)
+    # step3: determine via QLibraryInfo
+    if not binPath:
+        binPath = (
+            QLibraryInfo.path(QLibraryInfo.LibraryPath.LibraryExecutablesPath)
+            if libexec else
+            QLibraryInfo.path(QLibraryInfo.LibraryPath.BinariesPath)
+        )
+
+    # step 4: determine from used Python interpreter (designer is test object)
     if not binPath:
         program = "designer"
         if isWindowsPlatform():
--- a/src/eric7/eric7_post_install.py	Wed Sep 21 17:08:29 2022 +0200
+++ b/src/eric7/eric7_post_install.py	Fri Sep 23 13:43:06 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