mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Rename ptvsd.adapter submodules to avoid name clashes with variables.
This commit is contained in:
parent
095e5bcd5c
commit
489dd4200d
8 changed files with 33 additions and 32 deletions
|
|
@ -2,11 +2,11 @@
|
|||
# Licensed under the MIT License. See LICENSE in the project root
|
||||
# for license information.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__all__ = []
|
||||
|
||||
import os.path
|
||||
import os
|
||||
|
||||
# Force absolute path on Python 2.
|
||||
__file__ = os.path.abspath(__file__)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# Licensed under the MIT License. See LICENSE in the project root
|
||||
# for license information.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import argparse
|
||||
import json
|
||||
|
|
@ -19,7 +19,7 @@ __file__ = os.path.abspath(__file__)
|
|||
|
||||
def main(args):
|
||||
from ptvsd.common import log, options as common_options
|
||||
from ptvsd.adapter import ide, server, session, options as adapter_options
|
||||
from ptvsd.adapter import ide, servers, sessions, options as adapter_options
|
||||
|
||||
if args.log_stderr:
|
||||
log.stderr.levels |= set(log.LEVELS)
|
||||
|
|
@ -34,7 +34,7 @@ def main(args):
|
|||
log.error("--for-enable-attach requires --port")
|
||||
sys.exit(64)
|
||||
|
||||
server_host, server_port = server.listen()
|
||||
server_host, server_port = servers.listen()
|
||||
ide_host, ide_port = ide.listen(port=args.port)
|
||||
|
||||
if args.for_enable_attach:
|
||||
|
|
@ -49,10 +49,10 @@ def main(args):
|
|||
if args.port is None:
|
||||
ide.IDE("stdio")
|
||||
|
||||
server.wait_until_disconnected()
|
||||
servers.wait_until_disconnected()
|
||||
log.info("All debug servers disconnected; waiting for remaining sessions...")
|
||||
|
||||
session.wait_until_ended()
|
||||
sessions.wait_until_ended()
|
||||
log.info("All debug sessions have ended; exiting.")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
# Licensed under the MIT License. See LICENSE in the project root
|
||||
# for license information.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import functools
|
||||
|
||||
from ptvsd.common import fmt, json, log, messaging, util
|
||||
|
||||
|
||||
ACCEPT_CONNECTIONS_TIMEOUT = 10
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# Licensed under the MIT License. See LICENSE in the project root
|
||||
# for license information.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import os
|
||||
import platform
|
||||
|
|
@ -11,7 +11,7 @@ import sys
|
|||
import ptvsd
|
||||
from ptvsd.common import json, log, messaging, sockets
|
||||
from ptvsd.common.compat import unicode
|
||||
from ptvsd.adapter import components, server, session
|
||||
from ptvsd.adapter import components, servers, sessions
|
||||
|
||||
|
||||
class IDE(components.Component, sockets.ClientConnection):
|
||||
|
|
@ -46,8 +46,8 @@ class IDE(components.Component, sockets.ClientConnection):
|
|||
else:
|
||||
stream = messaging.JsonIOStream.from_socket(sock)
|
||||
|
||||
with session.Session() as new_session:
|
||||
super(IDE, self).__init__(new_session, stream)
|
||||
with sessions.Session() as session:
|
||||
super(IDE, self).__init__(session, stream)
|
||||
|
||||
self.client_id = None
|
||||
"""ID of the connecting client. This can be 'test' while running tests."""
|
||||
|
|
@ -70,8 +70,8 @@ class IDE(components.Component, sockets.ClientConnection):
|
|||
only if and when the "launch" or "attach" response is sent.
|
||||
"""
|
||||
|
||||
new_session.ide = self
|
||||
new_session.register()
|
||||
session.ide = self
|
||||
session.register()
|
||||
|
||||
self.channel.send_event(
|
||||
"output",
|
||||
|
|
@ -162,7 +162,7 @@ class IDE(components.Component, sockets.ClientConnection):
|
|||
|
||||
self.session.no_debug = request("noDebug", json.default(False))
|
||||
if self.session.no_debug:
|
||||
server.dont_expect_connections()
|
||||
servers.dont_expect_connections()
|
||||
|
||||
self.session.debug_options = debug_options = set(
|
||||
request("debugOptions", json.array(unicode))
|
||||
|
|
@ -222,7 +222,7 @@ class IDE(components.Component, sockets.ClientConnection):
|
|||
|
||||
@_start_message_handler
|
||||
def launch_request(self, request):
|
||||
from ptvsd.adapter import launcher
|
||||
from ptvsd.adapter import launchers
|
||||
|
||||
sudo = request("sudo", json.default("Sudo" in self.session.debug_options))
|
||||
if sudo:
|
||||
|
|
@ -261,7 +261,7 @@ class IDE(components.Component, sockets.ClientConnection):
|
|||
)
|
||||
console_title = request("consoleTitle", json.default("Python Debug Console"))
|
||||
|
||||
launcher.spawn_debuggee(
|
||||
launchers.spawn_debuggee(
|
||||
self.session, request, sudo, args, console, console_title
|
||||
)
|
||||
|
||||
|
|
@ -304,7 +304,7 @@ class IDE(components.Component, sockets.ClientConnection):
|
|||
'"processId" and "subProcessId" are mutually exclusive'
|
||||
)
|
||||
ptvsd_args = request("ptvsdArgs", json.array(unicode))
|
||||
server.inject(pid, ptvsd_args)
|
||||
servers.inject(pid, ptvsd_args)
|
||||
timeout = 10
|
||||
else:
|
||||
if sub_pid == ():
|
||||
|
|
@ -314,7 +314,7 @@ class IDE(components.Component, sockets.ClientConnection):
|
|||
pid = sub_pid
|
||||
timeout = 0
|
||||
|
||||
conn = server.wait_for_connection(pid, timeout)
|
||||
conn = servers.wait_for_connection(pid, timeout)
|
||||
if conn is None:
|
||||
raise request.cant_handle(
|
||||
(
|
||||
|
|
@ -351,7 +351,7 @@ class IDE(components.Component, sockets.ClientConnection):
|
|||
|
||||
# Notify the IDE of any child processes of the debuggee that aren't already
|
||||
# being debugged.
|
||||
for conn in server.connections():
|
||||
for conn in servers.connections():
|
||||
if conn.server is None and conn.ppid == self.session.pid:
|
||||
# FIXME: race condition with server.Connection()
|
||||
self.notify_of_subprocess(conn)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# Licensed under the MIT License. See LICENSE in the project root
|
||||
# for license information.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
|
@ -10,7 +10,7 @@ import sys
|
|||
|
||||
import ptvsd.launcher
|
||||
from ptvsd.common import compat, log, messaging, options as common_options
|
||||
from ptvsd.adapter import components, options as adapter_options, server
|
||||
from ptvsd.adapter import components, servers, options as adapter_options
|
||||
|
||||
|
||||
class Launcher(components.Component):
|
||||
|
|
@ -110,7 +110,7 @@ def spawn_debuggee(session, start_request, sudo, args, console, console_title):
|
|||
arguments = start_request.arguments
|
||||
spawn_launcher()
|
||||
else:
|
||||
_, port = server.Connection.listener.getsockname()
|
||||
_, port = servers.Connection.listener.getsockname()
|
||||
arguments = dict(start_request.arguments)
|
||||
arguments["port"] = port
|
||||
spawn_launcher()
|
||||
|
|
@ -122,7 +122,7 @@ def spawn_debuggee(session, start_request, sudo, args, console, console_title):
|
|||
session.launcher,
|
||||
)
|
||||
|
||||
conn = server.wait_for_connection(session.pid, timeout=10)
|
||||
conn = servers.wait_for_connection(session.pid, timeout=10)
|
||||
if conn is None:
|
||||
raise start_request.cant_handle(
|
||||
"{0} timed out waiting for debuggee to spawn", session
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# Licensed under the MIT License. See LICENSE in the project root
|
||||
# for license information.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
"""Global adapter options that are set via command line, environment variables,
|
||||
or configuartion files.
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Connection(sockets.ClientConnection):
|
|||
"""
|
||||
|
||||
def __init__(self, sock):
|
||||
from ptvsd.adapter import session
|
||||
from ptvsd.adapter import sessions
|
||||
|
||||
self.server = None
|
||||
"""The Server component, if this debug server belongs to Session.
|
||||
|
|
@ -73,7 +73,7 @@ class Connection(sockets.ClientConnection):
|
|||
self.channel.close()
|
||||
return
|
||||
|
||||
parent_session = session.get(self.ppid)
|
||||
parent_session = sessions.get(self.ppid)
|
||||
if parent_session is None:
|
||||
log.info("No active debug session for parent process of {0}.", self)
|
||||
else:
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
# Licensed under the MIT License. See LICENSE in the project root
|
||||
# for license information.
|
||||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import contextlib
|
||||
import itertools
|
||||
|
|
@ -11,7 +11,7 @@ import threading
|
|||
import time
|
||||
|
||||
from ptvsd.common import fmt, log, messaging, sockets, util
|
||||
from ptvsd.adapter import components, launcher, server
|
||||
from ptvsd.adapter import components, launchers, servers
|
||||
|
||||
|
||||
_lock = threading.RLock()
|
||||
|
|
@ -40,12 +40,12 @@ class Session(util.Observable):
|
|||
self.ide = components.missing(self, ide.IDE)
|
||||
"""The IDE component. Always present."""
|
||||
|
||||
self.launcher = components.missing(self, launcher.Launcher)
|
||||
self.launcher = components.missing(self, launchers.Launcher)
|
||||
"""The launcher componet. Always present in "launch" sessions, and never
|
||||
present in "attach" sessions.
|
||||
"""
|
||||
|
||||
self.server = components.missing(self, server.Server)
|
||||
self.server = components.missing(self, servers.Server)
|
||||
"""The debug server component. Always present, unless this is a "launch"
|
||||
session with "noDebug".
|
||||
"""
|
||||
|
|
@ -174,7 +174,7 @@ class Session(util.Observable):
|
|||
what(self, stream)
|
||||
|
||||
def accept_connection_from_launcher(self, address=("127.0.0.1", 0)):
|
||||
return self._accept_connection_from(launcher.Launcher, address, timeout=10)
|
||||
return self._accept_connection_from(launchers.Launcher, address, timeout=10)
|
||||
|
||||
def finalize(self, why, terminate_debuggee=None):
|
||||
"""Finalizes the debug session.
|
||||
Loading…
Add table
Add a link
Reference in a new issue