compat.py
来自「一款基于web的项目管理、bug跟踪系统。提供了与svn集成的操作界面、问题跟踪」· Python 代码 · 共 22 行
PY
22 行
#!/usr/bin/pythonimport osimport shutil# Closing FDs not supported with subprocess on Windowsclose_fds = Trueif os.name == 'nt': close_fds = False # not supported :(# On Windows, shutil.rmtree doesn't remove files with the read-only# attribute set, so this function explicitly removes it on every error# before retrying. Even on Linux, shutil.rmtree chokes on read-only# directories, so we use this version in all cases.# Fix from http://bitten.edgewall.org/changeset/521def rmtree(root): """Catch shutil.rmtree failures on Windows when files are read-only.""" def _handle_error(fn, path, excinfo): os.chmod(path, 0666) fn(path) return shutil.rmtree(root, onerror=_handle_error)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?