eric6/Debugger/DebuggerInterfacePython.py

branch
multi_processing
changeset 7646
39e3db2b4936
parent 7564
787684e6f2f3
parent 7639
422fd05e9c91
child 7802
eefe954f01e8
diff -r 812ee8c0a91a -r 39e3db2b4936 eric6/Debugger/DebuggerInterfacePython.py
--- a/eric6/Debugger/DebuggerInterfacePython.py	Wed Jun 17 17:14:12 2020 +0200
+++ b/eric6/Debugger/DebuggerInterfacePython.py	Sun Jul 05 11:11:24 2020 +0200
@@ -33,10 +33,10 @@
 
 class DebuggerInterfacePython(QObject):
     """
-    Class implementing the debugger interface for the debug server for Python 2
-    and Python 3.
+    Class implementing the debugger interface for the debug server for
+    Python 3.
     """
-    def __init__(self, debugServer, passive, pythonVariant):
+    def __init__(self, debugServer, passive):
         """
         Constructor
         
@@ -44,8 +44,6 @@
         @type DebugServer
         @param passive flag indicating passive connection mode
         @type bool
-        @param pythonVariant Python variant to instantiate for
-        @type str (one of Python2 or Python3)
         """
         super(DebuggerInterfacePython, self).__init__()
         
@@ -56,7 +54,6 @@
         self.debugServer = debugServer
         self.passive = passive
         self.process = None
-        self.__variant = pythonVariant
         self.__startedVenv = ""
         
         self.queue = []
@@ -180,15 +177,11 @@
         global origPathEnv
         
         if not venvName:
-            if self.__variant == "Python2":
-                venvName = Preferences.getDebugger("Python2VirtualEnv")
-            else:
-                venvName = Preferences.getDebugger("Python3VirtualEnv")
+            venvName = Preferences.getDebugger("Python3VirtualEnv")
         venvManager = e5App().getObject("VirtualEnvManager")
         interpreter = venvManager.getVirtualenvInterpreter(venvName)
         execPath = venvManager.getVirtualenvExecPath(venvName)
-        if (interpreter == "" and
-                int(self.__variant[-1]) == sys.version_info[0]):
+        if interpreter == "":
             # use the interpreter used to run eric for identical variants
             interpreter = sys.executable.replace("w.exe", ".exe")
         if interpreter == "":
@@ -196,36 +189,25 @@
                 None,
                 self.tr("Start Debugger"),
                 self.tr(
-                    """<p>No suitable {0} environment configured.</p>""")
-                .format(self.__variant))
+                    """<p>No suitable Python3 environment configured.</p>""")
+            )
             return None, False, ""
         
-        if self.__variant == "Python2":
-            debugClientType = Preferences.getDebugger("DebugClientType")
-        else:
-            debugClientType = Preferences.getDebugger("DebugClientType3")
+        debugClientType = Preferences.getDebugger("DebugClientType3")
         if debugClientType == "standard":
             debugClient = os.path.join(getConfig('ericDir'),
                                        "DebugClients", "Python",
                                        "DebugClient.py")
         else:
-            if self.__variant == "Python2":
-                debugClient = Preferences.getDebugger("DebugClient")
-            else:
-                debugClient = Preferences.getDebugger("DebugClient3")
+            debugClient = Preferences.getDebugger("DebugClient3")
             if debugClient == "":
                 debugClient = os.path.join(sys.path[0],
                                            "DebugClients", "Python",
                                            "DebugClient.py")
         
