Updated the way the path to Qt tools is determined.

Sat, 03 Oct 2020 15:24:48 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 03 Oct 2020 15:24:48 +0200
changeset 7741
6ead5f865f72
parent 7740
330a43a4db79
child 7742
38ad1351688c

Updated the way the path to Qt tools is determined.

eric6/DocumentationTools/QtHelpGenerator.py file | annotate | diff | comparison | revisions
eric6/Globals/__init__.py file | annotate | diff | comparison | revisions
eric6/Plugins/PluginEricdoc.py file | annotate | diff | comparison | revisions
--- a/eric6/DocumentationTools/QtHelpGenerator.py	Sat Oct 03 15:23:58 2020 +0200
+++ b/eric6/DocumentationTools/QtHelpGenerator.py	Sat Oct 03 15:24:48 2020 +0200
@@ -15,8 +15,7 @@
 import subprocess           # secok
 
 from Utilities import (
-    joinext, relpath, html_encode, getQtBinariesPath, generateQtToolName,
-    isExecutable
+    joinext, relpath, html_encode, getQtBinariesPath, generateQtToolName
 )
 
 HelpCollection = r"""<?xml version="1.0" encoding="utf-8" ?>
@@ -286,18 +285,12 @@
         os.remove(HelpProjectFile)
         
         if self.createCollection:
-            qcollectiongeneratorExe = os.path.join(
-                getQtBinariesPath(), generateQtToolName("qcollectiongenerator")
-            )
-            if not isExecutable(qcollectiongeneratorExe):
-                # assume Qt >= 5.12.0
-                qcollectiongeneratorExe = qhelpgeneratorExe
             sys.stdout.write("Generating QtHelp collection...\n")
             sys.stdout.flush()
             sys.stderr.flush()
             os.chdir(self.outputDir)
             subprocess.call([       # secok
-                qcollectiongeneratorExe,
+                qhelpgeneratorExe,
                 HelpCollectionProjectFile, "-o", HelpCollectionFile])
         
         os.chdir(cwd)
--- a/eric6/Globals/__init__.py	Sat Oct 03 15:23:58 2020 +0200
+++ b/eric6/Globals/__init__.py	Sat Oct 03 15:24:48 2020 +0200
@@ -18,8 +18,8 @@
 import shutil
 
 from PyQt5.QtCore import (
-    QDir, QLibraryInfo, QByteArray, QCoreApplication, QT_VERSION_STR,
-    QT_VERSION, QProcess, qVersion
+    QDir, QByteArray, QCoreApplication, QT_VERSION_STR, QT_VERSION, QProcess,
+    qVersion
 )
 
 # names of the various settings objects
@@ -288,7 +288,8 @@
     """
     Module function to get the path of the Qt binaries.
     
-    @return path of the Qt binaries (string)
+    @return path of the Qt binaries
+    @rtype str
     """
     import Preferences
     
@@ -297,41 +298,25 @@
     # step 1: check, if the user has configured a tools path
     path = Preferences.getQt("QtToolsDir")
     
-    if not path and isWindowsPlatform():
-        # step 2.1: check for PyQt5 Windows installer (designer is test object)
-        modDir = getPyQt5ModulesDirectory()
-        if os.path.exists(os.path.join(modDir, "bin", "designer.exe")):
-            path = os.path.join(modDir, "bin")
-        elif os.path.exists(os.path.join(modDir, "designer.exe")):
-            path = modDir
-        
-        if not path:
-            import distutils.sysconfig
-            # step 2.2.1: check for the pyqt5-tools wheel (new variant)
-            # (Windows only)
-            pyqt5ToolsPath = os.path.join(
-                distutils.sysconfig.get_python_lib(True), "pyqt5_tools")
-            if os.path.exists(os.path.join(pyqt5ToolsPath, "designer.exe")):
-                path = pyqt5ToolsPath
-            if not path:
-                # step 2.2.2: check for the pyqt5-tools wheel (old variant)
-                # (Windows only)
-                pyqt5ToolsPath = os.path.join(
-                    distutils.sysconfig.get_python_lib(True), "pyqt5-tools")
-                if os.path.exists(os.path.join(pyqt5ToolsPath,
-                                               "designer.exe")):
-                    path = pyqt5ToolsPath
-    
+    # step 2: determine from used Python interpreter (designer is test object)
     if not path:
-        # step 3: get the path from Qt
-        # Note: no Qt tools are to be found there for PyQt 5.7.0
-        path = QLibraryInfo.location(QLibraryInfo.BinariesPath)
-        if not os.path.exists(path):
-            path = ""
+        program = "designer"
+        if isWindowsPlatform():
+            program += ".exe"
+            dirName = os.path.dirname(sys.executable)
+            if os.path.exists(os.path.join(dirName, program)):
+                path = dirName
+            elif os.path.exists(os.path.join(dirName, "Scripts", program)):
+                path = os.path.join(dirName, "Scripts")
+        else:
+            dirName = os.path.dirname(sys.executable)
+            if os.path.exists(os.path.join(dirName, program)):
+                path = dirName
     
     return QDir.toNativeSeparators(path)
 
 
+# TODO: get rid of this
 def translate(*args):
     """
     Module function to handle different PyQt 4/5 QCoreApplication.translate
--- a/eric6/Plugins/PluginEricdoc.py	Sat Oct 03 15:23:58 2020 +0200
+++ b/eric6/Plugins/PluginEricdoc.py	Sat Oct 03 15:24:48 2020 +0200
@@ -90,27 +90,6 @@
         "versionCleanup": (0, -1),
     })
     
-    # 3. Qt Collection Generator
-    exe = os.path.join(
-        Utilities.getQtBinariesPath(),
-        Utilities.generateQtToolName('qcollectiongenerator')
-    )
-    if Utilities.isWindowsPlatform():
-        exe += '.exe'
-    if Utilities.isExecutable(exe):
-        # assume Qt 5.,12 if it is missing
-        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