File: _debugger_case_remote_1.py

package info (click to toggle)
pydevd 3.3.0%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 13,892 kB
  • sloc: python: 77,508; cpp: 1,869; sh: 368; makefile: 50; ansic: 4
file content (47 lines) | stat: -rw-r--r-- 1,305 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
if __name__ == '__main__':
    import subprocess
    import sys
    import os
    import _debugger_case_remote_2
    args = sys.argv[1:]
    port = int(args.pop(0))

    access_token = None
    client_access_token = None
    while args:
        if args[0] == '--access-token':
            access_token = args[1]
            args = args[2:]
        elif args[0] == '--client-access-token':
            client_access_token = args[1]
            args = args[2:]
        else:
            raise AssertionError('Unable to handle args: %s' % (sys.argv[1:]))

    root_dirname = os.path.dirname(os.path.dirname(__file__))

    if root_dirname not in sys.path:
        sys.path.append(root_dirname)

    import pydevd

    print('before pydevd.settrace')
    sys.stdout.flush()
    pydevd.settrace(
        port=port,
        patch_multiprocessing=True,
        access_token=access_token,
        client_access_token=client_access_token,
    )
    print('after pydevd.settrace')
    sys.stdout.flush()
    f = _debugger_case_remote_2.__file__
    if f.endswith('.pyc'):
        f = f[:-1]
    elif f.endswith('$py.class'):
        f = f[:-len('$py.class')] + '.py'
    print('before call')
    sys.stdout.flush()
    subprocess.check_call([sys.executable, '-u', f])
    print('after call')
    sys.stdout.flush()