aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-12-05 01:28:21 -0500
committerEli Schwartz <eschwartz@archlinux.org>2021-12-05 11:39:20 -0500
commit4b2c54569df780e36fc5bf1905ae6b60d1393fba (patch)
tree2b9181948490a8a34eba6be672ca939ef9ac51e9
parent4f0c5af3908241228f042184cdbd2b8fc286712e (diff)
downloadmeson-4b2c54569df780e36fc5bf1905ae6b60d1393fba.zip
meson-4b2c54569df780e36fc5bf1905ae6b60d1393fba.tar.gz
meson-4b2c54569df780e36fc5bf1905ae6b60d1393fba.tar.bz2
clean up function signatures in preparation for dataclasses
FeatureCheck always immediately sets extra_message to '' if it isn't explicitly passed, so there is really no point in using None as a sentinel that is never used. Names used in init functions are sometimes pointlessly different from the class instance attributes they are immediately assigned to. They would make more sense if defined properly.
-rw-r--r--mesonbuild/build.py24
-rw-r--r--mesonbuild/interpreterbase/decorators.py8
2 files changed, 16 insertions, 16 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 89c158e..54735c2 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -139,12 +139,12 @@ class DependencyOverride(HoldableObject):
class Headers(HoldableObject):
def __init__(self, sources: T.List[File], install_subdir: T.Optional[str],
- install_dir: T.Optional[str], install_mode: 'FileMode',
+ custom_install_dir: T.Optional[str], custom_install_mode: 'FileMode',
subproject: str):
self.sources = sources
self.install_subdir = install_subdir
- self.custom_install_dir = install_dir
- self.custom_install_mode = install_mode
+ self.custom_install_dir = custom_install_dir
+ self.custom_install_mode = custom_install_mode
self.subproject = subproject
# TODO: we really don't need any of these methods, but they're preserved to
@@ -168,12 +168,12 @@ class Headers(HoldableObject):
class Man(HoldableObject):
- def __init__(self, sources: T.List[File], install_dir: T.Optional[str],
- install_mode: 'FileMode', subproject: str,
+ def __init__(self, sources: T.List[File], custom_install_dir: T.Optional[str],
+ custom_install_mode: 'FileMode', subproject: str,
locale: T.Optional[str]):
self.sources = sources
- self.custom_install_dir = install_dir
- self.custom_install_mode = install_mode
+ self.custom_install_dir = custom_install_dir
+ self.custom_install_mode = custom_install_mode
self.subproject = subproject
self.locale = locale
@@ -199,14 +199,14 @@ class EmptyDir(HoldableObject):
class InstallDir(HoldableObject):
- def __init__(self, src_subdir: str, inst_subdir: str, install_dir: str,
+ def __init__(self, source_subdir: str, installable_subdir: str, install_dir: str,
install_mode: 'FileMode',
exclude: T.Tuple[T.Set[str], T.Set[str]],
strip_directory: bool, subproject: str,
from_source_dir: bool = True,
install_tag: T.Optional[str] = None):
- self.source_subdir = src_subdir
- self.installable_subdir = inst_subdir
+ self.source_subdir = source_subdir
+ self.installable_subdir = installable_subdir
self.install_dir = install_dir
self.install_mode = install_mode
self.exclude = exclude
@@ -367,9 +367,9 @@ class IncludeDirs(HoldableObject):
"""Internal representation of an include_directories call."""
- def __init__(self, curdir: str, dirs: T.List[str], is_system: bool, extra_build_dirs: T.Optional[T.List[str]] = None):
+ def __init__(self, curdir: str, incdirs: T.List[str], is_system: bool, extra_build_dirs: T.Optional[T.List[str]] = None):
self.curdir = curdir
- self.incdirs = dirs
+ self.incdirs = incdirs
self.is_system = is_system
# Interpreter has validated that all given directories
diff --git a/mesonbuild/interpreterbase/decorators.py b/mesonbuild/interpreterbase/decorators.py
index 8832d29..f88b1fd 100644
--- a/mesonbuild/interpreterbase/decorators.py
+++ b/mesonbuild/interpreterbase/decorators.py
@@ -569,10 +569,10 @@ class FeatureCheckBase(metaclass=abc.ABCMeta):
feature_registry: T.ClassVar[T.Dict[str, T.Dict[str, T.Set[T.Tuple[str, T.Optional['mparser.BaseNode']]]]]]
emit_notice = False
- def __init__(self, feature_name: str, version: str, extra_message: T.Optional[str] = None, location: T.Optional['mparser.BaseNode'] = None):
+ def __init__(self, feature_name: str, feature_version: str, extra_message: str = '', location: T.Optional['mparser.BaseNode'] = None):
self.feature_name = feature_name # type: str
- self.feature_version = version # type: str
- self.extra_message = extra_message or '' # type: str
+ self.feature_version = feature_version # type: str
+ self.extra_message = extra_message # type: str
self.location = location
@staticmethod
@@ -656,7 +656,7 @@ class FeatureCheckBase(metaclass=abc.ABCMeta):
@classmethod
def single_use(cls, feature_name: str, version: str, subproject: str,
- extra_message: T.Optional[str] = None, location: T.Optional['mparser.BaseNode'] = None) -> None:
+ extra_message: str = '', location: T.Optional['mparser.BaseNode'] = None) -> None:
"""Oneline version that instantiates and calls use()."""
cls(feature_name, version, extra_message, location).use(subproject)