]>
crepu.dev Git - config.git/blob - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/setuptools/_path.py
2 from typing
import Union
4 _Path
= Union
[str, os
.PathLike
]
7 def ensure_directory(path
):
8 """Ensure that the parent directory of `path` exists"""
9 dirname
= os
.path
.dirname(path
)
10 os
.makedirs(dirname
, exist_ok
=True)
13 def same_path(p1
: _Path
, p2
: _Path
) -> bool:
14 """Differs from os.path.samefile because it does not require paths to exist.
15 Purely string based (no comparison between i-nodes).
16 >>> same_path("a/b", "./a/b")
18 >>> same_path("a/b", "a/./b")
20 >>> same_path("a/b", "././a/b")
22 >>> same_path("a/b", "./a/b/c/..")
24 >>> same_path("a/b", "../a/b/c")
26 >>> same_path("a", "a/b")
29 return os
.path
.normpath(p1
) == os
.path
.normpath(p2
)