Commit 34b2d47
authored
fix(winpython): narrow search paths and add discovery cache (#456)
Fixes #453.
The WinPython locator was scanning `C:\`, `D:\`, `E:\`, `Program Files`,
`~/Downloads`, `~/Desktop`, and `~/Documents` on every refresh — all
Windows Defender hot-spots — to find a niche portable distribution. That
inflated p90 refresh latency for every Windows user, regardless of
whether WinPython was installed.
## Changes
- Restrict default search to `%USERPROFILE%\WinPython`.
- Add opt-in `WINPYTHON_HOME` env var (single path or `;`-separated
list; each entry can *be* or *contain* a WinPython install).
- Add a per-process discovery cache
(`Arc<Mutex<Option<Arc<Vec<...>>>>>`), mirroring `WindowsStore` and
`WindowsRegistry`, with `SyncedDiscoveryState` refresh persistence.
- Extract `build_search_paths(userprofile, winpython_home)` as a pure
helper so tests don't have to mutate process env.
- New regression tests pinning the search-path policy and
`WINPYTHON_HOME` parsing on both Windows and Unix.
- README: document `WINPYTHON_HOME` and the new search-path policy.
`try_from()` behavior on a real WinPython executable is unchanged — it
still walks parent directories looking for marker files / `WPy*`
directory names.1 parent ab6d1d2 commit 34b2d47
4 files changed
Lines changed: 642 additions & 122 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
0 commit comments