(
info, # type: ZipInfo
path, # type: Text
)
| 439 | |
| 440 | @staticmethod |
| 441 | def _chmod( |
| 442 | info, # type: ZipInfo |
| 443 | path, # type: Text |
| 444 | ): |
| 445 | # type: (...) -> None |
| 446 | |
| 447 | # This magic works to extract perm bits from the 32 bit external file attributes field for |
| 448 | # unix-created zip files, for the layout, see: |
| 449 | # https://www.forensicswiki.org/wiki/ZIP#External_file_attributes |
| 450 | if info.external_attr > 0xFFFF: |
| 451 | attr = info.external_attr >> 16 |
| 452 | # If the archive file was executable, we set the extracted file as executable. |
| 453 | if stat.S_ISREG(attr) and attr & 0o111: |
| 454 | chmod_plus_x(path) |
| 455 | |
| 456 | # Python 3 also takes PathLike[str] for the path arg, but we only ever pass str since we support |
| 457 | # Python 2.7 and don't use pathlib as a result. |
no test coverage detected