Corrected the determination of the PyQt tools path to consider the configured virtual environments. eric7

Mon, 19 Sep 2022 11:58:40 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 19 Sep 2022 11:58:40 +0200
branch
eric7
changeset 9334
28e30230ab28
parent 9333
b0541ec21e51
child 9335
ec381c083dbd

Corrected the determination of the PyQt tools path to consider the configured virtual environments.

src/eric7/Globals/__init__.py file | annotate | diff | comparison | revisions
--- a/src/eric7/Globals/__init__.py	Mon Sep 19 10:42:51 2022 +0200
+++ b/src/eric7/Globals/__init__.py	Mon Sep 19 11:58:40 2022 +0200
@@ -310,23 +310,32 @@
     # step 1: check, if the user has configured a tools path
     if version == 5:
         toolsPath = Preferences.getQt("PyQtToolsDir")
+        venvName = Preferences.getQt("PyQtVenvName")
     elif version == 6:
         toolsPath = Preferences.getQt("PyQt6ToolsDir")
+        venvName = Preferences.getQt("PyQt6VenvName")
 
     # step 2: determine from used Python interpreter (pylupdate is test object)
     if not toolsPath:
         program = "pylupdate{0}".format(version)
+        if venvName:
+            from EricWidgets.EricApplication import ericApp
+            venvManager = ericApp().getObject("VirtualEnvManager")
+            dirName = venvManager.getVirtualenvDirectory(venvName)
+        else:
+            dirName = os.path.dirname(sys.executable)
+
         if isWindowsPlatform():
             program += ".exe"
-            dirName = os.path.dirname(sys.executable)
             if os.path.exists(os.path.join(dirName, program)):
                 toolsPath = dirName
             elif os.path.exists(os.path.join(dirName, "Scripts", program)):
                 toolsPath = os.path.join(dirName, "Scripts")
         else:
-            dirName = os.path.dirname(sys.executable)
             if os.path.exists(os.path.join(dirName, program)):
                 toolsPath = dirName
+            elif os.path.exists(os.path.join(dirName, "bin", program)):
+                toolsPath = os.path.join(dirName, "bin")
 
     return toolsPath
 

eric ide

mercurial