diff options
author | Alexander Hedges <ahedges@ethz.ch> | 2015-11-07 18:12:03 +0100 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2015-11-08 12:19:15 -0800 |
commit | 22493c9df82ccf20b791fd597e82fdfebea4ca00 (patch) | |
tree | 8f85c89159c1a667a182582c7b723b79bfdb0fae /share/tools | |
parent | 8d97a858349853ba3e965c450a0c4c90fbdda554 (diff) |
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.
Diffstat (limited to 'share/tools')
-rwxr-xr-x | share/tools/create_manpage_completions.py | 4 |
1 files changed, 3 insertions, 1 deletions
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) |