From 94b71353ef16e90db850431fa226ff7c33939254 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 3 Feb 2017 18:16:24 +0100 Subject: [PATCH] completion generator: Define parent_paths directly if MANPATH is set --- share/tools/create_manpage_completions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/share/tools/create_manpage_completions.py b/share/tools/create_manpage_completions.py index e79744568..b1c160159 100755 --- a/share/tools/create_manpage_completions.py +++ b/share/tools/create_manpage_completions.py @@ -859,7 +859,7 @@ def get_paths_from_manpath(): import subprocess, os # $MANPATH takes precedence, just like with `man` on the CLI. if os.getenv("MANPATH"): - manpath = os.getenv("MANPATH") + parent_paths = os.getenv("MANPATH").strip().split(':') else: # Some systems have manpath, others have `man --path` (like Haiku). # TODO: Deal with systems that have neither (OpenBSD) @@ -870,7 +870,7 @@ def get_paths_from_manpath(): continue break # Command exists, use it. manpath, err_data = proc.communicate() - parent_paths = manpath.decode().strip().split(':') + parent_paths = manpath.decode().strip().split(':') if not parent_paths or proc.returncode > 0: # HACK: Use some fallback in case we can't get anything else. # `mandoc` does not provide `manpath` or `man --path` and $MANPATH might not be set, so just use the default for mandoc (minus /usr/X11R6/man, because that's not relevant).