diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-12-13 09:30:00 -0800 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2020-12-13 09:36:10 -0800 |
commit | cb4f76fca28348cbf9410410dcac7bcfd2359a53 (patch) | |
tree | b861df7926594eb54a51656af7ba693cd4fe4b3a /sphinx/util/osutil.py | |
parent | 8ed1e706cc495351cda67910d63de585ad724b51 (diff) | |
download | sphinx-git-cb4f76fca28348cbf9410410dcac7bcfd2359a53.tar.gz |
Deprecate sphinx.util.osutil.movefile() in favor of os.replace()
The utility function movefile() was added in
677d096393bca948eea8fad252bd859ed8142309 to handle existing files on
Windows. Since Python 3.3, the stdlib function os.replace() fills this
role.
Diffstat (limited to 'sphinx/util/osutil.py')
-rw-r--r-- | sphinx/util/osutil.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py index 59fd059e6..abbb0617a 100644 --- a/sphinx/util/osutil.py +++ b/sphinx/util/osutil.py @@ -20,7 +20,7 @@ from io import StringIO from os import path from typing import Any, Generator, Iterator, List, Optional, Tuple -from sphinx.deprecation import RemovedInSphinx40Warning +from sphinx.deprecation import RemovedInSphinx40Warning, RemovedInSphinx50Warning try: # for ALT Linux (#6712) @@ -103,6 +103,9 @@ def mtimes_of_files(dirnames: List[str], suffix: str) -> Iterator[float]: def movefile(source: str, dest: str) -> None: """Move a file, removing the destination if it exists.""" + warnings.warn('sphinx.util.osutil.movefile() is deprecated for removal. ' + 'Please use os.replace() instead.', + RemovedInSphinx50Warning, stacklevel=2) if os.path.exists(dest): try: os.unlink(dest) |