def _rename_file(src, dst):
"""Rename the specified file"""
if os.name == 'nt':
# TODO: check that fs.rm_safe works on windows, and if not, fix
# fs.rm_safe.
fs.rm_safe(dst)
os.rename(src, dst)
mode = os.stat(dst).st_mode
mode |= (stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)
if _is_executable(dst):
mode |= (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
os.chmod(dst, mode)
评论列表
文章目录