summaryrefslogtreecommitdiff
path: root/sphinx/util/osutil.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-07-17 21:53:12 +0100
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-07-17 21:53:12 +0100
commita4d41aa889388bf8ee2815d4819235b5ca978a8d (patch)
tree67763bc78a88f0114ff22e50f8419213dc0ff4ef /sphinx/util/osutil.py
parent1e3ade55fe24107c883fc2725ecab28350e3f6cb (diff)
parentaa47f5d53aa3327aa0acf2aeb25996b3b3ba6898 (diff)
downloadsphinx-git-a4d41aa889388bf8ee2815d4819235b5ca978a8d.tar.gz
Merge branch '5.x'
Diffstat (limited to 'sphinx/util/osutil.py')
-rw-r--r--sphinx/util/osutil.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py
index 840655e42..d0ed42c8c 100644
--- a/sphinx/util/osutil.py
+++ b/sphinx/util/osutil.py
@@ -6,6 +6,7 @@ import os
import re
import shutil
import sys
+import unicodedata
from io import StringIO
from os import path
from typing import Any, Generator, Iterator, List, Optional, Type
@@ -34,6 +35,12 @@ def canon_path(nativepath: str) -> str:
return nativepath.replace(path.sep, SEP)
+def path_stabilize(filepath: str) -> str:
+ "Normalize path separator and unicode string"
+ new_path = canon_path(filepath)
+ return unicodedata.normalize('NFC', new_path)
+
+
def relative_uri(base: str, to: str) -> str:
"""Return a relative URL from ``base`` to ``to``."""
if to.startswith(SEP):