Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: update python completion for 3.0
- X-seq: zsh-workers 26365
- From: "U-ROSIE\\Administrator" <dougkearns@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: update python completion for 3.0
- Date: Mon, 19 Jan 2009 21:24:03 +1100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=HGR+xmDXEi/pa8ONh1qyCYZKfYKSRnI3b7KIyYRCyus=; b=F+bG149MuetGslpJwE5TiyAfsfd9oOCSrzTNtiWnu+8pLPiMaiXKyBMRITlHDwCx8H gpH7RpyooSU4Q5S8hcUPxO2mnVWNS/QZ3uuTHwDcuXmvxuisaZDh9b3EDDtzAOEEhmK7 EqWPhVXnaV62GpaDm3FSWeKoKMcRljTSN9Z9I=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=nOMxWKt9SIhQEh+ngzA2eCSQLcVcnuGzZYuQ9Duf4Aks0IYk0KFlfosRSF7h+zgEG/ 2gotImNwoN+G45DinQCqDyPyypEZJOKPg39OdAbey/qkNxbNKyNHzGR2N1tsTV0cWEv3 e6CE0NS4Goej76Bo5KnGJrcjCF/w1XP4kDbvo=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
This adds support for both Python 2.6 and 3.0. It seems like 2.x will
be around for some time so we should support both.
Regards,
Doug
Index: Completion/Unix/Command/_python
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_python,v
retrieving revision 1.6
diff -u -r1.6 _python
--- Completion/Unix/Command/_python 16 Jul 2005 11:57:48 -0000 1.6
+++ Completion/Unix/Command/_python 19 Jan 2009 10:06:16 -0000
@@ -1,23 +1,39 @@
#compdef python
-# Python 2.4
+# Python 2.6
+# Python 3.0
local curcontext="$curcontext" state line expl
typeset -A opt_args
-_arguments -C -s -S \
+local -a args
+
+if _pick_variant python3=Python\ 3 python2 --version; then
+ args=(
+ '(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
+ '(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
+ )
+else
+ args=(
+ '-Q+[division options]:division option:(old warn warnall new)'
+ '(-tt)-t[issue warnings about inconsistent tab usage]'
+ '(-t)-tt[issue errors about inconsistent tab usage]'
+ '-3[warn about Python 3.x incompatibilities]'
+ )
+fi
+
+_arguments -C -s -S "$args[@]" \
+ "-B[don't write .py\[co\] files on import]" \
'(1 -)-c+[program passed in as string (terminates option list)]:python command:' \
'-d[debug output from parser]' \
- '-E[ignore environment variables (such as PYTHONPATH)]' \
+ '-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \
'(1 * -)-h[display help information]' \
'-i[inspect interactively after running script]' \
'(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \
- '-O[optimize generated bytecode]' \
+ '-O[optimize generated bytecode slightly]' \
'-OO[remove doc-strings in addition to the -O optimizations]' \
- '-Q+[division options]:division option:(old warn warnall new)' \
+ "-s[don't add user site directory to sys.path]" \
"-S[don't imply 'import site' on initialization]" \
- '-t[issue warnings about inconsistent tab usage]' \
- '-tt[issue errors about inconsistent tab usage]' \
'-u[unbuffered binary stdout and stderr]' \
'-v[verbose (trace import statements)]' \
'(1 * -)-V[display version information]' \
Messages sorted by:
Reverse Date,
Date,
Thread,
Author