main: slight refactor to collection argument parents logic
No logical change, preparation for the next commit.
This commit is contained in:
parent
1612d4e393
commit
f20e32c982
|
@ -851,13 +851,14 @@ class Session(nodes.Collector):
|
||||||
if argpath.is_dir():
|
if argpath.is_dir():
|
||||||
assert not names, f"invalid arg {(argpath, names)!r}"
|
assert not names, f"invalid arg {(argpath, names)!r}"
|
||||||
|
|
||||||
# Match the argpath from the root, e.g.
|
paths = [argpath]
|
||||||
|
# Add relevant parents of the path, from the root, e.g.
|
||||||
# /a/b/c.py -> [/, /a, /a/b, /a/b/c.py]
|
# /a/b/c.py -> [/, /a, /a/b, /a/b/c.py]
|
||||||
paths = [*reversed(argpath.parents), argpath]
|
# Paths outside of the confcutdir should not be considered.
|
||||||
# Paths outside of the confcutdir should not be considered, unless
|
for path in argpath.parents:
|
||||||
# it's the argpath itself.
|
if not pm._is_in_confcutdir(path):
|
||||||
while len(paths) > 1 and not pm._is_in_confcutdir(paths[0]):
|
break
|
||||||
paths = paths[1:]
|
paths.insert(0, path)
|
||||||
|
|
||||||
# Start going over the parts from the root, collecting each level
|
# Start going over the parts from the root, collecting each level
|
||||||
# and discarding all nodes which don't match the level's part.
|
# and discarding all nodes which don't match the level's part.
|
||||||
|
|
Loading…
Reference in New Issue