eric6/Debugger/DebuggerInterfacePython.py

changeset 7635
0cdead130a81
parent 7429
6983c461550f
child 7637
c878e8255972
diff -r 8c3d033e5044 -r 0cdead130a81 eric6/Debugger/DebuggerInterfacePython.py
--- a/eric6/Debugger/DebuggerInterfacePython.py	Sat Jun 20 17:36:20 2020 +0200
+++ b/eric6/Debugger/DebuggerInterfacePython.py	Sun Jun 21 18:26:12 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__()
         
@@ -55,7 +53,6 @@
         self.debugServer = debugServer
         self.passive = passive
         self.process = None
-        self.__variant = pythonVariant
         self.__startedVenv = ""
         
         self.qsock = None
@@ -171,15 +168,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 == "":
@@ -187,36 +180,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 '')
         
         if Preferences.getDebugger("RemoteDbgEnabled"):
             ipaddr = self.debugServer.getHostAddress(False)
@@ -354,9 +336,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"))
@@ -375,8 +355,8 @@
                 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"):
@@ -1305,21 +1285,6 @@
         self.qsock.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.
@@ -1332,7 +1297,7 @@
     @return instantiated debugger interface
     @rtype DebuggerInterfacePython
     """
-    return DebuggerInterfacePython(debugServer, passive, "Python3")
+    return DebuggerInterfacePython(debugServer, passive)
 
 
 def getRegistryData():
@@ -1345,13 +1310,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("."):
@@ -1360,13 +1318,6 @@
             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):
         registryData.append(

eric ide

mercurial