Debugger/DebuggerInterfacePython.py

branch
maintenance
changeset 6826
c6dda2cbe081
parent 6822
f34e48fdfd92
child 6848
7682182a0f0f
equal deleted inserted replaced
6764:d14ddbfbbd36 6826:c6dda2cbe081
73 if passive: 73 if passive:
74 # set translation function 74 # set translation function
75 if Preferences.getDebugger("PathTranslation"): 75 if Preferences.getDebugger("PathTranslation"):
76 self.translateRemote = \ 76 self.translateRemote = \
77 Preferences.getDebugger("PathTranslationRemote") 77 Preferences.getDebugger("PathTranslationRemote")
78 self.translateRemoteWindows = "\\" in self.translateRemote
78 self.translateLocal = \ 79 self.translateLocal = \
79 Preferences.getDebugger("PathTranslationLocal") 80 Preferences.getDebugger("PathTranslationLocal")
81 self.translateLocalWindows = "\\" in self.translateLocal
80 self.translate = self.__remoteTranslation 82 self.translate = self.__remoteTranslation
81 else: 83 else:
82 self.translate = self.__identityTranslation 84 self.translate = self.__identityTranslation
83 85
84 # attribute to remember the name of the executed script 86 # attribute to remember the name of the executed script
103 @param remote2local flag indicating the direction of translation 105 @param remote2local flag indicating the direction of translation
104 (False = local to remote, True = remote to local [default]) 106 (False = local to remote, True = remote to local [default])
105 @return translated filename (string) 107 @return translated filename (string)
106 """ 108 """
107 if remote2local: 109 if remote2local:
108 return fn.replace(self.translateRemote, self.translateLocal) 110 path = fn.replace(self.translateRemote, self.translateLocal)
111 if self.translateLocalWindows:
112 path = path.replace("/", "\\")
109 else: 113 else:
110 return fn.replace(self.translateLocal, self.translateRemote) 114 path = fn.replace(self.translateLocal, self.translateRemote)
115 if not self.translateRemoteWindows:
116 path = path.replace("\\", "/")
117
118 return path
111 119
112 def __startProcess(self, program, arguments, environment=None, 120 def __startProcess(self, program, arguments, environment=None,
113 workingDir=None): 121 workingDir=None):
114 """ 122 """
115 Private method to start the debugger client process. 123 Private method to start the debugger client process.
233 241
234 # set translation function 242 # set translation function
235 if Preferences.getDebugger("PathTranslation"): 243 if Preferences.getDebugger("PathTranslation"):
236 self.translateRemote = \ 244 self.translateRemote = \
237 Preferences.getDebugger("PathTranslationRemote") 245 Preferences.getDebugger("PathTranslationRemote")
246 self.translateRemoteWindows = "\\" in self.translateRemote
238 self.translateLocal = \ 247 self.translateLocal = \
239 Preferences.getDebugger("PathTranslationLocal") 248 Preferences.getDebugger("PathTranslationLocal")
240 self.translate = self.__remoteTranslation 249 self.translate = self.__remoteTranslation
250 self.translateLocalWindows = "\\" in self.translateLocal
241 else: 251 else:
242 self.translate = self.__identityTranslation 252 self.translate = self.__identityTranslation
243 return process, self.__isNetworked, "" 253 return process, self.__isNetworked, ""
244 254
245 # set translation function 255 # set translation function
367 rhost = project.getDebugProperty("REMOTEHOST") 377 rhost = project.getDebugProperty("REMOTEHOST")
368 if rhost == "": 378 if rhost == "":
369 rhost = "localhost" 379 rhost = "localhost"
370 if rexec: 380 if rexec:
371 args = Utilities.parseOptionString(rexec) + \ 381 args = Utilities.parseOptionString(rexec) + \
372 [rhost, interpreter, os.path.abspath(debugClient), 382 [rhost, interpreter, debugClient, noencoding,
373 noencoding, str(port), redirect, ipaddr] 383 str(port), redirect, ipaddr]
374 args[0] = Utilities.getExecutablePath(args[0]) 384 args[0] = Utilities.getExecutablePath(args[0])
375 process = self.__startProcess(args[0], args[1:], 385 process = self.__startProcess(args[0], args[1:],
376 workingDir=workingDir) 386 workingDir=workingDir)
377 if process is None: 387 if process is None:
378 E5MessageBox.critical( 388 E5MessageBox.critical(
383 """ started.</p>""")) 393 """ started.</p>"""))
384 # set translation function 394 # set translation function
385 if project.getDebugProperty("PATHTRANSLATION"): 395 if project.getDebugProperty("PATHTRANSLATION"):
386 self.translateRemote = \ 396 self.translateRemote = \
387 project.getDebugProperty("REMOTEPATH") 397 project.getDebugProperty("REMOTEPATH")
398 self.translateRemoteWindows = "\\" in self.translateRemote
388 self.translateLocal = \ 399 self.translateLocal = \
389 project.getDebugProperty("LOCALPATH") 400 project.getDebugProperty("LOCALPATH")
401 self.translateLocalWindows = "\\" in self.translateLocal
390 self.translate = self.__remoteTranslation 402 self.translate = self.__remoteTranslation
391 else: 403 else:
392 self.translate = self.__identityTranslation 404 self.translate = self.__identityTranslation
393 return process, self.__isNetworked, "" 405 return process, self.__isNetworked, ""
394 406 else:
407 # remote shell command is missing
408 return None, self.__isNetworked, ""
409
395 # set translation function 410 # set translation function
396 self.translate = self.__identityTranslation 411 self.translate = self.__identityTranslation
397 412
398 # setup the environment for the debugger 413 # setup the environment for the debugger
399 if project.getDebugProperty("ENVIRONMENTOVERRIDE"): 414 if project.getDebugProperty("ENVIRONMENTOVERRIDE"):

eric ide

mercurial