diff options
author | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2022-07-17 21:53:12 +0100 |
---|---|---|
committer | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2022-07-17 21:53:12 +0100 |
commit | a4d41aa889388bf8ee2815d4819235b5ca978a8d (patch) | |
tree | 67763bc78a88f0114ff22e50f8419213dc0ff4ef /sphinx/util/osutil.py | |
parent | 1e3ade55fe24107c883fc2725ecab28350e3f6cb (diff) | |
parent | aa47f5d53aa3327aa0acf2aeb25996b3b3ba6898 (diff) | |
download | sphinx-git-a4d41aa889388bf8ee2815d4819235b5ca978a8d.tar.gz |
Merge branch '5.x'
Diffstat (limited to 'sphinx/util/osutil.py')
-rw-r--r-- | sphinx/util/osutil.py | 7 |
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): |