Equivalent of unix `chmod a+x path`
(path)
| 17 | |
| 18 | |
| 19 | def chmod_plus_x(path): |
| 20 | # type: (Text) -> None |
| 21 | """Equivalent of unix `chmod a+x path`""" |
| 22 | path_mode = os.stat(path).st_mode |
| 23 | path_mode &= int("777", 8) |
| 24 | if path_mode & stat.S_IRUSR: |
| 25 | path_mode |= stat.S_IXUSR |
| 26 | if path_mode & stat.S_IRGRP: |
| 27 | path_mode |= stat.S_IXGRP |
| 28 | if path_mode & stat.S_IROTH: |
| 29 | path_mode |= stat.S_IXOTH |
| 30 | os.chmod(path, path_mode) |
| 31 | |
| 32 | |
| 33 | _SHEBANG_MAGIC = b"#!" |
no outgoing calls