MCPcopy
hub / github.com/pex-tool/pex / _chmod

Method _chmod

pex/common.py:441–454  ·  view source on GitHub ↗
(
        info,  # type: ZipInfo
        path,  # type: Text
    )

Source from the content-addressed store, hash-verified

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.

Callers 2

_extract_memberMethod · 0.95
extractallMethod · 0.95

Calls 1

chmod_plus_xFunction · 0.90

Tested by

no test coverage detected