kopia lustrzana https://github.com/micropython/micropython-lib
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
rodzic
6b985bbc1b
commit
dedf328503
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'])
|
||||
|
|
Ładowanie…
Reference in New Issue