Skip to content

Commit

Permalink
Try to fix cyclic import for typing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Nov 6, 2024
1 parent 9aba065 commit 1a9f046
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions mesonbuild/arglist.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
import re
import typing as T

if T.TYPE_CHECKING:
from .linkers.linkers import StaticLinker
from .compilers import Compiler

# execinfo is a compiler lib on BSD
UNIXY_COMPILER_INTERNAL_LIBS = ['m', 'c', 'pthread', 'dl', 'rt', 'execinfo']

Expand Down Expand Up @@ -94,9 +90,12 @@ class CompilerArgs(T.MutableSequence[str]):
# TODO: these should probably move too
always_dedup_args = tuple('-l' + lib for lib in UNIXY_COMPILER_INTERNAL_LIBS)

def __init__(self, compiler: T.Union['Compiler', 'StaticLinker'],
iterable: T.Optional[T.Iterable[str]] = None):
self.compiler = compiler
def __init__(self, compiler: T.Any, iterable: T.Optional[T.Iterable[str]] = None):
# Must be here to avoid cyclic import.
from .linkers.linkers import StaticLinker
from .compilers import Compiler
assert isinstance(compiler, (StaticLinker, Compiler))
self.compiler: T.Union['Compiler', 'StaticLinker'] = compiler
self._container: T.List[str] = list(iterable) if iterable is not None else []
self.pre: T.Deque[str] = collections.deque()
self.post: T.Deque[str] = collections.deque()
Expand Down

0 comments on commit 1a9f046

Please sign in to comment.