src/eric7/Globals/__init__.py

branch
eric7-maintenance
changeset 9442
906485dcd210
parent 9371
1da8bc75946f
parent 9420
92810aebc909
child 9449
c982bacca23f
--- a/src/eric7/Globals/__init__.py	Sun Oct 02 11:44:07 2022 +0200
+++ b/src/eric7/Globals/__init__.py	Sat Oct 29 15:24:59 2022 +0200
@@ -15,6 +15,7 @@
 import os
 import re
 import sys
+import sysconfig
 
 from PyQt6.QtCore import (
     QByteArray,
@@ -274,9 +275,17 @@
     @return path to the Python library directory
     @rtype str
     """
-    import sysconfig
+    return sysconfig.get_path("platlib")
+
 
-    return sysconfig.get_path("platlib")
+def getPythonScriptsDirectory():
+    """
+    Function to determine the path to Python's scripts directory.
+
+    @return path to the Python scripts directory
+    @rtype str
+    """
+    return sysconfig.get_path("scripts")
 
 
 def getPyQt6ModulesDirectory():
@@ -304,7 +313,7 @@
     @return path to the PyQt tools
     @rtype str
     """
-    import Preferences
+    from eric7 import Preferences
 
     toolsPath = ""
 
@@ -320,7 +329,7 @@
     if not toolsPath:
         program = "pylupdate{0}".format(version)
         if venvName:
-            from EricWidgets.EricApplication import ericApp
+            from eric7.EricWidgets.EricApplication import ericApp
 
             venvManager = ericApp().getObject("VirtualEnvManager")
             dirName = venvManager.getVirtualenvDirectory(venvName)
@@ -352,7 +361,7 @@
     @return path of the Qt binaries
     @rtype str
     """
-    import Preferences
+    from eric7 import Preferences
 
     binPath = ""
 
@@ -402,15 +411,10 @@
         program = "designer"
         if isWindowsPlatform():
             program += ".exe"
-            dirName = os.path.dirname(sys.executable)
-            if os.path.exists(os.path.join(dirName, program)):
-                binPath = dirName
-            elif os.path.exists(os.path.join(dirName, "Scripts", program)):
-                binPath = os.path.join(dirName, "Scripts")
-        else:
-            dirName = os.path.dirname(sys.executable)
-            if os.path.exists(os.path.join(dirName, program)):
-                binPath = dirName
+
+        progPath = os.path.join(getPythonScriptsDirectory(), program)
+        if os.path.exists(progPath):
+            binPath = getPythonScriptsDirectory()
 
     return QDir.toNativeSeparators(binPath)
 

eric ide

mercurial