)]}'
{
  "commit": "8ff4386335e5c50d9507fe364b4f0cc6a90f02e6",
  "tree": "3e75ac97715a21a611d1fac173e43df289723e14",
  "parents": [
    "4a55ef4c2363f7ffc1ec9ba511fba7b2547ccefc"
  ],
  "author": {
    "name": "Richard Levasseur",
    "email": "rlevasseur@google.com",
    "time": "Wed Nov 20 20:33:00 2024 -0800"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu Nov 21 04:33:00 2024 +0000"
  },
  "message": "fix: make sys.executable work with script bootstrap (#2409)\n\nWhen `--bootstrap_impl\u003dscript` is used, `PYTHONPATH` is no longer used\nto set the import\npaths, which means subprocesses no longer inherit the Bazel paths. This\nis generally a\ngood thing, but breaks when `sys.executable` is used to directly invoke\nthe interpreter.\nSuch an invocation assumes the interpreter will have the same packages\navailable and works\nwith the system_python bootstrap.\n\nTo fix, have the script bootstrap use a basic virtual env. This allows\nit to intercept\ninterpreter startup even when the Bazel executable isn\u0027t invoked. Under\nthe hood, there\u0027s\ntwo pieces to make this work. The first is a binary uses\n`declare_symlink()` to write a\nrelative-path based symlink that points to the underlying Python\ninterpreter. The second\npiece is a site init hook (triggered by a `.pth` file using an `import`\nline) performs\nsys.path setup as part of site (`import site`) initialization.\n\nFixes https://github.com/bazelbuild/rules_python/issues/2169\n\n---------\n\nCo-authored-by: Ignas Anikevicius \u003c240938+aignas@users.noreply.github.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "66a644e289e879102ba5f4a80a3ebb51bfdbf1d1",
      "old_mode": 33188,
      "old_path": ".bazelrc",
      "new_id": "c44124d961a5feecb74cba16cc9b40a3eb72d983",
      "new_mode": 33188,
      "new_path": ".bazelrc"
    },
    {
      "type": "modify",
      "old_id": "9cd6b82759e8c72cab3f5d3363997522e663fe9d",
      "old_mode": 33188,
      "old_path": "CHANGELOG.md",
      "new_id": "5b5d045edceb4025cf5873fc2c9936aa60eac242",
      "new_mode": 33188,
      "new_path": "CHANGELOG.md"
    },
    {
      "type": "modify",
      "old_id": "39af217bfe3276e2980dba2092454005c3a947f9",
      "old_mode": 33188,
      "old_path": "python/private/BUILD.bazel",
      "new_id": "9772089e9797f13f9fc3e481e06c58c00f9522de",
      "new_mode": 33188,
      "new_path": "python/private/BUILD.bazel"
    },
    {
      "type": "modify",
      "old_id": "6f9c0947a3c62ba62252eca9a205d068e4f5e1d3",
      "old_mode": 33188,
      "old_path": "python/private/py_executable_bazel.bzl",
      "new_id": "60c3815c99bb42c90d0a82b1980b56806cc604a0",
      "new_mode": 33188,
      "new_path": "python/private/py_executable_bazel.bzl"
    },
    {
      "type": "modify",
      "old_id": "ff95c4a4486a9060a84cbd3f327bc547a823c5fe",
      "old_mode": 33188,
      "old_path": "python/private/py_runtime_info.bzl",
      "new_id": "34be0db69b8ad8402db02f03b2d00f9596630891",
      "new_mode": 33188,
      "new_path": "python/private/py_runtime_info.bzl"
    },
    {
      "type": "modify",
      "old_id": "746cd19dcb55e935502240b922bb24e47b134e5d",
      "old_mode": 33188,
      "old_path": "python/private/py_runtime_rule.bzl",
      "new_id": "5ce8161cf0653c59adae9d714cfaa3f54548a00a",
      "new_mode": 33188,
      "new_path": "python/private/py_runtime_rule.bzl"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "7a32210bff87ffb3d60a9d2d81cf6a02a26bf3a1",
      "new_mode": 33188,
      "new_path": "python/private/site_init_template.py"
    },
    {
      "type": "modify",
      "old_id": "e7e418cafb77bf1d4b76e650bc208315678cdc41",
      "old_mode": 33188,
      "old_path": "python/private/stage1_bootstrap_template.sh",
      "new_id": "afa1ee84bd2c2b1afbcff891952d55f07ab8e181",
      "new_mode": 33188,
      "new_path": "python/private/stage1_bootstrap_template.sh"
    },
    {
      "type": "modify",
      "old_id": "f66c28bd51c0e0343059967211b12d5d718f7e08",
      "old_mode": 33188,
      "old_path": "python/private/stage2_bootstrap_template.py",
      "new_id": "d2c7497795776ac743b6ab2adda152a9ab837341",
      "new_mode": 33188,
      "new_path": "python/private/stage2_bootstrap_template.py"
    },
    {
      "type": "modify",
      "old_id": "2d3aea7b7b3b66da1fd012ee63f2e514c15c9ac0",
      "old_mode": 33188,
      "old_path": "python/private/zip_main_template.py",
      "new_id": "b4c9d279a69fecb0533d4ddce4fcc59294116a12",
      "new_mode": 33188,
      "new_path": "python/private/zip_main_template.py"
    },
    {
      "type": "modify",
      "old_id": "cd5771533d30138bd539e4cddf23a8cd5a2694b7",
      "old_mode": 33188,
      "old_path": "tests/bootstrap_impls/BUILD.bazel",
      "new_id": "15868218965fbbbaa2799fae3dd33e82d9bf5944",
      "new_mode": 33188,
      "new_path": "tests/bootstrap_impls/BUILD.bazel"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "0c6157048cac250ed7a796e7ae627f92686c8a6d",
      "new_mode": 33188,
      "new_path": "tests/bootstrap_impls/call_sys_exe.py"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "ca4d7aa0a8a33e1bb9277f1b602799bd282e92eb",
      "new_mode": 33261,
      "new_path": "tests/bootstrap_impls/sys_executable_inherits_sys_path_test.sh"
    },
    {
      "type": "modify",
      "old_id": "2e334641556aa4ae81b2fcad076753832f4fc358",
      "old_mode": 33188,
      "old_path": "tests/bootstrap_impls/sys_path_order_test.py",
      "new_id": "97c62a6be561ce7b408aafa73103896949f89d1d",
      "new_mode": 33188,
      "new_path": "tests/bootstrap_impls/sys_path_order_test.py"
    },
    {
      "type": "modify",
      "old_id": "c191b3974b2469f66694d6d8b8ddc268073c6b1d",
      "old_mode": 33188,
      "old_path": "tests/support/sh_py_run_test.bzl",
      "new_id": "7fb7016eec658fbe8ea6510b3a16720c881619cd",
      "new_mode": 33188,
      "new_path": "tests/support/sh_py_run_test.bzl"
    }
  ]
}
