MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / splitall

Function splitall

tools/utils.py:29–49  ·  view source on GitHub ↗

Return a list of the path components in loc. (Used by relpath_). The first item in the list will be either ``os.curdir``, ``os.pardir``, empty, or the root directory of loc (for example, ``/`` or ``C:\\). The other items in the list will be strings. Adapted from *path.py* by

(loc)

Source from the content-addressed store, hash-verified

27import re
28
29def splitall(loc):
30 """
31 Return a list of the path components in loc. (Used by relpath_).
32
33 The first item in the list will be either ``os.curdir``, ``os.pardir``, empty,
34 or the root directory of loc (for example, ``/`` or ``C:\\).
35
36 The other items in the list will be strings.
37
38 Adapted from *path.py* by Jason Orendorff.
39 """
40 parts = []
41 while loc != os.curdir and loc != os.pardir:
42 prev = loc
43 loc, child = os.path.split(prev)
44 if loc == prev:
45 break
46 parts.append(child)
47 parts.append(loc)
48 parts.reverse()
49 return parts
50
51def _make_path_relative(origin, dest):
52 """

Callers 1

_make_path_relativeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected