)]}'
{
  "commit": "6cdaba69ee76463b2b8e97e8d243dbb6115c3aee",
  "tree": "8c71e1b85c775ac560154a3c9cf4072c360f5492",
  "parents": [
    "4eed5466fb7062e196c4fa01495e1dfe0cf5c850"
  ],
  "author": {
    "name": "Régis Desgroppes",
    "email": "rdesgroppes@gmail.com",
    "time": "Thu Nov 06 15:47:32 2025 +0100"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu Nov 06 09:47:32 2025 -0500"
  },
  "message": "Fix Windows file locking issue in `pkg_install` (#983)\n\n`NamedTemporaryFile` turns out to lock the file on Windows, preventing\n`os.replace` from moving it:\n```\nwindows\u003e bazel run --enable_runfiles //[redacted]:install -- --destdir\u003dd:\\est\n[...]\nINFO: Running command line: [redacted]/install.exe \u003cargs omitted\u003e\nINFO: Installing to [redacted]\nTraceback (most recent call last):\n  File \"[redacted]\\install_install_script.py\", line 92, in _do_file_copy\n    os.replace(tmp_file.name, dest)\nPermissionError: [WinError 32] The process cannot access the file because it is being used by another process: \u0027[redacted]\\\\tmp4wd6gg1t\u0027 -\u003e \u0027d:\\est/filename.ext\u0027\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"[redacted]\\install_install_script.py\", line 307, in \u003cmodule\u003e\n    sys.exit(main(sys.argv))\n             ^^^^^^^^^^^^^^\n  File \"[redacted]\\install_install_script.py\", line 303, in main\n    installer.do_the_thing()\n  File \"[redacted]\\install_install_script.py\", line 206, in do_the_thing\n    self._install_file(entry)\n  File \"[redacted]\\install_install_script.py\", line 126, in _install_file\n    self._do_file_copy(entry.src, entry.dest)\n  File \"[redacted]\\install_install_script.py\", line 94, in _do_file_copy\n    pathlib.Path(tmp_file.name).unlink(missing_ok\u003dTrue)\n  File \"[redacted]\\rules_python++python+python_3_12_x86_64-pc-windows-msvc\\Lib\\pathlib.py\", line 1342, in unlink\n    os.unlink(self)\nPermissionError: [WinError 32] The process cannot access the file because it is being used by another process: \u0027[redacted]\\\\tmp4wd6gg1t\u0027\n\nIntuition: _Any problem in computer science can be solved with another\nlevel of indirection._ (https://bwlampson.site/Slides/TuringLecture.htm)\n\nThe change therefore proposes to use `TemporaryDirectory` instead of\n`NamedTemporaryFile` as an indirection to avoid a file lock from being\nheld, which allows the file to be freely written and moved on all\nplatforms while maintaining the same atomic replace behavior for macOS\ncode-signed binaries introduced in commit\n31cab20079c1f2919f569119272923dea2e679c8 (#941).",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c6d5f8e3d01fb3ea6549028a6910cd31764c5720",
      "old_mode": 33188,
      "old_path": "pkg/private/install.py.tpl",
      "new_id": "1ced5e6fc3478d73d77ae478f2bf034c55a3a531",
      "new_mode": 33188,
      "new_path": "pkg/private/install.py.tpl"
    }
  ]
}
