My previous change to avoid creating a *.pyc file when running
create_manpage_completions.py was wrong because I put the
`sys.dont_write_bytecode = True` on the wrong line. Rather than simply
move that statement make the simpler, cleaner, fix that removes the need
for `eval` where that program is invoked.
The Linux kernel only splits on the first whitespace in the shebang line
(unlike BSD which splits on all whitespace). Which means there can be
only one argument after the path to the program.
Producing man pages is done infrequently (basically just at `make test`
and `make install`) so there isn't any point in writing compiled
byte-code versions of the python modules.
Problem with Type2ManParser
before:
complete -c xcode-select -s h -l help --description 'Prints the usage
message. UNINDENT NDENT 0. 0.'
after:
complete -c xcode-select -s h -l help --description 'Prints the
usage message.'
Don't truncate long lines with " [See Man Page]" suffix - use the
reclaimed 15 characters for more-useful usage info.
Improve the --verbose output with:
- spacing fixes
- diagnostics related to input print repr()/quoted as %r to be less
confusing.
- get rid of stupid name() and use type()/__class__.__name__,
- Always use new-style (new as in post python 2.2) classes so this
behaves the same whether we run in python 2 or 3.
- Properly convert left-quotes and right-quotes to that character in
deroff.py
Currently if there is a conflict with two manpages having the same
name, one completion will override the other. But if one can be parsed
and the other can't the one with parsed results will always have a
higher priority.
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.
According to the newer code below:
xdg_data_home = os.getenv('XDG_DATA_HOME', '~/.local/share')
the actual default path is ~/.local/share/fish/generated_completions/
Prefer the standard library lzma module if available. This change prevents
using the backports-lzma when it is installed for a version of Python that
already has the lzma module in its standard library.
Add support for bzip2 and lzma/xz compressed man pages. Support for bzip2 is
part of the Python standard library (at least for 2.7 and >=3.2), while lzma/xz
is only in Python >=3.3; however, there is a backports module for Python 2.7 and
3.2.