diff options
author | Nathan Goldbaum <nathan.goldbaum@gmail.com> | 2023-05-10 11:25:41 -0600 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2023-06-27 20:26:48 +0300 |
commit | f92bc05c182d9243a19c4af8c303986f1719eee6 (patch) | |
tree | a1efc4c46dfae8cc3b7af8d1b4ead4f24bc3a997 | |
parent | 8e879911ecc3e3934da552d9b936604a00abc144 (diff) | |
download | meson-f92bc05c182d9243a19c4af8c303986f1719eee6.zip meson-f92bc05c182d9243a19c4af8c303986f1719eee6.tar.gz meson-f92bc05c182d9243a19c4af8c303986f1719eee6.tar.bz2 |
interpreter: use os.listdir instead of os.scandir to avoid ResourceWarning
-rw-r--r-- | mesonbuild/interpreter/interpreter.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index dd2cabf..5e36eea 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -103,6 +103,7 @@ import typing as T import textwrap import importlib import copy +import contextlib if T.TYPE_CHECKING: import argparse @@ -2513,7 +2514,7 @@ class Interpreter(InterpreterBase, HoldableObject): exclude = (set(kwargs['exclude_files']), set(kwargs['exclude_directories'])) srcdir = os.path.join(self.environment.source_dir, self.subdir, args[0]) - if not os.path.isdir(srcdir) or not any(os.scandir(srcdir)): + if not os.path.isdir(srcdir) or not any(os.listdir(srcdir)): FeatureNew.single_use('install_subdir with empty directory', '0.47.0', self.subproject, location=node) FeatureDeprecated.single_use('install_subdir with empty directory', '0.60.0', self.subproject, 'It worked by accident and is buggy. Use install_emptydir instead.', node) |