Bug#729924: vim: Add Python 3 support

Bernard Pratz bernard at pratz.net
Tue Nov 25 10:27:56 UTC 2014


Just for the note, I've stumbled upon this bug report, and thought it
might be useful to tell that as I'm running wheezy and I needed a more
recent version of vim, I recompiled it and enabled both python3 and
python2:

--------8<----------------8<----------------8<---------------8<--------
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 11 2014 21:41:52)
Included patches: 1-488
Modified by pkg-vim-maintainers at lists.alioth.debian.org
Compiled by guyzmo at BuGz.eclipse.m0g.net
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     +tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python/dyn      +viminfo
+cscope          +lispindent      +python3/dyn     +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    +xpm
[…]
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread
-I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include
-I/usr/include/atk-1.0 -I/usr/include/cairo
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0
-I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libpng12     -g -O2 -fPIE
-fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
-I/usr/include/tcl8.5  -D_REENTRANT=1  -D_THREAD_SAFE=1
-D_LARGEFILE64_SOURCE=1  
Linking: gcc   -L. -Wl,-z,relro -rdynamic -Wl,-export-dynamic -Wl,-E
-fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim
-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0
-lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype
-lfontconfig -lgobject-2.0 -lglib-2.0   -lSM -lICE -lXpm -lXt -lX11
-lXdmcp -lSM -lICE  -lm -ltinfo -lelf -lnsl  -lselinux   -lacl -lattr
-lgpm  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector -L/usr/local/lib
-L/usr/lib/perl/5.14/CORE -lperl -ldl -lm -lpthread -lcrypt   -L/usr/lib
-ltcl8.5 -ldl -lpthread -lieee -lm -lruby-1.9.1 -lpthread -lrt -ldl
-lcrypt -lm  -L/usr/lib   
-------->8---------------->8---------------->8--------------->8--------

I did not run into any issue so far, though when I try to run both
python 2 and python 3 from ex command line:

--------8<----------------8<----------------8<---------------8<--------
:py import sys;print(sys.version)
2.7.3 (default, Mar 13 2014, 11:26:58) 
[GCC 4.7.2]
:py3 import sys;print(sys.version)
E837: This Vim cannot execute :py3 after using :python
E263: Sorry, this command is disabled, the Python library could not be
loaded.
-------->8---------------->8---------------->8--------------->8--------

Which is a nice explicit error! I'm also in favour of switching to
python3 which is mature enough and should replace python2 everywhere it
can.

So I do believe the dual compilation option is the best option, as you
leave it to the user to make sure his whole configuration is being run
using one or the other. But to promote transition to py3, the software
package needs to be able to load py3 components!

Cheers,

-- 
Bernard Pratz



More information about the pkg-vim-maintainers mailing list