equal
deleted
inserted
replaced
1093 """check whether a file is executable""" |
1093 """check whether a file is executable""" |
1094 return (os.lstat(f).st_mode & 0100 != 0) |
1094 return (os.lstat(f).st_mode & 0100 != 0) |
1095 |
1095 |
1096 def set_exec(f, mode): |
1096 def set_exec(f, mode): |
1097 s = os.lstat(f).st_mode |
1097 s = os.lstat(f).st_mode |
1098 if (s & 0100 != 0) == mode: |
1098 if stat.S_ISLNK(s) or (s & 0100 != 0) == mode: |
1099 return |
1099 return |
1100 if mode: |
1100 if mode: |
1101 # Turn on +x for every +r bit when making a file executable |
1101 # Turn on +x for every +r bit when making a file executable |
1102 # and obey umask. |
1102 # and obey umask. |
1103 os.chmod(f, s | (s & 0444) >> 2 & ~_umask) |
1103 os.chmod(f, s | (s & 0444) >> 2 & ~_umask) |