1 """Filename globbing utility."""
10 """Return a list of paths matching a pathname pattern.
12 The pattern may contain simple shell-style wildcards a la fnmatch.
16 if os.path.exists(pathname):
20 dirname, basename = os.path.split(pathname)
22 return glob1(os.curdir, basename)
30 if basename
or os.path.isdir(dirname):
31 name = os.path.join(dirname, basename)
32 if os.path.exists(name):
37 sublist =
glob1(dirname, basename)
39 result.append(os.path.join(dirname, name))
43 if not dirname: dirname = os.curdir
45 names = os.listdir(dirname)
49 names=
filter(
lambda x: x[0]!=
'.',names)
53 magic_check = re.compile(
'[*?[]')
56 return magic_check.search(s)
is not None