fnmatch: Remove dependency on posixpath module.

In micropython-lib, os.path.normcase is already a no-op.

Signed-off-by: Damien George <damien@micropython.org>
pull/205/merge
Damien George 2020-07-07 19:09:59 +10:00
rodzic 6b985bbc1b
commit dedf328503
3 zmienionych plików z 5 dodań i 12 usunięć

Wyświetl plik

@ -11,7 +11,6 @@ corresponding to PATTERN. (It does not compile it.)
"""
import os
import os.path
import posixpath
import re
#import functools
@ -51,15 +50,9 @@ def filter(names, pat):
result = []
pat = os.path.normcase(pat)
match = _compile_pattern(pat)
if os.path is posixpath:
# normcase on posix is NOP. Optimize it away from the loop.
for name in names:
if match(name):
result.append(name)
else:
for name in names:
if match(os.path.normcase(name)):
result.append(name)
for name in names:
if match(os.path.normcase(name)):
result.append(name)
return result
def fnmatchcase(name, pat):

Wyświetl plik

@ -1,4 +1,4 @@
srctype = cpython
type = module
version = 0.5.2
depends = os, os.path, posixpath, re-pcre
depends = os, os.path, re-pcre

Wyświetl plik

@ -18,4 +18,4 @@ setup(name='micropython-fnmatch',
license='Python',
cmdclass={'sdist': sdist_upip.sdist},
py_modules=['fnmatch'],
install_requires=['micropython-os', 'micropython-os.path', 'micropython-posixpath', 'micropython-re-pcre'])
install_requires=['micropython-os', 'micropython-os.path', 'micropython-re-pcre'])