From dedf328503430fa70257ec980f26bbbbfa2d9321 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 7 Jul 2020 19:09:59 +1000 Subject: [PATCH] fnmatch: Remove dependency on posixpath module. In micropython-lib, os.path.normcase is already a no-op. Signed-off-by: Damien George --- fnmatch/fnmatch.py | 13 +++---------- fnmatch/metadata.txt | 2 +- fnmatch/setup.py | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/fnmatch/fnmatch.py b/fnmatch/fnmatch.py index d5f7a43f..a117f37a 100644 --- a/fnmatch/fnmatch.py +++ b/fnmatch/fnmatch.py @@ -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): diff --git a/fnmatch/metadata.txt b/fnmatch/metadata.txt index 8e2dba1f..faa83214 100644 --- a/fnmatch/metadata.txt +++ b/fnmatch/metadata.txt @@ -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 diff --git a/fnmatch/setup.py b/fnmatch/setup.py index 0d21bdae..9d449943 100644 --- a/fnmatch/setup.py +++ b/fnmatch/setup.py @@ -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'])