From 22493c9df82ccf20b791fd597e82fdfebea4ca00 Mon Sep 17 00:00:00 2001 From: Alexander Hedges Date: Sat, 7 Nov 2015 18:12:03 +0100 Subject: Guard against files that don't end in .[1...9] It seems smart to only let files be parsed that are clearly manpage files. Other files wouldn't be openend by man so I think it is safe to guess that only these files are man pages. --- share/tools/create_manpage_completions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'share/tools') diff --git a/share/tools/create_manpage_completions.py b/share/tools/create_manpage_completions.py index 8529eade..fe9c52c3 100755 --- a/share/tools/create_manpage_completions.py +++ b/share/tools/create_manpage_completions.py @@ -736,12 +736,14 @@ def parse_manpage_at_path(manpage_path, output_directory): fd = lzma.LZMAFile(str(manpage_path), 'r') manpage = fd.read() if IS_PY3: manpage = manpage.decode('latin-1') - else: + elif manpage_path.endswith((".1", ".2", ".3", ".4", ".5", ".6", ".7", ".8", ".9")): if IS_PY3: fd = open(manpage_path, 'r', encoding='latin-1') else: fd = open(manpage_path, 'r') manpage = fd.read() + else: + return fd.close() manpage = str(manpage) -- cgit v1.2.3