()
| 3511 | # main |
| 3512 | # ======================================================================================================================= |
| 3513 | def main(): |
| 3514 | # parse the command line. --file is our last argument that is required |
| 3515 | _log_initial_info() |
| 3516 | original_argv = sys.argv[:] |
| 3517 | try: |
| 3518 | from _pydevd_bundle.pydevd_command_line_handling import process_command_line |
| 3519 | |
| 3520 | setup = process_command_line(sys.argv) |
| 3521 | SetupHolder.setup = setup |
| 3522 | except ValueError: |
| 3523 | pydev_log.exception() |
| 3524 | usage(1) |
| 3525 | |
| 3526 | preimport = setup.get("preimport") |
| 3527 | if preimport: |
| 3528 | pydevd_defaults.PydevdCustomization.PREIMPORT = preimport |
| 3529 | |
| 3530 | debug_mode = setup.get("debug-mode") |
| 3531 | if debug_mode: |
| 3532 | pydevd_defaults.PydevdCustomization.DEBUG_MODE = debug_mode |
| 3533 | |
| 3534 | log_trace_level = setup.get("log-level") |
| 3535 | |
| 3536 | # Note: the logging info could've been changed (this would happen if this is a |
| 3537 | # subprocess and the value in the environment variable does not match the value in the |
| 3538 | # argument because the user used `pydevd.log_to` instead of supplying the environment |
| 3539 | # variable). If this is the case, update the logging info and re-log some information |
| 3540 | # in the new target. |
| 3541 | new_debug_file = setup.get("log-file") |
| 3542 | if new_debug_file and DebugInfoHolder.PYDEVD_DEBUG_FILE != new_debug_file: |
| 3543 | # The debug file can't be set directly, we need to use log_to() so that the a |
| 3544 | # new stream is actually created for the new file. |
| 3545 | log_to(new_debug_file, log_trace_level if log_trace_level is not None else 3) |
| 3546 | _log_initial_info() # The redirection info just changed, log it again. |
| 3547 | |
| 3548 | elif log_trace_level is not None: |
| 3549 | # The log file was not specified |
| 3550 | DebugInfoHolder.DEBUG_TRACE_LEVEL = log_trace_level |
| 3551 | pydev_log.debug("Original sys.argv: %s", original_argv) |
| 3552 | |
| 3553 | if setup["print-in-debugger-startup"]: |
| 3554 | try: |
| 3555 | pid = " (pid: %s)" % os.getpid() |
| 3556 | except: |
| 3557 | pid = "" |
| 3558 | sys.stderr.write("pydev debugger: starting%s\n" % pid) |
| 3559 | |
| 3560 | pydev_log.debug("Executing file %s", setup["file"]) |
| 3561 | pydev_log.debug("arguments: %s", (sys.argv,)) |
| 3562 | |
| 3563 | pydevd_vm_type.setup_type(setup.get("vm_type", None)) |
| 3564 | |
| 3565 | port = setup["port"] |
| 3566 | host = setup["client"] |
| 3567 | f = setup["file"] |
| 3568 | fix_app_engine_debug = False |
| 3569 | |
| 3570 | debugger = get_global_debugger() |
no test coverage detected