285 @param noRedirect flag indicating to not redirect stdin and stdout |
287 @param noRedirect flag indicating to not redirect stdin and stdout |
286 @type bool |
288 @type bool |
287 @return modified argument list |
289 @return modified argument list |
288 @rtype list of str |
290 @rtype list of str |
289 """ |
291 """ |
|
292 debugClientScript = os.path.join( |
|
293 os.path.dirname(__file__), "DebugClient.py") |
|
294 if debugClientScript in arguments: |
|
295 # it is already patched |
|
296 return arguments |
|
297 |
290 args = list(arguments[:]) # create a copy of the arguments list |
298 args = list(arguments[:]) # create a copy of the arguments list |
291 args = removeQuotesFromArgs(args) |
299 args = removeQuotesFromArgs(args) |
292 |
300 |
293 # support for shebang line |
301 # support for shebang line |
294 program = os.path.basename(args[0]).lower() |
302 program = os.path.basename(args[0]).lower() |
296 if pyname in program: |
304 if pyname in program: |
297 break |
305 break |
298 else: |
306 else: |
299 if not isWindowsPlatform() and startsWithShebang(args[0]): |
307 if not isWindowsPlatform() and startsWithShebang(args[0]): |
300 # insert our interpreter as first argument |
308 # insert our interpreter as first argument |
|
309 args.insert(0, sys.executable) |
|
310 elif isWindowsPlatform() and args[0].lower().endswith(".py"): |
|
311 # it is a Python script; insert our interpreter as first argument |
301 args.insert(0, sys.executable) |
312 args.insert(0, sys.executable) |
302 |
313 |
303 # check for -m invocation => debugging not supported yet |
314 # check for -m invocation => debugging not supported yet |
304 if "-m" in args: |
315 if "-m" in args: |
305 cm_position = args.index("-m") |
316 cm_position = args.index("-m") |
344 ) = debugClient.startOptions[:7] |
355 ) = debugClient.startOptions[:7] |
345 |
356 |
346 modifiedArguments = [interpreter] |
357 modifiedArguments = [interpreter] |
347 modifiedArguments.extend(interpreterArgs) |
358 modifiedArguments.extend(interpreterArgs) |
348 modifiedArguments.extend([ |
359 modifiedArguments.extend([ |
349 os.path.join(os.path.dirname(__file__), "DebugClient.py"), |
360 debugClientScript, |
350 "-h", host, |
361 "-h", host, |
351 "-p", str(port), |
362 "-p", str(port), |
352 "--no-passive", |
363 "--no-passive", |
353 ]) |
364 ]) |
354 |
365 |