summaryrefslogtreecommitdiffstats
path: root/wscript_build.py
diff options
context:
space:
mode:
authorPhilip Sequeira <phsequei@gmail.com>2017-11-22 19:09:06 -0500
committerwm4 <1387750+wm4@users.noreply.github.com>2019-09-27 13:19:29 +0200
commit2712db8238846f7b4e24052dbe091ea87defc5ae (patch)
tree02df8e961c08931dafb7e6a9d561497ade9cd9a5 /wscript_build.py
parent21a5c416d5de6ef43a5e2c08ba53cb2a8cb59ae2 (diff)
downloadmpv-2712db8238846f7b4e24052dbe091ea87defc5ae.tar.bz2
mpv-2712db8238846f7b4e24052dbe091ea87defc5ae.tar.xz
zsh completion: move generation to runtime and improve
The completion function itself now parses --list-options on the first tab press and caches the results. This does mean a slight delay on that first tab press, but it will only do this if the argument being completed looks like an option (i.e. starts with "-"), so there is never a delay when just completing a file name. I've also put some effort into making it reasonably fast; on my machine it's consistently under 100 ms, more than half of which is mpv itself. Installation of zsh completion is now done unconditionally because it's nothing more than copying a file. If you really don't want it installed, set zshdir to empty: `./waf configure --zshdir= ...` Improvements in functionality compared to the old script: * Produces the right results for mpv binaries other than the one it was installed with (like a dev build for testing changes). * Does not require running mpv at build time, so it won't cause problems with cross compilation. * Handles aliases. * Slightly nicer handling of options that take comma-separated values and/or sub-options: A space is now inserted at the end instead of a comma, allowing you to immediately start typing the next argument, but typing a comma will still remove the automatically added space, and = and : will now do that too, so you can immediately add a sub-option. * More general/flexible handling of values for options that print their possible values with --option=help. The code as is could handle quite a few more options (*scale, demuxers, decoders, ...), but nobody wants to maintain that list here so we'll just stick with what the old completion script already did.
Diffstat (limited to 'wscript_build.py')
-rw-r--r--wscript_build.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/wscript_build.py b/wscript_build.py
index 50f8e641ea..301e8819e4 100644
--- a/wscript_build.py
+++ b/wscript_build.py
@@ -717,11 +717,8 @@ def build(ctx):
if ctx.dependency_satisfied('cplayer'):
- if ctx.dependency_satisfied('zsh-comp'):
- ctx.zshcomp(target = "etc/_mpv", source = "TOOLS/zsh.pl")
- ctx.install_files(
- ctx.env.ZSHDIR,
- ['etc/_mpv'])
+ if ctx.env.ZSHDIR:
+ ctx.install_as(ctx.env.ZSHDIR + '/_mpv', 'etc/_mpv.zsh')
ctx.install_files(
ctx.env.DATADIR + '/applications',