Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2020-12-13 20:30:00 +0300
committerJon Dufresne <jon.dufresne@gmail.com>2020-12-13 20:36:10 +0300
commitcb4f76fca28348cbf9410410dcac7bcfd2359a53 (patch)
treeb861df7926594eb54a51656af7ba693cd4fe4b3a /sphinx/util
parent8ed1e706cc495351cda67910d63de585ad724b51 (diff)
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')
-rw-r--r--sphinx/util/osutil.py5
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)