diff --git a/ptvsd/__main__.py b/ptvsd/__main__.py index 3b785906..33b7624f 100644 --- a/ptvsd/__main__.py +++ b/ptvsd/__main__.py @@ -2,12 +2,15 @@ # Licensed under the MIT License. See LICENSE in the project root # for license information. +import pydevd + +import ptvsd.wrapper + + __author__ = "Microsoft Corporation " __version__ = "4.0.0a1" if __name__ == '__main__': - # XXX Convert side-effects into explicit calls. - import ptvsd.wrapper - import pydevd + ptvsd.wrapper.install() pydevd.main() diff --git a/ptvsd/debugger.py b/ptvsd/debugger.py index 0102ccf4..d569aa35 100644 --- a/ptvsd/debugger.py +++ b/ptvsd/debugger.py @@ -4,6 +4,10 @@ import sys +import pydevd + +import ptvsd.wrapper + __author__ = "Microsoft Corporation " __version__ = "4.0.0a1" @@ -13,9 +17,7 @@ DONT_DEBUG = [] def debug(filename, port_num, debug_id, debug_options, run_as): # XXX docstring - # XXX Convert side-effects into explicit calls. - import ptvsd.wrapper - import pydevd + ptvsd.wrapper.install() sys.argv[1:0] = [ '--port', str(port_num), '--client', '127.0.0.1', diff --git a/ptvsd/wrapper.py b/ptvsd/wrapper.py index 2333f8dc..5dcd4617 100644 --- a/ptvsd/wrapper.py +++ b/ptvsd/wrapper.py @@ -666,6 +666,8 @@ def start_client(host, port): return pydevd -# These are the functions pydevd invokes to get a socket to the client. -pydevd_comm.start_server = start_server -pydevd_comm.start_client = start_client +def install(): + """Configure pydevd to use our wrapper.""" + # These are the functions pydevd invokes to get a socket to the client. + pydevd_comm.start_server = start_server + pydevd_comm.start_client = start_client