diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-06-13 21:25:29 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-06-14 09:09:32 -0700 |
commit | 0412bdd7535ec8d8d314f5ecf6120472534764ba (patch) | |
tree | 0fe86e702eff81f39b1cd80a4744c0f251e2104a /mesonbuild/dependencies/factory.py | |
parent | 203a548d60343a97e436b59aa026ce17597f1cd1 (diff) | |
download | meson-0412bdd7535ec8d8d314f5ecf6120472534764ba.zip meson-0412bdd7535ec8d8d314f5ecf6120472534764ba.tar.gz meson-0412bdd7535ec8d8d314f5ecf6120472534764ba.tar.bz2 |
dependencies: Use a typing.NewType for Dependency.type_name
This allow mypy to catch cases where we accidently assign the dependency
name to the type_name, as it sees them as having different types (though
at runtime they're all strings).
Diffstat (limited to 'mesonbuild/dependencies/factory.py')
-rw-r--r-- | mesonbuild/dependencies/factory.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/mesonbuild/dependencies/factory.py b/mesonbuild/dependencies/factory.py index d0ecc5e..9ee5bfd 100644 --- a/mesonbuild/dependencies/factory.py +++ b/mesonbuild/dependencies/factory.py @@ -1,4 +1,5 @@ # Copyright 2013-2021 The Meson development team +# Copyright © 2021 Intel Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,15 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .base import Dependency, ExternalDependency +import functools +import typing as T + +from ..mesonlib import MachineChoice from .base import DependencyException, DependencyMethods +from .base import ExternalDependency from .base import process_method_kw from .cmake import CMakeDependency from .framework import ExtraFrameworkDependency from .pkgconfig import PkgConfigDependency -from ..mesonlib import MachineChoice -import functools -import typing as T +from .system import SystemDependency if T.TYPE_CHECKING: from ..environment import Environment @@ -78,7 +81,7 @@ class DependencyFactory: configtool_class: 'T.Optional[T.Type[ConfigToolDependency]]' = None, framework_name: T.Optional[str] = None, framework_class: 'T.Type[ExtraFrameworkDependency]' = ExtraFrameworkDependency, - system_class: 'T.Type[ExternalDependency]' = ExternalDependency): + system_class: 'T.Type[SystemDependency]' = SystemDependency): if DependencyMethods.CONFIG_TOOL in methods and not configtool_class: raise DependencyException('A configtool must have a custom class') |