Skip to content

Commit

Permalink
dependencies/dub: Handle a MissingCompiler gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbaker committed Dec 4, 2023
1 parent 63a21eb commit 8999d15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions mesonbuild/dependencies/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ class MissingCompiler(_MissingCompilerBase):
"""Represent a None Compiler - when no tool chain is found.
replacing AttributeError with DependencyException"""

language = 'missing'

# These are needed in type checking mode to avoid errors, but we don't want
# the extra overhead at runtime
if T.TYPE_CHECKING:
Expand Down
5 changes: 4 additions & 1 deletion mesonbuild/dependencies/dub.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def __init__(self, name: str, environment: 'Environment', kwargs: DependencyKw):
from ..compilers.d import DCompiler, d_feature_args

_temp_comp = super().get_compiler()
assert isinstance(_temp_comp, DCompiler)
if _temp_comp.language == 'missing':
self.is_found = False
return
assert isinstance(_temp_comp, DCompiler), 'Compiler must be a D language compiler'
self.compiler = _temp_comp

if DubDependency.class_dubbin is None and not DubDependency.class_dubbin_searched:
Expand Down

0 comments on commit 8999d15

Please sign in to comment.