Merge pull request #1494 from trabucayre/parset_fix_target_group

litex/build/parser: check if self._target_group is not None before calling add_argument
This commit is contained in:
enjoy-digital 2022-11-07 21:03:37 +01:00 committed by GitHub
commit ff3bd11de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -52,6 +52,7 @@ class LiteXArgumentParser(argparse.ArgumentParser):
self._default_toolchain = None
self._args = None
self._toolchain = None
self._target_group = None
if platform is not None:
self.set_platform(platform)
self.add_target_group()
@ -82,7 +83,6 @@ class LiteXArgumentParser(argparse.ArgumentParser):
def add_target_group(self):
""" create target group and add --toolchain/build/load args.
"""
self._target_group = self.add_argument_group(title="Target options")
if self.toolchains is not None:
self.add_target_argument("--toolchain",
default = self._default_toolchain,
@ -97,6 +97,8 @@ class LiteXArgumentParser(argparse.ArgumentParser):
""" wrapper to add argument to "Target options group" from outer of this
class
"""
if self._target_group is None:
self._target_group = self.add_argument_group(title="Target options")
self._target_group.add_argument(*args, **kwargs)
@property