diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-08-29 19:25:36 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-09-12 19:16:59 -0400 |
commit | 7972c49bda5c2fcd6d647f45f5a5fa250f68f4b6 (patch) | |
tree | 13040f231cd888cb40541e7c5a4e36ab92285d43 /mesonbuild | |
parent | 36e7748d02ccd933f1ebe865564c7cee22fddbf6 (diff) | |
download | meson-7972c49bda5c2fcd6d647f45f5a5fa250f68f4b6.zip meson-7972c49bda5c2fcd6d647f45f5a5fa250f68f4b6.tar.gz meson-7972c49bda5c2fcd6d647f45f5a5fa250f68f4b6.tar.bz2 |
dependencies: simplify log_tried into a staticmethod
It doesn't really need class instantiation to just know what type it is,
and this way we can get the information early if a dependency fails to
init.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/dependencies/base.py | 9 | ||||
-rw-r--r-- | mesonbuild/dependencies/cmake.py | 5 | ||||
-rw-r--r-- | mesonbuild/dependencies/configtool.py | 5 | ||||
-rw-r--r-- | mesonbuild/dependencies/framework.py | 3 | ||||
-rw-r--r-- | mesonbuild/dependencies/misc.py | 3 | ||||
-rw-r--r-- | mesonbuild/dependencies/pkgconfig.py | 5 | ||||
-rw-r--r-- | mesonbuild/dependencies/platform.py | 3 |
7 files changed, 21 insertions, 12 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 550a88f..afe70c7 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -387,7 +387,8 @@ class ExternalDependency(Dependency, HasNativeKwarg): def log_info(self) -> str: return '' - def log_tried(self) -> str: + @staticmethod + def log_tried() -> str: return '' # Check if dependency version meets the requirements @@ -602,7 +603,8 @@ class SystemDependency(ExternalDependency): super().__init__(DependencyTypeName('system'), env, kwargs, language=language) self.name = name - def log_tried(self) -> str: + @staticmethod + def log_tried() -> str: return 'system' @@ -615,5 +617,6 @@ class BuiltinDependency(ExternalDependency): super().__init__(DependencyTypeName('builtin'), env, kwargs, language=language) self.name = name - def log_tried(self) -> str: + @staticmethod + def log_tried() -> str: return 'builtin' diff --git a/mesonbuild/dependencies/cmake.py b/mesonbuild/dependencies/cmake.py index f19efe2..e5443dd 100644 --- a/mesonbuild/dependencies/cmake.py +++ b/mesonbuild/dependencies/cmake.py @@ -617,8 +617,9 @@ class CMakeDependency(ExternalDependency): build_dir = self._setup_cmake_dir(cmake_file) return self.cmakebin.call(args, build_dir, env=env) - def log_tried(self) -> str: - return self.type_name + @staticmethod + def log_tried() -> str: + return 'cmake' def log_details(self) -> str: modules = [self._original_module_name(x) for x in self.found_modules] diff --git a/mesonbuild/dependencies/configtool.py b/mesonbuild/dependencies/configtool.py index 3e8f212..8b7f1bb 100644 --- a/mesonbuild/dependencies/configtool.py +++ b/mesonbuild/dependencies/configtool.py @@ -149,8 +149,9 @@ class ConfigToolDependency(ExternalDependency): mlog.debug(f'Got config-tool variable {variable_name} : {variable}') return variable - def log_tried(self) -> str: - return self.type_name + @staticmethod + def log_tried() -> str: + return 'config-tool' def get_variable(self, *, cmake: T.Optional[str] = None, pkgconfig: T.Optional[str] = None, configtool: T.Optional[str] = None, internal: T.Optional[str] = None, diff --git a/mesonbuild/dependencies/framework.py b/mesonbuild/dependencies/framework.py index 3a947f0..f288851 100644 --- a/mesonbuild/dependencies/framework.py +++ b/mesonbuild/dependencies/framework.py @@ -115,5 +115,6 @@ class ExtraFrameworkDependency(ExternalDependency): def log_info(self) -> str: return self.framework_path or '' - def log_tried(self) -> str: + @staticmethod + def log_tried() -> str: return 'framework' diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index f8204e3..a5b1f41 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -284,7 +284,8 @@ class Python3DependencySystem(SystemDependency): self.version = sysconfig.get_config_var('py_version') self.is_found = True - def log_tried(self) -> str: + @staticmethod + def log_tried() -> str: return 'sysconfig' class PcapDependencyConfigTool(ConfigToolDependency): diff --git a/mesonbuild/dependencies/pkgconfig.py b/mesonbuild/dependencies/pkgconfig.py index 62a7e39..3905fc7 100644 --- a/mesonbuild/dependencies/pkgconfig.py +++ b/mesonbuild/dependencies/pkgconfig.py @@ -479,8 +479,9 @@ class PkgConfigDependency(ExternalDependency): # a path rather than the raw dlname return os.path.basename(dlname) - def log_tried(self) -> str: - return self.type_name + @staticmethod + def log_tried() -> str: + return 'pkgconfig' def get_variable(self, *, cmake: T.Optional[str] = None, pkgconfig: T.Optional[str] = None, configtool: T.Optional[str] = None, internal: T.Optional[str] = None, diff --git a/mesonbuild/dependencies/platform.py b/mesonbuild/dependencies/platform.py index 7759b0f..1fd1d78 100644 --- a/mesonbuild/dependencies/platform.py +++ b/mesonbuild/dependencies/platform.py @@ -54,5 +54,6 @@ class AppleFrameworks(ExternalDependency): def log_info(self) -> str: return ', '.join(self.frameworks) - def log_tried(self) -> str: + @staticmethod + def log_tried() -> str: return 'framework' |