| 87 | |
| 88 | |
| 89 | def _ensure_executable(binary: str) -> None: |
| 90 | # Wheels do not carry the executable bit through every installer, so restore |
| 91 | # it here rather than in main(): library callers run the path themselves. |
| 92 | if os.name == "nt": |
| 93 | return |
| 94 | try: |
| 95 | mode = os.stat(binary).st_mode |
| 96 | if not mode & stat.S_IXUSR: |
| 97 | os.chmod(binary, mode | 0o755) |
| 98 | except OSError: |
| 99 | # A read-only site-packages can't be repaired from here; running the |
| 100 | # binary then fails with an error that names the path. |
| 101 | pass |
| 102 | |
| 103 | |
| 104 | def main() -> None: |