Add ability to filter out results of `shutil.which` by `os.stat_result.st_flags`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
Feature or enhancement
Add ability to filter out results of https://docs.python.org/3/library/shutil.html#shutil.which by https://docs.python.org/3/library/os.html#os.stat_result.st_flags
Pitch
- https://en.wikipedia.org/wiki/System_Integrity_Protection
- https://github.com/pypa/hatch/issues/701#issuecomment-1374595003
Basically, it is desirable to call/use a version of an installed executable that is not restricted by macOS SIP such as when modifying linker environment variables.
Previous discussion
Somewhat related https://github.com/python/cpython/issues/76528
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the shutil.which and os.stat_result.st_flags documentation and review the linked macOS SIP and previous-discussion issues. Determine the intended filtering interface and platform-specific behavior, then verify that executable selection excludes the requested st_flags cases without changing other platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100