makekconfig.zsh: Don't crash when options don't have dependencies

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2021-12-15 10:40:16 -05:00
parent 9f54c866ed
commit 48a2b87ecd
1 changed files with 6 additions and 3 deletions

View File

@ -42,9 +42,12 @@ class Option:
self.state = "y"
self.res = None
depends = re.search("\sdepends on (.*?)\n", opt).group(1).strip()
depends = [ d.strip() for d in re.split("[&&|=m|=y|=n]", depends) ]
self.depends = set([ d for d in depends if len(d) > 0 ])
if search := re.search("\sdepends on (.*?)\n", opt):
depends = search.group(1).strip()
depends = [ d.strip() for d in re.split("[&&|=m|=y|=n]", depends) ]
self.depends = set([ d for d in depends if len(d) > 0 ])
else:
self.depends = set()
def __repr__(self):
return f"{self.name}:{self.type}"