(request)
| 12 | |
| 13 | |
| 14 | def launch_request(request): |
| 15 | debug_options = set(request("debugOptions", json.array(str))) |
| 16 | |
| 17 | # Handling of properties that can also be specified as legacy "debugOptions" flags. |
| 18 | # If property is explicitly set to false, but the flag is in "debugOptions", treat |
| 19 | # it as an error. Returns None if the property wasn't explicitly set either way. |
| 20 | def property_or_debug_option(prop_name, flag_name): |
| 21 | assert prop_name[0].islower() and flag_name[0].isupper() |
| 22 | |
| 23 | value = request(prop_name, bool, optional=True) |
| 24 | if value == (): |
| 25 | value = None |
| 26 | |
| 27 | if flag_name in debug_options: |
| 28 | if value is False: |
| 29 | raise request.isnt_valid( |
| 30 | '{0}:false and "debugOptions":[{1}] are mutually exclusive', |
| 31 | json.repr(prop_name), |
| 32 | json.repr(flag_name), |
| 33 | ) |
| 34 | value = True |
| 35 | |
| 36 | return value |
| 37 | |
| 38 | python = request("python", json.array(str, size=(1,))) |
| 39 | cmdline = list(python) |
| 40 | |
| 41 | if not request("noDebug", json.default(False)): |
| 42 | # see https://github.com/microsoft/debugpy/issues/861 |
| 43 | if sys.version_info[:2] >= (3, 11): |
| 44 | cmdline += ["-X", "frozen_modules=off"] |
| 45 | |
| 46 | port = request("port", int) |
| 47 | cmdline += [ |
| 48 | os.path.dirname(debugpy.__file__), |
| 49 | "--connect", |
| 50 | launcher.adapter_host + ":" + str(port), |
| 51 | ] |
| 52 | |
| 53 | if not request("subProcess", True): |
| 54 | cmdline += ["--configure-subProcess", "False"] |
| 55 | |
| 56 | qt_mode = request( |
| 57 | "qt", |
| 58 | json.enum( |
| 59 | "none", "auto", "pyside", "pyside2", "pyqt4", "pyqt5", optional=True |
| 60 | ), |
| 61 | ) |
| 62 | cmdline += ["--configure-qt", qt_mode] |
| 63 | |
| 64 | adapter_access_token = request("adapterAccessToken", str, optional=True) |
| 65 | if adapter_access_token != (): |
| 66 | cmdline += ["--adapter-access-token", adapter_access_token] |
| 67 | |
| 68 | debugpy_args = request("debugpyArgs", json.array(str)) |
| 69 | cmdline += debugpy_args |
| 70 | |
| 71 | # Use the copy of arguments that was propagated via the command line rather than |
nothing calls this directly
no test coverage detected
searching dependent graphs…