From 5f494b776fe4c89bb4eb0b3cd1aa32e3e22e8e88 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 3 Jun 2022 22:51:06 +0100 Subject: [PATCH] Deprecate sphinx.util.path_stabilize --- doc/extdev/deprecated.rst | 5 +++++ sphinx/util/__init__.py | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/doc/extdev/deprecated.rst b/doc/extdev/deprecated.rst index 34702f59691..1c15b9a42f4 100644 --- a/doc/extdev/deprecated.rst +++ b/doc/extdev/deprecated.rst @@ -22,6 +22,11 @@ The following is a list of deprecated interfaces. - (will be) Removed - Alternatives + * - ``sphinx.util.path_stabilize`` + - 5.1 + - 7.0 + - ``sphinx.util.osutil.path_stabilize`` + * - ``sphinx.util.get_matching_files`` - 5.1 - 7.0 diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 55e9c1b60e2..4d296d9b7de 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -28,7 +28,7 @@ # import other utilities; partly for backwards compatibility, so don't # prune unused ones indiscriminately from sphinx.util.osutil import (SEP, copyfile, copytimes, ensuredir, make_filename, # noqa - mtimes_of_files, os_path, path_stabilize, relative_uri) + mtimes_of_files, os_path, relative_uri) from sphinx.util.typing import PathMatcher if TYPE_CHECKING: @@ -49,6 +49,16 @@ def docname_join(basedocname: str, docname: str) -> str: posixpath.join('/' + basedocname, '..', docname))[1:] +def path_stabilize(filepath: str) -> str: + "Normalize path separator and unicode string" + warnings.warn("'sphinx.util.path_stabilize' is deprecated, use " + "'sphinx.util.osutil.path_stabilize' instead.", + RemovedInSphinx70Warning, stacklevel=2) + from sphinx.util import osutil + + return osutil.path_stabilize(filepath) + + def get_matching_files(dirname: str, exclude_matchers: Tuple[PathMatcher, ...] = (), include_matchers: Tuple[PathMatcher, ...] = ()) -> Iterable[str]: # NOQA