Debugger/DebuggerInterfacePython.py

changeset 6581
8eb6220f2bb7
parent 6576
ea60ea85067a
child 6584
33ea6f430eb8
equal deleted inserted replaced
6580:082d58e2415e 6581:8eb6220f2bb7
129 if not proc.waitForStarted(10000): 129 if not proc.waitForStarted(10000):
130 proc = None 130 proc = None
131 131
132 return proc 132 return proc
133 133
134 def startRemote(self, port, runInConsole, venvName): 134 def startRemote(self, port, runInConsole, venvName, originalPathString):
135 """ 135 """
136 Public method to start a remote Python interpreter. 136 Public method to start a remote Python interpreter.
137 137
138 @param port port number the debug server is listening on 138 @param port port number the debug server is listening on
139 @type int 139 @type int
140 @param runInConsole flag indicating to start the debugger in a 140 @param runInConsole flag indicating to start the debugger in a
141 console window 141 console window
142 @type bool 142 @type bool
143 @param venvName name of the virtual environment to be used 143 @param venvName name of the virtual environment to be used
144 @type str 144 @type str
145 @param originalPathString original PATH environment variable
146 @type str
145 @return client process object, a flag to indicate a network connection 147 @return client process object, a flag to indicate a network connection
146 and the name of the interpreter in case of a local execution 148 and the name of the interpreter in case of a local execution
147 @rtype tuple of (QProcess, bool, str) 149 @rtype tuple of (QProcess, bool, str)
148 """ 150 """
151 global origPathEnv
152
149 if not venvName: 153 if not venvName:
150 if self.__variant == "Python2": 154 if self.__variant == "Python2":
151 venvName = Preferences.getDebugger("Python2VirtualEnv") 155 venvName = Preferences.getDebugger("Python2VirtualEnv")
152 else: 156 else:
153 venvName = Preferences.getDebugger("Python3VirtualEnv") 157 venvName = Preferences.getDebugger("Python3VirtualEnv")
231 # setup the environment for the debugger 235 # setup the environment for the debugger
232 if Preferences.getDebugger("DebugEnvironmentReplace"): 236 if Preferences.getDebugger("DebugEnvironmentReplace"):
233 clientEnv = {} 237 clientEnv = {}
234 else: 238 else:
235 clientEnv = os.environ.copy() 239 clientEnv = os.environ.copy()
240 if originalPathString:
241 clientEnv["PATH"] = originalPathString
236 envlist = Utilities.parseEnvironmentString( 242 envlist = Utilities.parseEnvironmentString(
237 Preferences.getDebugger("DebugEnvironment")) 243 Preferences.getDebugger("DebugEnvironment"))
238 for el in envlist: 244 for el in envlist:
239 try: 245 try:
240 key, value = el.split('=', 1) 246 key, value = el.split('=', 1)
282 else: 288 else:
283 self.__startedVenv = venvName 289 self.__startedVenv = venvName
284 290
285 return process, self.__isNetworked, interpreter 291 return process, self.__isNetworked, interpreter
286 292
287 def startRemoteForProject(self, port, runInConsole, venvName): 293 def startRemoteForProject(self, port, runInConsole, venvName,
294 originalPathString):
288 """ 295 """
289 Public method to start a remote Python interpreter for a project. 296 Public method to start a remote Python interpreter for a project.
290 297
291 @param port port number the debug server is listening on 298 @param port port number the debug server is listening on
292 @type int 299 @type int
293 @param runInConsole flag indicating to start the debugger in a 300 @param runInConsole flag indicating to start the debugger in a
294 console window 301 console window
295 @type bool 302 @type bool
296 @param venvName name of the virtual environment to be used 303 @param venvName name of the virtual environment to be used
297 @type str 304 @type str
305 @param originalPathString original PATH environment variable
306 @type str
298 @return client process object, a flag to indicate a network connection 307 @return client process object, a flag to indicate a network connection
299 and the name of the interpreter in case of a local execution 308 and the name of the interpreter in case of a local execution
300 @rtype tuple of (QProcess, bool, str) 309 @rtype tuple of (QProcess, bool, str)
301 """ 310 """
311 global origPathEnv
312
302 project = e5App().getObject("Project") 313 project = e5App().getObject("Project")
303 if not project.isDebugPropertiesLoaded(): 314 if not project.isDebugPropertiesLoaded():
304 return None, self.__isNetworked, "" 315 return None, self.__isNetworked, ""
305 316
306 # start debugger with project specific settings 317 # start debugger with project specific settings
369 # setup the environment for the debugger 380 # setup the environment for the debugger
370 if project.getDebugProperty("ENVIRONMENTOVERRIDE"): 381 if project.getDebugProperty("ENVIRONMENTOVERRIDE"):
371 clientEnv = {} 382 clientEnv = {}
372 else: 383 else:
373 clientEnv = os.environ.copy() 384 clientEnv = os.environ.copy()
385 if originalPathString:
386 clientEnv["PATH"] = originalPathString
374 envlist = Utilities.parseEnvironmentString( 387 envlist = Utilities.parseEnvironmentString(
375 project.getDebugProperty("ENVIRONMENTSTRING")) 388 project.getDebugProperty("ENVIRONMENTSTRING"))
376 for el in envlist: 389 for el in envlist:
377 try: 390 try:
378 key, value = el.split('=', 1) 391 key, value = el.split('=', 1)

eric ide

mercurial