From a539fda0cf6342398fae802827221ed15df5de56 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 7 Dec 2020 14:58:23 -0800 Subject: [PATCH] fix LGTM warnings --- mesonbuild/build.py | 4 ++-- mesonbuild/coredata.py | 2 +- mesonbuild/interpreter.py | 1 - mesonbuild/mesonlib.py | 8 ++++---- mesonbuild/mintro.py | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 9904cbec4..dacf68b90 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from collections import OrderedDict, defaultdict +from collections import OrderedDict from functools import lru_cache import copy import hashlib @@ -32,7 +32,7 @@ from .mesonlib import ( OptionKey, ) from .compilers import ( - Compiler, all_languages, is_object, clink_langs, sort_clink, lang_suffixes, + Compiler, is_object, clink_langs, sort_clink, lang_suffixes, is_known_suffix ) from .linkers import StaticLinker diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index d4d339e31..cda0566ce 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -17,7 +17,7 @@ import pickle, os, uuid import sys from itertools import chain from pathlib import PurePath -from collections import OrderedDict, defaultdict +from collections import OrderedDict from .mesonlib import ( MesonException, EnvironmentException, MachineChoice, PerMachine, default_libdir, default_libexecdir, default_prefix, split_args, diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index def72dd3d..c20c20524 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1142,7 +1142,6 @@ class CompilerHolder(InterpreterObject): i.held_object.get_curdir(), idir) args += self.compiler.get_include_args(idir, False) if not nobuiltins: - for_machine = Interpreter.machine_from_native_kwarg(kwargs) opts = self.environment.coredata.options args += self.compiler.get_option_compile_args(opts) if mode == 'link': diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index 07cc3a1c3..2c1727b6b 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -20,8 +20,7 @@ import stat import time import platform, subprocess, operator, os, shlex, shutil, re import collections -from enum import IntEnum -from functools import lru_cache, wraps +from functools import lru_cache, wraps, total_ordering from itertools import tee, filterfalse from tempfile import TemporaryDirectory import typing as T @@ -348,7 +347,7 @@ def classify_unity_sources(compilers: T.Iterable['CompilerType'], sources: T.Ite return compsrclist -class MachineChoice(IntEnum): +class MachineChoice(enum.IntEnum): """Enum class representing one of the two abstract machine names used in most places: the build, and host, machines. @@ -1617,7 +1616,7 @@ def relative_to_if_possible(path: Path, root: Path, resolve: bool = False) -> Pa except ValueError: return path -class LibType(IntEnum): +class LibType(enum.IntEnum): """Enumeration for library types.""" @@ -1854,6 +1853,7 @@ def _classify_argument(key: 'OptionKey') -> OptionType: return OptionType.PROJECT +@total_ordering class OptionKey: """Represents an option key in the various option dictionaries. diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 9121fc766..706c585cd 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -34,7 +34,7 @@ import typing as T import os import argparse -from .mesonlib import MachineChoice, OptionKey +from .mesonlib import OptionKey def get_meson_info_file(info_dir: str) -> str: return os.path.join(info_dir, 'meson-info.json')