eric6/Debugger/DebuggerInterfacePython.py

branch
multi_processing
changeset 7422
9a008ab4811b
parent 7421
4a9900aef04e
child 7564
787684e6f2f3
equal deleted inserted replaced
7421:4a9900aef04e 7422:9a008ab4811b
224 '--no-encoding' or '') 224 '--no-encoding' or '')
225 else: 225 else:
226 redirect = str(Preferences.getDebugger("Python3Redirect")) 226 redirect = str(Preferences.getDebugger("Python3Redirect"))
227 noencoding = (Preferences.getDebugger("Python3NoEncoding") and 227 noencoding = (Preferences.getDebugger("Python3NoEncoding") and
228 '--no-encoding' or '') 228 '--no-encoding' or '')
229 multiprocessEnabled = (
230 '--multiprocess' if Preferences.getDebugger("MultiProcessEnabled")
231 else ''
232 )
229 233
230 if Preferences.getDebugger("RemoteDbgEnabled"): 234 if Preferences.getDebugger("RemoteDbgEnabled"):
231 ipaddr = self.debugServer.getHostAddress(False) 235 ipaddr = self.debugServer.getHostAddress(False)
232 rexec = Preferences.getDebugger("RemoteExecution") 236 rexec = Preferences.getDebugger("RemoteExecution")
233 rhost = Preferences.getDebugger("RemoteHost") 237 rhost = Preferences.getDebugger("RemoteHost")
234 if rhost == "": 238 if rhost == "":
235 rhost = "localhost" 239 rhost = "localhost"
236 if rexec: 240 if rexec:
237 args = Utilities.parseOptionString(rexec) + [ 241 args = Utilities.parseOptionString(rexec) + [
238 rhost, interpreter, debugClient, noencoding, str(port), 242 rhost, interpreter, debugClient]
239 redirect, ipaddr] 243 if noencoding:
244 args.append(noencoding)
245 if multiprocessEnabled:
246 args.append(multiprocessEnabled)
247 args.extend([str(port), redirect, ipaddr])
240 if Utilities.isWindowsPlatform(): 248 if Utilities.isWindowsPlatform():
241 if not os.path.splitext(args[0])[1]: 249 if not os.path.splitext(args[0])[1]:
242 for ext in [".exe", ".com", ".cmd", ".bat"]: 250 for ext in [".exe", ".com", ".cmd", ".bat"]:
243 prog = Utilities.getExecutablePath(args[0] + ext) 251 prog = Utilities.getExecutablePath(args[0] + ext)
244 if prog: 252 if prog:
299 ipaddr = self.debugServer.getHostAddress(True) 307 ipaddr = self.debugServer.getHostAddress(True)
300 if runInConsole or Preferences.getDebugger("ConsoleDbgEnabled"): 308 if runInConsole or Preferences.getDebugger("ConsoleDbgEnabled"):
301 ccmd = Preferences.getDebugger("ConsoleDbgCommand") 309 ccmd = Preferences.getDebugger("ConsoleDbgCommand")
302 if ccmd: 310 if ccmd:
303 args = Utilities.parseOptionString(ccmd) + [ 311 args = Utilities.parseOptionString(ccmd) + [
304 interpreter, os.path.abspath(debugClient), noencoding, 312 interpreter, os.path.abspath(debugClient)]
305 str(port), '0', ipaddr] 313 if noencoding:
314 args.append(noencoding)
315 if multiprocessEnabled:
316 args.append(multiprocessEnabled)
317 args.extend([str(port), '0', ipaddr])
306 args[0] = Utilities.getExecutablePath(args[0]) 318 args[0] = Utilities.getExecutablePath(args[0])
307 process = self.__startProcess(args[0], args[1:], clientEnv, 319 process = self.__startProcess(args[0], args[1:], clientEnv,
308 workingDir=workingDir) 320 workingDir=workingDir)
309 if process is None: 321 if process is None:
310 E5MessageBox.critical( 322 E5MessageBox.critical(
313 self.tr( 325 self.tr(
314 """<p>The debugger backend could not be""" 326 """<p>The debugger backend could not be"""
315 """ started.</p>""")) 327 """ started.</p>"""))
316 return process, self.__isNetworked, interpreter 328 return process, self.__isNetworked, interpreter
317 329
318 process = self.__startProcess( 330 args = [debugClient]
319 interpreter, 331 if noencoding:
320 [debugClient, noencoding, str(port), redirect, ipaddr], 332 args.append(noencoding)
321 clientEnv, 333 if multiprocessEnabled:
322 workingDir=workingDir) 334 args.append(multiprocessEnabled)
335 args.extend([str(port), redirect, ipaddr])
336 process = self.__startProcess(interpreter, args, clientEnv,
337 workingDir=workingDir)
323 if process is None: 338 if process is None:
324 self.__startedVenv = "" 339 self.__startedVenv = ""
325 E5MessageBox.critical( 340 E5MessageBox.critical(
326 None, 341 None,
327 self.tr("Start Debugger"), 342 self.tr("Start Debugger"),
368 elif project.getProjectLanguage() == "Python3": 383 elif project.getProjectLanguage() == "Python3":
369 venvName = Preferences.getDebugger("Python3VirtualEnv") 384 venvName = Preferences.getDebugger("Python3VirtualEnv")
370 385
371 redirect = str(project.getDebugProperty("REDIRECT")) 386 redirect = str(project.getDebugProperty("REDIRECT"))
372 noencoding = ( 387 noencoding = (
373 project.getDebugProperty("NOENCODING") and '--no-encoding' or '') 388 '--no-encoding' if project.getDebugProperty("NOENCODING") else ''
389 )
390 multiprocessEnabled = (
391 '--multiprocess' if Preferences.getDebugger("MultiProcessEnabled")
392 else ''
393 )
374 394
375 venvManager = e5App().getObject("VirtualEnvManager") 395 venvManager = e5App().getObject("VirtualEnvManager")
376 interpreter = venvManager.getVirtualenvInterpreter(venvName) 396 interpreter = venvManager.getVirtualenvInterpreter(venvName)
377 execPath = venvManager.getVirtualenvExecPath(venvName) 397 execPath = venvManager.getVirtualenvExecPath(venvName)
378 if (interpreter == "" and 398 if (interpreter == "" and
394 rhost = project.getDebugProperty("REMOTEHOST") 414 rhost = project.getDebugProperty("REMOTEHOST")
395 if rhost == "": 415 if rhost == "":
396 rhost = "localhost" 416 rhost = "localhost"
397 if rexec: 417 if rexec:
398 args = Utilities.parseOptionString(rexec) + [ 418 args = Utilities.parseOptionString(rexec) + [
399 rhost, interpreter, debugClient, noencoding, str(port), 419 rhost, interpreter, debugClient]
400 redirect, ipaddr] 420 if noencoding:
421 args.append(noencoding)
422 if multiprocessEnabled:
423 args.append(multiprocessEnabled)
424 args.extend([str(port), redirect, ipaddr])
401 if Utilities.isWindowsPlatform(): 425 if Utilities.isWindowsPlatform():
402 if not os.path.splitext(args[0])[1]: 426 if not os.path.splitext(args[0])[1]:
403 for ext in [".exe", ".com", ".cmd", ".bat"]: 427 for ext in [".exe", ".com", ".cmd", ".bat"]:
404 prog = Utilities.getExecutablePath(args[0] + ext) 428 prog = Utilities.getExecutablePath(args[0] + ext)
405 if prog: 429 if prog:
462 if runInConsole or project.getDebugProperty("CONSOLEDEBUGGER"): 486 if runInConsole or project.getDebugProperty("CONSOLEDEBUGGER"):
463 ccmd = (project.getDebugProperty("CONSOLECOMMAND") or 487 ccmd = (project.getDebugProperty("CONSOLECOMMAND") or
464 Preferences.getDebugger("ConsoleDbgCommand")) 488 Preferences.getDebugger("ConsoleDbgCommand"))
465 if ccmd: 489 if ccmd:
466 args = Utilities.parseOptionString(ccmd) + [ 490 args = Utilities.parseOptionString(ccmd) + [
467 interpreter, os.path.abspath(debugClient), noencoding, 491 interpreter, os.path.abspath(debugClient)]
468 str(port), '0', ipaddr] 492 if noencoding:
493 args.append(noencoding)
494 if multiprocessEnabled:
495 args.append(multiprocessEnabled)
496 args.extend([str(port), '0', ipaddr])
469 args[0] = Utilities.getExecutablePath(args[0]) 497 args[0] = Utilities.getExecutablePath(args[0])
470 process = self.__startProcess(args[0], args[1:], clientEnv, 498 process = self.__startProcess(args[0], args[1:], clientEnv,
471 workingDir=workingDir) 499 workingDir=workingDir)
472 if process is None: 500 if process is None:
473 E5MessageBox.critical( 501 E5MessageBox.critical(
476 self.tr( 504 self.tr(
477 """<p>The debugger backend could not be""" 505 """<p>The debugger backend could not be"""
478 """ started.</p>""")) 506 """ started.</p>"""))
479 return process, self.__isNetworked, interpreter 507 return process, self.__isNetworked, interpreter
480 508
481 process = self.__startProcess( 509 args = [debugClient]
482 interpreter, 510 if noencoding:
483 [debugClient, noencoding, str(port), redirect, ipaddr], 511 args.append(noencoding)
484 clientEnv, 512 if multiprocessEnabled:
485 workingDir=workingDir) 513 args.append(multiprocessEnabled)
514 args.extend([str(port), redirect, ipaddr])
515 process = self.__startProcess(interpreter, args, clientEnv,
516 workingDir=workingDir)
486 if process is None: 517 if process is None:
487 self.__startedVenv = "" 518 self.__startedVenv = ""
488 E5MessageBox.critical( 519 E5MessageBox.critical(
489 None, 520 None,
490 self.tr("Start Debugger"), 521 self.tr("Start Debugger"),

eric ide

mercurial