Changed the path to search for for the "qhelpgenerator" tool because that was moved to the 'libexec' directory on Linux and maxOS. eric7

Fri, 17 Jun 2022 17:34:46 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 17 Jun 2022 17:34:46 +0200
branch
eric7
changeset 9154
e8ca7b41a7d8
parent 9153
506e35e424d5
child 9155
2efa8d1312cd

Changed the path to search for for the "qhelpgenerator" tool because that was moved to the 'libexec' directory on Linux and maxOS.

eric7/APIs/Python3/eric7.api file | annotate | diff | comparison | revisions
eric7/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
eric7/Documentation/Source/eric7.Globals.__init__.html file | annotate | diff | comparison | revisions
eric7/DocumentationTools/QtHelpGenerator.py file | annotate | diff | comparison | revisions
eric7/Globals/__init__.py file | annotate | diff | comparison | revisions
eric7/Plugins/PluginEricdoc.py file | annotate | diff | comparison | revisions
--- a/eric7/APIs/Python3/eric7.api	Fri Jun 17 16:36:14 2022 +0200
+++ b/eric7/APIs/Python3/eric7.api	Fri Jun 17 17:34:46 2022 +0200
@@ -1890,7 +1890,7 @@
 eric7.Globals.getPyQtToolsPath?4(version=5)
 eric7.Globals.getPythonExecutable?4()
 eric7.Globals.getPythonLibraryDirectory?4()
-eric7.Globals.getQtBinariesPath?4()
+eric7.Globals.getQtBinariesPath?4(libexec=False)
 eric7.Globals.getWebBrowserSupport?4()
 eric7.Globals.isGnomeDesktop?4()
 eric7.Globals.isKdeDesktop?4()
Binary file eric7/Documentation/Help/source.qch has changed
--- a/eric7/Documentation/Source/eric7.Globals.__init__.html	Fri Jun 17 16:36:14 2022 +0200
+++ b/eric7/Documentation/Source/eric7.Globals.__init__.html	Fri Jun 17 17:34:46 2022 +0200
@@ -325,12 +325,20 @@
 <hr />
 <a NAME="getQtBinariesPath" ID="getQtBinariesPath"></a>
 <h2>getQtBinariesPath</h2>
-<b>getQtBinariesPath</b>(<i></i>)
+<b>getQtBinariesPath</b>(<i>libexec=False</i>)
 
 <p>
     Module function to get the path of the Qt binaries.
 </p>
 <dl>
+
+<dt><i>libexec</i> (bool (optional))</dt>
+<dd>
+flag indicating to get the path of the executable library
+        (defaults to False)
+</dd>
+</dl>
+<dl>
 <dt>Return:</dt>
 <dd>
 path of the Qt binaries
--- a/eric7/DocumentationTools/QtHelpGenerator.py	Fri Jun 17 16:36:14 2022 +0200
+++ b/eric7/DocumentationTools/QtHelpGenerator.py	Fri Jun 17 17:34:46 2022 +0200
@@ -271,8 +271,14 @@
         cwd = os.getcwd()
         # generate the compressed files
         qhelpgeneratorExe = os.path.join(
-            getQtBinariesPath(), generateQtToolName("qhelpgenerator")
+            getQtBinariesPath(libexec=True),
+            generateQtToolName("qhelpgenerator")
         )
+        if not os.path.exists(qhelpgeneratorExe):
+            qhelpgeneratorExe = os.path.join(
+                getQtBinariesPath(libexec=False),
+                generateQtToolName("qhelpgenerator")
+            )
         shutil.copy(
             os.path.join(self.outputDir, HelpProjectFile), self.htmlDir)
         os.chdir(self.htmlDir)
--- a/eric7/Globals/__init__.py	Fri Jun 17 16:36:14 2022 +0200
+++ b/eric7/Globals/__init__.py	Fri Jun 17 17:34:46 2022 +0200
@@ -299,70 +299,94 @@
     """
     import Preferences
     
-    path = ""
+    toolsPath = ""
     
     # step 1: check, if the user has configured a tools path
     if version == 5:
-        path = Preferences.getQt("PyQtToolsDir")
+        toolsPath = Preferences.getQt("PyQtToolsDir")
     elif version == 6:
-        path = Preferences.getQt("PyQt6ToolsDir")
+        toolsPath = Preferences.getQt("PyQt6ToolsDir")
     
     # step 2: determine from used Python interpreter (pylupdate is test object)
-    if not path:
+    if not toolsPath:
         program = "pylupdate{0}".format(version)
         if isWindowsPlatform():
             program += ".exe"
             dirName = os.path.dirname(sys.executable)
             if os.path.exists(os.path.join(dirName, program)):
-                path = dirName
+                toolsPath = dirName
             elif os.path.exists(os.path.join(dirName, "Scripts", program)):
-                path = os.path.join(dirName, "Scripts")
+                toolsPath = os.path.join(dirName, "Scripts")
         else:
             dirName = os.path.dirname(sys.executable)
             if os.path.exists(os.path.join(dirName, program)):
-                path = dirName
+                toolsPath = dirName
     
-    return path
+    return toolsPath
 
 
-def getQtBinariesPath():
+def getQtBinariesPath(libexec=False):
     """
     Module function to get the path of the Qt binaries.
     
