##// END OF EJS Templates
merge with crew-stable
Thomas Arendsen Hein -
r5691:8e495dd6 merge default
parent child Browse files
Show More
@@ -1132,6 +1132,17 b' else:'
1132 """check whether a file is executable"""
1132 """check whether a file is executable"""
1133 return (os.lstat(f).st_mode & 0100 != 0)
1133 return (os.lstat(f).st_mode & 0100 != 0)
1134
1134
1135 def force_chmod(f, s):
1136 try:
1137 os.chmod(f, s)
1138 except OSError, inst:
1139 if inst.errno != errno.EPERM:
1140 raise
1141 # maybe we don't own the file, try copying it
1142 new_f = mktempcopy(f)
1143 os.chmod(new_f, s)
1144 os.rename(new_f, f)
1145
1135 def set_exec(f, mode):
1146 def set_exec(f, mode):
1136 s = os.lstat(f).st_mode
1147 s = os.lstat(f).st_mode
1137 if stat.S_ISLNK(s) or (s & 0100 != 0) == mode:
1148 if stat.S_ISLNK(s) or (s & 0100 != 0) == mode:
@@ -1139,9 +1150,9 b' else:'
1139 if mode:
1150 if mode:
1140 # Turn on +x for every +r bit when making a file executable
1151 # Turn on +x for every +r bit when making a file executable
1141 # and obey umask.
1152 # and obey umask.
1142 os.chmod(f, s | (s & 0444) >> 2 & ~_umask)
1153 force_chmod(f, s | (s & 0444) >> 2 & ~_umask)
1143 else:
1154 else:
1144 os.chmod(f, s & 0666)
1155 force_chmod(f, s & 0666)
1145
1156
1146 def set_link(f, mode):
1157 def set_link(f, mode):
1147 """make a file a symbolic link/regular file
1158 """make a file a symbolic link/regular file
General Comments 0
You need to be logged in to leave comments. Login now