aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-12-20 12:00:46 -0800
committerDylan Baker <dylan@pnwbakers.com>2022-02-23 10:18:34 -0800
commit7a38d81ff9ff68279091d63fdfcdb15fe3d132eb (patch)
tree57f505f4a86e30b064af8a7d700fb1955db902cb
parentc0be7e05b070d85b38c79088df882970a5cd0279 (diff)
downloadmeson-7a38d81ff9ff68279091d63fdfcdb15fe3d132eb.zip
meson-7a38d81ff9ff68279091d63fdfcdb15fe3d132eb.tar.gz
meson-7a38d81ff9ff68279091d63fdfcdb15fe3d132eb.tar.bz2
mesonlib: allow check_dirent_issues to take an iterable
There's no reason it needs a concrete list, any iterable is fine. This does mean that we need to explicitly check for `str | bytes` in the listify pass, as `str` and `bytes` are both iterable.
-rw-r--r--mesonbuild/mesonlib/universal.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py
index e86fb99..1bbc2c6 100644
--- a/mesonbuild/mesonlib/universal.py
+++ b/mesonbuild/mesonlib/universal.py
@@ -245,7 +245,7 @@ def is_ascii_string(astring: T.Union[str, bytes]) -> bool:
return True
-def check_direntry_issues(direntry_array: T.Union[T.List[T.Union[str, bytes]], str, bytes]) -> None:
+def check_direntry_issues(direntry_array: T.Union[T.Iterable[T.Union[str, bytes]], str, bytes]) -> None:
import locale
# Warn if the locale is not UTF-8. This can cause various unfixable issues
# such as os.stat not being able to decode filenames with unicode in them.
@@ -253,7 +253,7 @@ def check_direntry_issues(direntry_array: T.Union[T.List[T.Union[str, bytes]], s
# encoding, so we can just warn about it.
e = locale.getpreferredencoding()
if e.upper() != 'UTF-8' and not is_windows():
- if not isinstance(direntry_array, list):
+ if isinstance(direntry_array, (str, bytes)):
direntry_array = [direntry_array]
for de in direntry_array:
if is_ascii_string(de):