mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 01:52:56 +01:00
Merge branch 'master' of ssh://git.janware.com/srv/git/jan/proj/jw-python
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
commit
f810a7cdc1
1 changed files with 4 additions and 3 deletions
|
|
@ -21,7 +21,9 @@ _exts_h_cpp = _exts_h | _exts_cpp
|
||||||
def _regexify(l):
|
def _regexify(l):
|
||||||
return '|'.join(x.replace('.', '\.') + '$' for x in l)
|
return '|'.join(x.replace('.', '\.') + '$' for x in l)
|
||||||
|
|
||||||
def _scantree(path, maxdepth=sys.maxsize, depth=0):
|
def _scantree(path, maxdepth, depth=0):
|
||||||
|
if maxdepth is None:
|
||||||
|
maxdepth = sys.maxsize
|
||||||
if depth == maxdepth:
|
if depth == maxdepth:
|
||||||
return path
|
return path
|
||||||
if depth > maxdepth:
|
if depth > maxdepth:
|
||||||
|
|
@ -376,11 +378,10 @@ class Cmd(jwutils.Cmd):
|
||||||
regex = fnmatch.translate(args.name)
|
regex = fnmatch.translate(args.name)
|
||||||
else:
|
else:
|
||||||
regex = args.name_regex
|
regex = args.name_regex
|
||||||
maxdepth = args.maxdepth if args.maxdepth is not None else int(args.maxdepth)
|
|
||||||
if regex is not None:
|
if regex is not None:
|
||||||
for entry in _scantree(args.root, args.maxdepth):
|
for entry in _scantree(args.root, args.maxdepth):
|
||||||
if re.search(regex, entry.name):
|
if re.search(regex, entry.name):
|
||||||
root = os.path.dirname(entry.path)
|
root = os.dirname(entry.path)
|
||||||
if not root:
|
if not root:
|
||||||
root = '.'
|
root = '.'
|
||||||
files.append((root, entry.path))
|
files.append((root, entry.path))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue