Commit 816747e
authored
✨ feat(api): add site_bin_dir property (#443)
Applications that install system-wide executables need a standard
location that mirrors `user_bin_dir`. Currently, `user_bin_dir` provides
`~/.local/bin` on Unix/macOS and `%LOCALAPPDATA%\Programs` on Windows,
but there's no corresponding site-wide equivalent. This creates API
inconsistency since all other directory types (data, config, cache,
state, log, runtime) have both user and site variants. ✨ Package
managers like Chocolatey, pip, and uv need a consistent answer for where
to install system-wide binaries.
The implementation follows platform conventions researched from official
documentation. Unix/Linux uses `/usr/local/bin` per [FHS
3.0](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html), which
designates this path for locally-installed software distinct from
distribution packages in `/usr/bin`. macOS uses `/usr/local/bin` as the
standard Homebrew and user installation location, since `/usr/bin` is
read-only on modern macOS per [Apple's
documentation](https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html).
Windows uses `%ProgramData%\bin` to mirror the `site_data_dir` pattern,
following [Chocolatey's
precedent](https://docs.chocolatey.org/en-us/choco/setup) of using
`%ProgramData%\Chocolatey\bin` for system-wide package binaries. Android
aliases to `user_bin_dir` since the platform has no system-wide
installation concept per [Android's storage
documentation](https://developer.android.com/guide/topics/data/data-storage).
🔍
The change also implements `use_site_for_root` support on Unix, allowing
`user_bin_dir` to redirect to `site_bin_dir` when running as root. This
matches the behavior of other `user_*` properties and provides a
consistent experience for tools that need to install binaries
differently based on privilege level.
Closes #4341 parent 7a47ac4 commit 816747e
13 files changed
Lines changed: 79 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
344 | 368 | | |
345 | 369 | | |
346 | 370 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
343 | 348 | | |
344 | 349 | | |
345 | 350 | | |
| |||
698 | 703 | | |
699 | 704 | | |
700 | 705 | | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
701 | 711 | | |
702 | 712 | | |
703 | 713 | | |
| |||
777 | 787 | | |
778 | 788 | | |
779 | 789 | | |
| 790 | + | |
| 791 | + | |
780 | 792 | | |
781 | 793 | | |
782 | 794 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
121 | 126 | | |
122 | 127 | | |
123 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
212 | 217 | | |
213 | 218 | | |
214 | 219 | | |
| |||
314 | 319 | | |
315 | 320 | | |
316 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
317 | 327 | | |
318 | 328 | | |
319 | 329 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
138 | 143 | | |
139 | 144 | | |
140 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
| |||
266 | 271 | | |
267 | 272 | | |
268 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
269 | 279 | | |
270 | 280 | | |
271 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
149 | 154 | | |
150 | 155 | | |
151 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
0 commit comments