src/eric7/Globals/__init__.py

branch
eric7
changeset 9334
28e30230ab28
parent 9221
bf71ee032bb4
child 9336
c94f53ab789a
--- 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