summaryrefslogtreecommitdiff
path: root/mesonbuild/arglist.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/arglist.py')
-rw-r--r--mesonbuild/arglist.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/mesonbuild/arglist.py b/mesonbuild/arglist.py
index dfb3dcd41..f50d54eed 100644
--- a/mesonbuild/arglist.py
+++ b/mesonbuild/arglist.py
@@ -82,23 +82,23 @@ class CompilerArgs(T.MutableSequence[str]):
'''
# Arg prefixes that override by prepending instead of appending
- prepend_prefixes = () # type: T.Tuple[str, ...]
+ prepend_prefixes: T.Tuple[str, ...] = ()
# Arg prefixes and args that must be de-duped by returning 2
- dedup2_prefixes = () # type: T.Tuple[str, ...]
- dedup2_suffixes = () # type: T.Tuple[str, ...]
- dedup2_args = () # type: T.Tuple[str, ...]
+ dedup2_prefixes: T.Tuple[str, ...] = ()
+ dedup2_suffixes: T.Tuple[str, ...] = ()
+ dedup2_args: T.Tuple[str, ...] = ()
# Arg prefixes and args that must be de-duped by returning 1
#
# NOTE: not thorough. A list of potential corner cases can be found in
# https://github.com/mesonbuild/meson/pull/4593#pullrequestreview-182016038
- dedup1_prefixes = () # type: T.Tuple[str, ...]
+ dedup1_prefixes: T.Tuple[str, ...] = ()
dedup1_suffixes = ('.lib', '.dll', '.so', '.dylib', '.a')
# Match a .so of the form path/to/libfoo.so.0.1.0
# Only UNIX shared libraries require this. Others have a fixed extension.
dedup1_regex = re.compile(r'([\/\\]|\A)lib.*\.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$')
- dedup1_args = () # type: T.Tuple[str, ...]
+ dedup1_args: T.Tuple[str, ...] = ()
# In generate_link() we add external libs without de-dup, but we must
# *always* de-dup these because they're special arguments to the linker
# TODO: these should probably move too
@@ -107,19 +107,19 @@ class CompilerArgs(T.MutableSequence[str]):
def __init__(self, compiler: T.Union['Compiler', 'StaticLinker'],
iterable: T.Optional[T.Iterable[str]] = None):
self.compiler = compiler
- self._container = list(iterable) if iterable is not None else [] # type: T.List[str]
- self.pre = collections.deque() # type: T.Deque[str]
- self.post = collections.deque() # type: T.Deque[str]
+ 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()
# Flush the saved pre and post list into the _container list
#
# This correctly deduplicates the entries after _can_dedup definition
# Note: This function is designed to work without delete operations, as deletions are worsening the performance a lot.
def flush_pre_post(self) -> None:
- new = [] # type: T.List[str]
- pre_flush_set = set() # type: T.Set[str]
- post_flush = collections.deque() # type: T.Deque[str]
- post_flush_set = set() # type: T.Set[str]
+ new: T.List[str] = []
+ pre_flush_set: T.Set[str] = set()
+ post_flush: T.Deque[str] = collections.deque()
+ post_flush_set: T.Set[str] = set()
#The two lists are here walked from the front to the back, in order to not need removals for deduplication
for a in self.pre:
@@ -285,7 +285,7 @@ class CompilerArgs(T.MutableSequence[str]):
Add two CompilerArgs while taking into account overriding of arguments
and while preserving the order of arguments as much as possible
'''
- tmp_pre = collections.deque() # type: T.Deque[str]
+ tmp_pre: T.Deque[str] = collections.deque()
if not isinstance(args, collections.abc.Iterable):
raise TypeError(f'can only concatenate Iterable[str] (not "{args}") to CompilerArgs')
for arg in args: