diff options
| author | Eli Schwartz <eschwartz@archlinux.org> | 2023-08-02 21:51:50 -0400 |
|---|---|---|
| committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-08-10 13:56:39 -0400 |
| commit | 277151450a8eaf48f7038b21fdbf39b85f339e8b (patch) | |
| tree | 9ff197e0af042318c3080090ba834a1c7cface85 /mesonbuild/modules/python.py | |
| parent | 13b626b67be41635886d0a95e492cd13dfee0b1a (diff) | |
| download | meson-277151450a8eaf48f7038b21fdbf39b85f339e8b.tar.gz | |
allow some ObjectHolder subclasses to continue to be generic
ExternalProgram and CustomTarget have some use cases for producing
subclassed interpreter holders with more specific types and methods. In
order for those subclasses to properly refer to their held_object, we
need a shared base class that is still generic, though bound.
For the derived held objects, inherit from the base class and specify
the final types as the module-specific type.
Diffstat (limited to 'mesonbuild/modules/python.py')
| -rw-r--r-- | mesonbuild/modules/python.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 879c5487c..470f7b33b 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -24,8 +24,8 @@ from ..build import known_shmod_kwargs, CustomTarget, CustomTargetIndex, BuildTa from ..dependencies import NotFoundDependency from ..dependencies.detect import get_dep_identifier, find_external_dependency from ..dependencies.python import BasicPythonExternalProgram, python_factory, _PythonDependencyBase -from ..interpreter import ExternalProgramHolder, extract_required_kwarg, permitted_dependency_kwargs -from ..interpreter import primitives as P_OBJ +from ..interpreter import extract_required_kwarg, permitted_dependency_kwargs, primitives as P_OBJ +from ..interpreter.interpreterobjects import _ExternalProgramHolder from ..interpreter.type_checking import NoneType, PRESERVE_PATH_KW, SHARED_MOD_KWS from ..interpreterbase import ( noPosargs, noKwargs, permittedKwargs, ContainerTypeInfo, @@ -114,9 +114,9 @@ _PURE_KW = KwargInfo('pure', (bool, NoneType)) _SUBDIR_KW = KwargInfo('subdir', str, default='') _DEFAULTABLE_SUBDIR_KW = KwargInfo('subdir', (str, NoneType)) -class PythonInstallation(ExternalProgramHolder): +class PythonInstallation(_ExternalProgramHolder['PythonExternalProgram']): def __init__(self, python: 'PythonExternalProgram', interpreter: 'Interpreter'): - ExternalProgramHolder.__init__(self, python, interpreter) + _ExternalProgramHolder.__init__(self, python, interpreter) info = python.info prefix = self.interpreter.environment.coredata.get_option(mesonlib.OptionKey('prefix')) assert isinstance(prefix, str), 'for mypy' |
