]> crepu.dev Git - config.git/blob - djavu-asus/elpy/rpc-venv/lib/python3.11/site-packages/setuptools/_path.py
ActualizaciĆ³n de Readme
[config.git] / djavu-asus / elpy / rpc-venv / lib / python3.11 / site-packages / setuptools / _path.py
1 import os
2 from typing import Union
3
4 _Path = Union[str, os.PathLike]
5
6
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)
11
12
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")
17 True
18 >>> same_path("a/b", "a/./b")
19 True
20 >>> same_path("a/b", "././a/b")
21 True
22 >>> same_path("a/b", "./a/b/c/..")
23 True
24 >>> same_path("a/b", "../a/b/c")
25 False
26 >>> same_path("a", "a/b")
27 False
28 """
29 return os.path.normpath(p1) == os.path.normpath(p2)