@@ -205,6 +205,10 @@ accepting arbitrary Python versions.
205205 allow_single_file = True ,
206206 default = "@bazel_tools//tools/python:python_bootstrap_template.txt" ,
207207 ),
208+ "_debugger_flag" : lambda : attrb .Label (
209+ default = "//python/private:debugger_if_target_config" ,
210+ providers = [PyInfo ],
211+ ),
208212 "_launcher" : lambda : attrb .Label (
209213 cfg = "target" ,
210214 # NOTE: This is an executable, but is only used for Windows. It
@@ -267,17 +271,12 @@ def create_binary_semantics():
267271 return create_binary_semantics_struct (
268272 # keep-sorted start
269273 get_central_uncachable_version_file = lambda ctx : None ,
270- get_debugger_deps = _get_debugger_deps ,
271274 get_native_deps_dso_name = _get_native_deps_dso_name ,
272275 should_build_native_deps_dso = lambda ctx : False ,
273276 should_include_build_data = lambda ctx : False ,
274277 # keep-sorted end
275278 )
276279
277- def _get_debugger_deps (ctx , runtime_details ):
278- _ = ctx , runtime_details # @unused
279- return []
280-
281280def _should_create_init_files (ctx ):
282281 if ctx .attr .legacy_create_init == - 1 :
283282 return not read_possibly_native_flag (ctx , "default_to_explicit_init_py" )
@@ -1025,7 +1024,7 @@ def py_executable_base_impl(ctx, *, semantics, is_test, inherited_environment =
10251024 # The debugger dependency should be prevented by select() config elsewhere,
10261025 # but just to be safe, also guard against adding it to the output here.
10271026 if not _is_tool_config (ctx ):
1028- extra_deps .extend ( semantics . get_debugger_deps ( ctx , runtime_details ) )
1027+ extra_deps .append ( ctx . attr . _debugger_flag )
10291028
10301029 cc_details = _get_cc_details_for_binary (ctx , extra_deps = extra_deps )
10311030 native_deps_details = _get_native_deps_details (
@@ -1751,6 +1750,8 @@ def _create_run_environment_info(ctx, inherited_environment):
17511750 expression = value ,
17521751 targets = ctx .attr .data ,
17531752 )
1753+ if "PYTHONBREAKPOINT" not in inherited_environment :
1754+ inherited_environment = inherited_environment + ["PYTHONBREAKPOINT" ]
17541755 return RunEnvironmentInfo (
17551756 environment = expanded_env ,
17561757 inherited_environment = inherited_environment ,
0 commit comments