aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/ui.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2021-06-07 18:12:53 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-06-09 09:46:37 +0200
commit15b69d0421fb998cef2647cae7af62baa6af3498 (patch)
treed5a61f30761453110502aeae00b010de20e3cf60 /mesonbuild/dependencies/ui.py
parenta7357887c79debc73bb0158ce70b22263fcf7a76 (diff)
downloadmeson-15b69d0421fb998cef2647cae7af62baa6af3498.zip
meson-15b69d0421fb998cef2647cae7af62baa6af3498.tar.gz
meson-15b69d0421fb998cef2647cae7af62baa6af3498.tar.bz2
typing: Fully annotate dependencies
Diffstat (limited to 'mesonbuild/dependencies/ui.py')
-rw-r--r--mesonbuild/dependencies/ui.py28
1 files changed, 15 insertions, 13 deletions
diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py
index 3d68e46..4eefd6e 100644
--- a/mesonbuild/dependencies/ui.py
+++ b/mesonbuild/dependencies/ui.py
@@ -35,7 +35,7 @@ if T.TYPE_CHECKING:
class GLDependencySystem(ExternalDependency):
- def __init__(self, name: str, environment, kwargs):
+ def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]) -> None:
super().__init__(name, environment, kwargs)
if self.env.machines[self.for_machine].is_darwin():
@@ -52,13 +52,13 @@ class GLDependencySystem(ExternalDependency):
return
@staticmethod
- def get_methods():
+ def get_methods() -> T.List[DependencyMethods]:
if mesonlib.is_osx() or mesonlib.is_windows():
return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM]
else:
return [DependencyMethods.PKGCONFIG]
- def log_tried(self):
+ def log_tried(self) -> str:
return 'system'
class GnuStepDependency(ConfigToolDependency):
@@ -66,7 +66,7 @@ class GnuStepDependency(ConfigToolDependency):
tools = ['gnustep-config']
tool_name = 'gnustep-config'
- def __init__(self, environment, kwargs):
+ def __init__(self, environment: 'Environment', kwargs: T.Dict[str, T.Any]) -> None:
super().__init__('gnustep', environment, kwargs, language='objc')
if not self.is_found:
return
@@ -77,7 +77,7 @@ class GnuStepDependency(ConfigToolDependency):
['--gui-libs' if 'gui' in self.modules else '--base-libs'],
'link_args'))
- def find_config(self, versions=None, returncode: int = 0):
+ def find_config(self, versions: T.Optional[T.List[str]] = None, returncode: int = 0) -> T.Tuple[T.Optional[T.List[str]], T.Optional[str]]:
tool = [self.tools[0]]
try:
p, out = Popen_safe(tool + ['--help'])[:2]
@@ -92,14 +92,16 @@ class GnuStepDependency(ConfigToolDependency):
return (tool, found_version)
- def weird_filter(self, elems):
+ @staticmethod
+ def weird_filter(elems: T.List[str]) -> T.List[str]:
"""When building packages, the output of the enclosing Make is
sometimes mixed among the subprocess output. I have no idea why. As a
hack filter out everything that is not a flag.
"""
return [e for e in elems if e.startswith('-')]
- def filter_args(self, args):
+ @staticmethod
+ def filter_args(args: T.List[str]) -> T.List[str]:
"""gnustep-config returns a bunch of garbage args such as -O2 and so
on. Drop everything that is not needed.
"""
@@ -113,7 +115,7 @@ class GnuStepDependency(ConfigToolDependency):
result.append(f)
return result
- def detect_version(self):
+ def detect_version(self) -> str:
gmake = self.get_config_value(['--variable=GNUMAKE'], 'variable')[0]
makefile_dir = self.get_config_value(['--variable=GNUSTEP_MAKEFILES'], 'variable')[0]
# This Makefile has the GNUStep version set
@@ -149,7 +151,7 @@ class SDL2DependencyConfigTool(ConfigToolDependency):
self.link_args = self.get_config_value(['--libs'], 'link_args')
@staticmethod
- def get_methods():
+ def get_methods() -> T.List[DependencyMethods]:
if mesonlib.is_osx():
return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK]
else:
@@ -196,7 +198,7 @@ class WxDependency(ConfigToolDependency):
class VulkanDependencySystem(ExternalDependency):
- def __init__(self, name: str, environment, kwargs, language: T.Optional[str] = None):
+ def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any], language: T.Optional[str] = None) -> None:
super().__init__(name, environment, kwargs, language=language)
try:
@@ -223,7 +225,7 @@ class VulkanDependencySystem(ExternalDependency):
inc_path = os.path.join(self.vulkan_sdk, inc_dir)
header = os.path.join(inc_path, 'vulkan', 'vulkan.h')
lib_path = os.path.join(self.vulkan_sdk, lib_dir)
- find_lib = self.clib_compiler.find_library(lib_name, environment, lib_path)
+ find_lib = self.clib_compiler.find_library(lib_name, environment, [lib_path])
if not find_lib:
raise DependencyException('VULKAN_SDK point to invalid directory (no lib)')
@@ -251,10 +253,10 @@ class VulkanDependencySystem(ExternalDependency):
return
@staticmethod
- def get_methods():
+ def get_methods() -> T.List[DependencyMethods]:
return [DependencyMethods.SYSTEM]
- def log_tried(self):
+ def log_tried(self) -> str:
return 'system'
gl_factory = DependencyFactory(