Fixed a few bugs caused by using the new virtual environment manager.

Mon, 25 Jun 2018 18:20:06 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 25 Jun 2018 18:20:06 +0200
changeset 6367
7bc6fc02d981
parent 6366
6c1cd7e2902a
child 6368
18d1dcf4631d

Fixed a few bugs caused by using the new virtual environment manager.

Debugger/DebugServer.py file | annotate | diff | comparison | revisions
Utilities/BackgroundService.py file | annotate | diff | comparison | revisions
eric6.py file | annotate | diff | comparison | revisions
--- a/Debugger/DebugServer.py	Sun Jun 24 13:51:26 2018 +0200
+++ b/Debugger/DebugServer.py	Mon Jun 25 18:20:06 2018 +0200
@@ -1475,8 +1475,12 @@
         @param capabilities bitmaks with the client capabilities (integer)
         @param clientType type of the debug client (string)
         """
-        self.__debuggerInterfaceRegistry[clientType][0] = capabilities
-        self.clientCapabilities.emit(capabilities, clientType)
+        try:
+            self.__debuggerInterfaceRegistry[clientType][0] = capabilities
+            self.clientCapabilities.emit(capabilities, clientType)
+        except KeyError:
+            # ignore silently
+            pass
         
     def signalClientCompletionList(self, completionList, text):
         """
--- a/Utilities/BackgroundService.py	Sun Jun 24 13:51:26 2018 +0200
+++ b/Utilities/BackgroundService.py	Mon Jun 25 18:20:06 2018 +0200
@@ -73,6 +73,8 @@
                 pyName + "VirtualEnv")
             interpreter = e5App().getObject("VirtualEnvManager")\
                 .getVirtualenvInterpreter(venvName)
+            if not interpreter and int(pyName[-1]) == sys.version_info[0]:
+                interpreter = sys.executable
             if interpreter:
                 process = self.__startExternalClient(interpreter, port)
                 if process:
@@ -247,12 +249,13 @@
         """
         Public slot to restart the built in languages.
         """
-        for pyName in ['Python', 'Python3']:
-            interpreter = Preferences.getDebugger(
-                pyName + "Interpreter")
-            
-            if pyName == 'Python':
-                pyName = 'Python2'
+        for pyName in ['Python2', 'Python3']:
+            venvName = Preferences.getDebugger(
+                pyName + "VirtualEnv")
+            interpreter = e5App().getObject("VirtualEnvManager")\
+                .getVirtualenvInterpreter(venvName)
+            if not interpreter and int(pyName[-1]) == sys.version_info[0]:
+                interpreter = sys.executable
             
             # Tweak the processes list to reflect the changed interpreter
             proc, inter = self.processes.pop(pyName, [None, None])
@@ -284,10 +287,11 @@
         if proc:
             proc.close()
         
-        port = self.serverPort()
-        process = self.__startExternalClient(interpreter, port)
-        if process:
-            self.processes[language] = process, interpreter
+        if interpreter:
+            port = self.serverPort()
+            process = self.__startExternalClient(interpreter, port)
+            if process:
+                self.processes[language] = process, interpreter
 
     def enqueueRequest(self, fx, lang, fn, data):
         """
--- a/eric6.py	Sun Jun 24 13:51:26 2018 +0200
+++ b/eric6.py	Mon Jun 25 18:20:06 2018 +0200
@@ -34,7 +34,7 @@
 
 try:
     try:
-        from PyQt5 import sip
+        from PyQt5 import sip       # __IGNORE_EXCEPTION__
     except ImportError:
         import sip
     sip.setdestroyonexit(False)

eric ide

mercurial