aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-01-12 19:17:17 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2020-01-22 19:34:05 +0530
commit89b132f24021e81bfb3dcdbee2cac368ed677f79 (patch)
tree45501f6be52213d20c5f2057f4c9c30373df4279 /mesonbuild
parent38db769aafdf3e391c725d2438b482a6022cf493 (diff)
downloadmeson-89b132f24021e81bfb3dcdbee2cac368ed677f79.zip
meson-89b132f24021e81bfb3dcdbee2cac368ed677f79.tar.gz
meson-89b132f24021e81bfb3dcdbee2cac368ed677f79.tar.bz2
linkers: Accept both str and List[str] for _apply_prefix
Simplifies some usage.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/linkers.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py
index a106714..a60248b 100644
--- a/mesonbuild/linkers.py
+++ b/mesonbuild/linkers.py
@@ -246,12 +246,16 @@ class DynamicLinker(metaclass=abc.ABCMeta):
'custom': [],
} # type: T.Dict[str, T.List[str]]
- def _apply_prefix(self, arg: str) -> T.List[str]:
+ def _apply_prefix(self, arg: T.Union[str, T.List[str]]) -> T.List[str]:
+ args = [arg] if isinstance(arg, str) else arg
if self.prefix_arg is None:
- return [arg]
+ return args
elif isinstance(self.prefix_arg, str):
- return [self.prefix_arg + arg]
- return self.prefix_arg + [arg]
+ return [self.prefix_arg + arg for arg in args]
+ ret = []
+ for arg in args:
+ ret += self.prefix_arg + [arg]
+ return ret
def __init__(self, exelist: T.List[str], for_machine: mesonlib.MachineChoice,
id_: str, prefix_arg: T.Union[str, T.List[str]],
@@ -796,7 +800,7 @@ class VisualStudioLikeLinkerMixin:
return self._apply_prefix('/MDd')
def get_output_args(self, outputname: str) -> T.List[str]:
- return self._apply_prefix('/MACHINE:' + self.machine) + self._apply_prefix('/OUT:' + outputname)
+ return self._apply_prefix(['/MACHINE:' + self.machine, '/OUT:' + outputname])
def get_always_args(self) -> T.List[str]:
return self._apply_prefix('/nologo') + super().get_always_args()
@@ -810,7 +814,7 @@ class VisualStudioLikeLinkerMixin:
def get_debugfile_args(self, targetfile: str) -> T.List[str]:
pdbarr = targetfile.split('.')[:-1]
pdbarr += ['pdb']
- return self._apply_prefix('/DEBUG') + self._apply_prefix('/PDB:' + '.'.join(pdbarr))
+ return self._apply_prefix(['/DEBUG', '/PDB:' + '.'.join(pdbarr)])
def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
# Only since VS2015