-        if self.__variant == "Python2":
-            redirect = str(Preferences.getDebugger("PythonRedirect"))
-            noencoding = (Preferences.getDebugger("PythonNoEncoding") and
-                          '--no-encoding' or '')
-        else:
-            redirect = str(Preferences.getDebugger("Python3Redirect"))
-            noencoding = (Preferences.getDebugger("Python3NoEncoding") and
-                          '--no-encoding' or '')
+        redirect = str(Preferences.getDebugger("Python3Redirect"))
+        noencoding = (Preferences.getDebugger("Python3NoEncoding") and
+                      '--no-encoding' or '')
         multiprocessEnabled = (
             '--multiprocess' if Preferences.getDebugger("MultiProcessEnabled")
             else ''
@@ -378,9 +360,7 @@
         if not venvName:
             venvName = project.getDebugProperty("VIRTUALENV")
         if not venvName:
-            if project.getProjectLanguage() == "Python2":
-                venvName = Preferences.getDebugger("Python2VirtualEnv")
-            elif project.getProjectLanguage() == "Python3":
+            if project.getProjectLanguage() == "Python3":
                 venvName = Preferences.getDebugger("Python3VirtualEnv")
         
         redirect = str(project.getDebugProperty("REDIRECT"))
@@ -395,17 +375,18 @@
         venvManager = e5App().getObject("VirtualEnvManager")
         interpreter = venvManager.getVirtualenvInterpreter(venvName)
         execPath = venvManager.getVirtualenvExecPath(venvName)
-        if (interpreter == "" and
-            project.getProjectLanguage().startswith("Python") and
-                sys.version_info[0] == int(project.getProjectLanguage()[-1])):
+        if (
+            interpreter == "" and
+            project.getProjectLanguage().startswith("Python")
+        ):
             interpreter = sys.executable.replace("w.exe", ".exe")
         if interpreter == "":
             E5MessageBox.critical(
                 None,
                 self.tr("Start Debugger"),
                 self.tr(
-                    """<p>No suitable {0} environment configured.</p>""")
-                .format(self.__variant))
+                    """<p>No suitable Python3 environment configured.</p>""")
+            )
             return None, self.__isNetworked, ""
         
         if project.getDebugProperty("REMOTEDEBUGGER"):
@@ -1624,21 +1605,6 @@
         sock.flush()
 
 
-def createDebuggerInterfacePython2(debugServer, passive):
-    """
-    Module function to create a debugger interface instance.
-    
-        
-    @param debugServer reference to the debug server
-    @type DebugServer
-    @param passive flag indicating passive connection mode
-    @type bool
-    @return instantiated debugger interface
-    @rtype DebuggerInterfacePython
-    """
-    return DebuggerInterfacePython(debugServer, passive, "Python2")
-    
-
 def createDebuggerInterfacePython3(debugServer, passive):
     """
     Module function to create a debugger interface instance.
@@ -1651,7 +1617,7 @@
     @return instantiated debugger interface
     @rtype DebuggerInterfacePython
     """
-    return DebuggerInterfacePython(debugServer, passive, "Python3")
+    return DebuggerInterfacePython(debugServer, passive)
 
 
 def getRegistryData():
@@ -1664,13 +1630,6 @@
         function
     @rtype list of tuple of (str, int, list of str, function)
     """
-    py2Exts = []
-    for ext in Preferences.getDebugger("PythonExtensions").split():
-        if ext.startswith("."):
-            py2Exts.append(ext)
-        else:
-            py2Exts.append(".{0}".format(ext))
-    
     py3Exts = []
     for ext in Preferences.getDebugger("Python3Extensions").split():
         if ext.startswith("."):
@@ -1679,15 +1638,7 @@
             py3Exts.append(".{0}".format(ext))
     
     registryData = []
-    if py2Exts and (Preferences.getDebugger("Python2VirtualEnv") or
-                    sys.version_info[0] == 2):
-        registryData.append(
-            ("Python2", ClientDefaultCapabilities, py2Exts,
-             createDebuggerInterfacePython2)
-        )
-    
-    if py3Exts and (Preferences.getDebugger("Python3VirtualEnv") or
-                    sys.version_info[0] >= 3):
+    if py3Exts:
         registryData.append(
             ("Python3", ClientDefaultCapabilities, py3Exts,
                 createDebuggerInterfacePython3)

eric ide

mercurial