def chmod_plus_x(path):
  path_mode = os.stat(path).st_mode
  path_mode &= int('777', 8)
  if path_mode & stat.S_IRUSR:
    path_mode |= stat.S_IXUSR
  if path_mode & stat.S_IRGRP:
    path_mode |= stat.S_IXGRP
  if path_mode & stat.S_IROTH:
    path_mode |= stat.S_IXOTH
  os.chmod(path, path_mode)
Equivalent of unix `chmod a+x path`
dataset/ETHPy150Open pantsbuild/pex/pex/common.py/chmod_plus_x