|
53 | 53 | "target_platform_has_any_constraint",
|
54 | 54 | )
|
55 | 55 | load(":common_labels.bzl", "labels")
|
56 |
| -load(":flags.bzl", "BootstrapImplFlag", "VenvsUseDeclareSymlinkFlag") |
| 56 | +load(":flags.bzl", "BootstrapImplFlag", "VenvsUseDeclareSymlinkFlag", "read_possibly_native_flag") |
57 | 57 | load(":precompile.bzl", "maybe_precompile")
|
58 | 58 | load(":py_cc_link_params_info.bzl", "PyCcLinkParamsInfo")
|
59 | 59 | load(":py_executable_info.bzl", "PyExecutableInfo")
|
@@ -293,7 +293,7 @@ def _get_stamp_flag(ctx):
|
293 | 293 |
|
294 | 294 | def _should_create_init_files(ctx):
|
295 | 295 | if ctx.attr.legacy_create_init == -1:
|
296 |
| - return not ctx.fragments.py.default_to_explicit_init_py |
| 296 | + return not read_possibly_native_flag(ctx, "default_to_explicit_init_py") |
297 | 297 | else:
|
298 | 298 | return bool(ctx.attr.legacy_create_init)
|
299 | 299 |
|
@@ -381,7 +381,7 @@ def _create_executable(
|
381 | 381 | extra_files_to_build = []
|
382 | 382 |
|
383 | 383 | # NOTE: --build_python_zip defaults to true on Windows
|
384 |
| - build_zip_enabled = ctx.fragments.py.build_python_zip |
| 384 | + build_zip_enabled = read_possibly_native_flag(ctx, "build_python_zip") |
385 | 385 |
|
386 | 386 | # When --build_python_zip is enabled, then the zip file becomes
|
387 | 387 | # one of the default outputs.
|
@@ -587,7 +587,7 @@ def _create_venv(ctx, output_prefix, imports, runtime_details):
|
587 | 587 | output = site_init,
|
588 | 588 | substitutions = {
|
589 | 589 | "%coverage_tool%": _get_coverage_tool_runfiles_path(ctx, runtime),
|
590 |
| - "%import_all%": "True" if ctx.fragments.bazel_py.python_import_all_repositories else "False", |
| 590 | + "%import_all%": "True" if read_possibly_native_flag(ctx, "python_import_all_repositories") else "False", |
591 | 591 | "%site_init_runfiles_path%": "{}/{}".format(ctx.workspace_name, site_init.short_path),
|
592 | 592 | "%workspace_name%": ctx.workspace_name,
|
593 | 593 | },
|
@@ -668,7 +668,7 @@ def _create_stage2_bootstrap(
|
668 | 668 | output = output,
|
669 | 669 | substitutions = {
|
670 | 670 | "%coverage_tool%": _get_coverage_tool_runfiles_path(ctx, runtime),
|
671 |
| - "%import_all%": "True" if ctx.fragments.bazel_py.python_import_all_repositories else "False", |
| 671 | + "%import_all%": "True" if read_possibly_native_flag(ctx, "python_import_all_repositories") else "False", |
672 | 672 | "%imports%": ":".join(imports.to_list()),
|
673 | 673 | "%main%": main_py_path,
|
674 | 674 | "%main_module%": ctx.attr.main_module,
|
@@ -755,7 +755,7 @@ def _create_stage1_bootstrap(
|
755 | 755 | template = ctx.file._bootstrap_template
|
756 | 756 |
|
757 | 757 | subs["%coverage_tool%"] = coverage_tool_runfiles_path
|
758 |
| - subs["%import_all%"] = ("True" if ctx.fragments.bazel_py.python_import_all_repositories else "False") |
| 758 | + subs["%import_all%"] = ("True" if read_possibly_native_flag(ctx, "python_import_all_repositories") else "False") |
759 | 759 | subs["%imports%"] = ":".join(imports.to_list())
|
760 | 760 | subs["%main%"] = "{}/{}".format(ctx.workspace_name, main_py.short_path)
|
761 | 761 |
|
@@ -1135,7 +1135,7 @@ def _get_runtime_details(ctx, semantics):
|
1135 | 1135 | #
|
1136 | 1136 | # TOOD(bazelbuild/bazel#7901): Remove this once --python_path flag is removed.
|
1137 | 1137 |
|
1138 |
| - flag_interpreter_path = ctx.fragments.bazel_py.python_path |
| 1138 | + flag_interpreter_path = read_possibly_native_flag(ctx, "python_path") |
1139 | 1139 | toolchain_runtime, effective_runtime = _maybe_get_runtime_from_ctx(ctx)
|
1140 | 1140 | if not effective_runtime:
|
1141 | 1141 | # Clear these just in case
|
|
0 commit comments