Make the emitted-hook stub record what the hook hands the rebuild launcher in GRAPHIFY_CHANGED (it passes the find_spec probe like the stock stub; the probe runs before GRAPHIFY_CHANGED is set, hence the guard).
(tmp_path: Path, monkeypatch)
| 1869 | |
| 1870 | |
| 1871 | def _changed_dump(tmp_path: Path, monkeypatch) -> Path: |
| 1872 | """Make the emitted-hook stub record what the hook hands the rebuild launcher in |
| 1873 | GRAPHIFY_CHANGED (it passes the find_spec probe like the stock stub; the probe runs |
| 1874 | before GRAPHIFY_CHANGED is set, hence the guard).""" |
| 1875 | dump = tmp_path / "changed.txt" |
| 1876 | |
| 1877 | def dumping_stub(where: Path) -> Path: |
| 1878 | py = where / "stubpy" |
| 1879 | py.write_text( |
| 1880 | f'#!/bin/sh\n[ -n "$GRAPHIFY_CHANGED" ] && printf %s "$GRAPHIFY_CHANGED" > "{dump}"\nexit 0\n', |
| 1881 | encoding="utf-8", newline="\n", |
| 1882 | ) |
| 1883 | py.chmod(0o755) |
| 1884 | return py |
| 1885 | |
| 1886 | monkeypatch.setattr(sys.modules[__name__], "_stub_python", dumping_stub) |
| 1887 | return dump |
| 1888 | |
| 1889 | |
| 1890 | @_SH_ONLY |
no outgoing calls
no test coverage detected