From 48a2b87ecd9e7883ac64cd97078d3a8fba888dfb Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 15 Dec 2021 10:40:16 -0500 Subject: [PATCH] makekconfig.zsh: Don't crash when options don't have dependencies Signed-off-by: Anna Schumaker --- makekconfig.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/makekconfig.py b/makekconfig.py index 71d56ba..9833b59 100755 --- a/makekconfig.py +++ b/makekconfig.py @@ -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}"