mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
tools: remove unused function 'find_exts()' (#2950)
This commit is contained in:
parent
63e1a4cf2b
commit
c8184eceb0
1 changed files with 0 additions and 24 deletions
|
@ -192,30 +192,6 @@ def git_ls_files(base_dir, patterns=None):
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
||||||
# Recursive search for files of certain extensions.
|
|
||||||
# * Recursive glob doesn't exist in python 2.7.
|
|
||||||
# * On windows, `os.walk()` unconditionally follows symlinks.
|
|
||||||
# The `skip` parameter should be used to avoid recursing through those.
|
|
||||||
def find_exts(directories, extensions, skip=None):
|
|
||||||
if skip is None:
|
|
||||||
skip = []
|
|
||||||
assert isinstance(directories, list)
|
|
||||||
assert isinstance(extensions, list)
|
|
||||||
skip = [os.path.normpath(i) for i in skip]
|
|
||||||
matches = []
|
|
||||||
for directory in directories:
|
|
||||||
for root, dirnames, filenames in os.walk(directory):
|
|
||||||
if root in skip:
|
|
||||||
dirnames[:] = [] # Don't recurse further into this directory.
|
|
||||||
continue
|
|
||||||
for filename in filenames:
|
|
||||||
for ext in extensions:
|
|
||||||
if filename.endswith(ext):
|
|
||||||
matches.append(os.path.join(root, filename))
|
|
||||||
break
|
|
||||||
return matches
|
|
||||||
|
|
||||||
|
|
||||||
# The Python equivalent of `rm -rf`.
|
# The Python equivalent of `rm -rf`.
|
||||||
def rmtree(directory):
|
def rmtree(directory):
|
||||||
# On Windows, shutil.rmtree() won't delete files that have a readonly bit.
|
# On Windows, shutil.rmtree() won't delete files that have a readonly bit.
|
||||||
|
|
Loading…
Add table
Reference in a new issue