diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2019-12-05 10:05:28 -0800 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-12-05 22:15:40 +0200 |
commit | c00e17b35a08d77f52f7a209ceec5576279dae33 (patch) | |
tree | ef29de317569d5f3a45c9ee21c10303698e7d8ae | |
parent | 875ef354d02b76515188b86dc607da39ba779235 (diff) | |
download | meson-c00e17b35a08d77f52f7a209ceec5576279dae33.zip meson-c00e17b35a08d77f52f7a209ceec5576279dae33.tar.gz meson-c00e17b35a08d77f52f7a209ceec5576279dae33.tar.bz2 |
Partially revert "lgtm: fix Missing call to __init__ during object initialization"
This partially reverts commit fe853ee516e1e7b392753a6e8f1f0b9cad6fb54f.
In particular this reverts the changes to the DynamicLinker __init__
methods. Frankly this is *bad* because it allows a mixin class (which
should not be directly instantiated) to be directly instantiated, and
complicates the init process. It also increases the amount of code for
zero gain, and makes the code less resilient to refactors.
-rw-r--r-- | mesonbuild/linkers.py | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index 28b964e..41dd929 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -137,7 +137,7 @@ class IntelVisualStudioLinker(VisualStudioLikeLinker, StaticLinker): class ArLinker(StaticLinker): def __init__(self, exelist: typing.List[str]): - StaticLinker.__init__(self, exelist) + super().__init__(exelist) self.id = 'ar' pc, stdo = mesonlib.Popen_safe(self.exelist + ['-h'])[0:2] # Enable deterministic builds if they are available. @@ -167,7 +167,7 @@ class ArmarLinker(ArLinker): # lgtm [py/missing-call-to-init] class DLinker(StaticLinker): def __init__(self, exelist: typing.List[str], arch: str): - StaticLinker.__init__(self, exelist) + super().__init__(exelist) self.id = exelist[0] self.arch = arch @@ -190,7 +190,7 @@ class DLinker(StaticLinker): class CcrxLinker(StaticLinker): def __init__(self, exelist: typing.List[str]): - StaticLinker.__init__(self, exelist) + super().__init__(exelist) self.id = 'rlink' def can_linker_accept_rsp(self) -> bool: @@ -682,8 +682,8 @@ class CcrxDynamicLinker(DynamicLinker): def __init__(self, for_machine: mesonlib.MachineChoice, *, version: str = 'unknown version'): - DynamicLinker.__init__(self, ['rlink.exe'], for_machine, 'rlink', '', - version=version) + super().__init__(['rlink.exe'], for_machine, 'rlink', '', + version=version) def get_accepts_rsp(self) -> bool: return False @@ -715,8 +715,8 @@ class ArmDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker): def __init__(self, for_machine: mesonlib.MachineChoice, *, version: str = 'unknown version'): - DynamicLinker.__init__(self, ['armlink'], for_machine, 'armlink', '', - version=version) + super().__init__(['armlink'], for_machine, 'armlink', '', + version=version) def get_accepts_rsp(self) -> bool: return False @@ -773,7 +773,7 @@ class PGIDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker): class PGIStaticLinker(StaticLinker): def __init__(self, exelist: typing.List[str]): - StaticLinker.__init__(self, exelist) + super().__init__(exelist) self.id = 'ar' self.std_args = ['-r'] @@ -796,7 +796,8 @@ class VisualStudioLikeLinkerMixin: 'custom': [], } # type: typing.Dict[str, typing.List[str]] - def __init__(self, direct: bool = True, machine: str = 'x86'): + def __init__(self, *args, direct: bool = True, machine: str = 'x86', **kwargs): + super().__init__(*args, **kwargs) self.direct = direct self.machine = machine @@ -856,9 +857,8 @@ class MSVCDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker): exelist: typing.Optional[typing.List[str]] = None, prefix: typing.Union[str, typing.List[str]] = '', machine: str = 'x86', version: str = 'unknown version'): - VisualStudioLikeLinkerMixin.__init__(self, machine=machine) - DynamicLinker.__init__(self, exelist or ['link.exe'], for_machine, 'link', - prefix, version=version) + super().__init__(exelist or ['link.exe'], for_machine, 'link', + prefix, machine=machine, version=version) class ClangClDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker): @@ -869,9 +869,8 @@ class ClangClDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker): exelist: typing.Optional[typing.List[str]] = None, prefix: typing.Union[str, typing.List[str]] = '', version: str = 'unknown version'): - VisualStudioLikeLinkerMixin.__init__(self) - DynamicLinker.__init__(self, exelist or ['lld-link.exe'], for_machine, - 'lld-link', prefix, version=version) + super().__init__(exelist or ['lld-link.exe'], for_machine, + 'lld-link', prefix, version=version) class XilinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker): @@ -880,8 +879,7 @@ class XilinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker): def __init__(self, for_machine: mesonlib.MachineChoice, *, version: str = 'unknown version'): - VisualStudioLikeLinkerMixin.__init__(self) - DynamicLinker.__init__(self, ['xilink.exe'], for_machine, 'xilink', '', version=version) + super().__init__(['xilink.exe'], for_machine, 'xilink', '', version=version) class SolarisDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker): @@ -938,8 +936,7 @@ class OptlinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker): *, version: str = 'unknown version'): # Use optlink instead of link so we don't interfer with other link.exe # implementations. - VisualStudioLikeLinkerMixin.__init__(self) - DynamicLinker.__init__(self, ['optlink.exe'], for_machine, 'optlink', prefix_arg='', version=version) + super().__init__(['optlink.exe'], for_machine, 'optlink', prefix_arg='', version=version) def get_allow_undefined_args(self) -> typing.List[str]: return [] |