+    @param libexec flag indicating to get the path of the executable library
+        (defaults to False)
+    @type bool (optional)
     @return path of the Qt binaries
     @rtype str
     """
     import Preferences
     
-    path = ""
+    binPath = ""
     
     # step 1: check, if the user has configured a tools path
-    path = Preferences.getQt("QtToolsDir")
+    qtToolsDir = Preferences.getQt("QtToolsDir")
+    if qtToolsDir:
+        if libexec:
+            binPath = os.path.join(qtToolsDir, "..", "libexec")
+            if not os.path.exists(binPath):
+                binPath = qtToolsDir
+        else:
+            binPath = Preferences.getQt("QtToolsDir")
+        if not os.path.exists(binPath):
+            binPath = ""
     
     # step 2: try the qt6_applications package
-    if not path:
+    if not binPath:
         with contextlib.suppress(ImportError):
+            # if qt6-applications is not installed just go to the next step
             import qt6_applications
-            path = os.path.join(os.path.dirname(qt6_applications.__file__),
-                                "Qt", "bin")
-            # if qt6-applications is not installed just go to the next step
+            if libexec:
+                binPath = os.path.join(
+                    os.path.dirname(qt6_applications.__file__),
+                    "Qt", "libexec")
+                if not os.path.exists(binPath):
+                    binPath = os.path.join(
+                        os.path.dirname(qt6_applications.__file__),
+                        "Qt", "bin")
+            else:
+                binPath = os.path.join(
+                    os.path.dirname(qt6_applications.__file__),
+                    "Qt", "bin")
+            if not os.path.exists(binPath):
+                binPath = ""
     
     # step 3: determine from used Python interpreter (designer is test object)
-    if not path:
+    if not binPath:
         program = "designer"
         if isWindowsPlatform():
             program += ".exe"
             dirName = os.path.dirname(sys.executable)
             if os.path.exists(os.path.join(dirName, program)):
-                path = dirName
+                binPath = dirName
             elif os.path.exists(os.path.join(dirName, "Scripts", program)):
-                path = os.path.join(dirName, "Scripts")
+                binPath = os.path.join(dirName, "Scripts")
         else:
             dirName = os.path.dirname(sys.executable)
             if os.path.exists(os.path.join(dirName, program)):
-                path = dirName
+                binPath = dirName
     
-    return QDir.toNativeSeparators(path)
+    return QDir.toNativeSeparators(binPath)
 
 
 ###############################################################################
--- a/eric7/Plugins/PluginEricdoc.py	Fri Jun 17 16:36:14 2022 +0200
+++ b/eric7/Plugins/PluginEricdoc.py	Fri Jun 17 17:34:46 2022 +0200
@@ -90,6 +90,7 @@
     })
     
     # 2. Qt Help Generator
+    # 2.1 location before 6.3 (Linux and macOS) and Windows
     exe = os.path.join(
         Utilities.getQtBinariesPath(),
         Utilities.generateQtToolName('qhelpgenerator')
@@ -107,6 +108,24 @@
         "version": "",
         "versionCleanup": (0, -1),
     })
+    # 2.2 location starting with 6.3.0 (Linux and macOS)
+    exe = os.path.join(
+        Utilities.getQtBinariesPath(libexec=True),
+        Utilities.generateQtToolName('qhelpgenerator')
+    )
+    if Utilities.isWindowsPlatform():
+        exe += '.exe'
+    dataList.append({
+        "programEntry": True,
+        "header": QCoreApplication.translate(
+            "EricdocPlugin", "Qt Help Tools"),
+        "exe": exe,
+        "versionCommand": '-v',
+        "versionStartsWith": 'Qt',
+        "versionPosition": -1,
+        "version": "",
+        "versionCleanup": (0, -1),
+    })
     
     return dataList
 

eric ide

mercurial