Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
vim and gvim: enable both python2 and python3 interpreter
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
marnix
n00b
n00b


Joined: 13 Jan 2004
Posts: 18

PostPosted: Tue Dec 02, 2014 1:44 pm    Post subject: vim and gvim: enable both python2 and python3 interpreter Reply with quote

Hello,

Vim and gvim have support for both a python2 and a python3 interpreter that can be used by typing :py or :py3 respectively. I want to enable both, but as far as I can see, the ebuild of the currently installed version on my system (vim-7.4.273.ebuild) prevents this. I've looked at the ebuild and found this in the src_configure() function:

Code:

if use python ; then
    if [[ ${EPYTHON} == python3* ]] ; then
        myconf+=" --enable-python3interp"
        export vi_cv_path_python3="${PYTHON}"
    else
        myconf+=" --enable-pythoninterp"
        export vi_cv_path_python="${PYTHON}"
    fi
    else
        myconf+=" --disable-pythoninterp --disable-python3interp"
    fi


The ebuild inherits python-single-r1 and the result is that only one of --enable-pythoninterp or --enable-python3interp gets selected, depending on the PYTHON_SINGLE_TARGET variable, even if PYTHON_TARGETS has both a python2 and python3 version enabled. I've created a modified version of the ebuild that inherits python-r1 instead of python-single-r1 and uses the following to replace the above snippet:

Code:

if use python ; then
    if [[ ${PYTHON_TARGETS} == *python3* ]] ; then
        myconf+=" --enable-python3interp"
        export vi_cv_path_python3="${PYTHON}"
    fi
    if [[ ${PYTHON_TARGETS} == *python2* ]] ; then
        myconf+=" --enable-pythoninterp
        export vi_cv_path_python="${PYTHON}"
    fi
    else
        myconf+=" --disable-pythoninterp --disable-python3interp"
fi


I did a similar change to the ebuild script of gvim (gvim-7.4.273). Both build and work as expected after this change and I can use both the python2 and python3 interpreter in vim. Since I'm not a very experienced ebuild writer I wanted to ask whether this is a sane approach or whether I am misusing the PYTHON_TARGETS variable here before filing a bug report? Also, I could not infer from the original ebuild script why python-single-r1 was chosen instead of python-r1 in this case, since as far as I can tell it is only used to enable one of these two configure flags. Any advice or insights on this are appreciated!
Back to top
View user's profile Send private message
azp
Guru
Guru


Joined: 16 Nov 2003
Posts: 456
Location: Sweden

PostPosted: Tue Jan 20, 2015 11:41 pm    Post subject: Reply with quote

This is an interesting question, especially since I have issues with my python flags for (G)Vim. For what is probably the reason you mention in your post, I only get Python 3 support, and no ordinary "python" support.

I definitely think this is a bug since it has been working before... I have this as my build flags for Gvim:

Code:
root@skare$ emerge -pqv vim
[ebuild   R   ] app-editors/vim-7.4.560  USE="X acl gpm nls perl python vim-pager -cscope -debug -lua -luajit -minimal -racket -ruby (-selinux) -tcl" PYTHON_SINGLE_TARGET="python2_7 -python3_3 -python3_4" PYTHON_TARGETS="python2_7 python3_3 python3_4"
root@skare$ emerge -pqv gvim
[ebuild   R   ] app-editors/gvim-7.4.560  USE="acl gnome gtk netbeans nls perl python session (-aqua) -cscope -debug -lua -luajit -motif -neXt -racket -ruby (-selinux) -tcl" PYTHON_SINGLE_TARGET="python3_3 -python2_7 -python3_4" PYTHON_TARGETS="python2_7 python3_3 -python3_4"


but when checking :version in GVim this is what I have:

Code:
-python
+python3

_________________
Weeks of coding can save you hours of planning.
Back to top
View user's profile Send private message
marnix
n00b
n00b


Joined: 13 Jan 2004
Posts: 18

PostPosted: Sat Jan 24, 2015 9:49 pm    Post subject: bugreport Reply with quote

I've filed a bugreport here: https://bugs.gentoo.org/show_bug.cgi?id=537606
Back to top
View user's profile Send private message
azp
Guru
Guru


Joined: 16 Nov 2003
Posts: 456
Location: Sweden

PostPosted: Tue Feb 03, 2015 8:41 pm    Post subject: Re: bugreport Reply with quote

marnix wrote:
I've filed a bugreport here: https://bugs.gentoo.org/show_bug.cgi?id=537606


Oh, I had already reported one, forgot to mention that =)
_________________
Weeks of coding can save you hours of planning.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum