FS#34397 - [gvim] has --disable-python3interp

Attached to Project: Arch Linux
Opened by Ignas Anikevicius (Liuuutas) - Thursday, 21 March 2013, 15:56 GMT
Last edited by Thomas Dziedzic (tomd123) - Tuesday, 27 May 2014, 13:44 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Thomas Dziedzic (tomd123)
Architecture All
Severity Very Low
Priority Low
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 4
Private No

Details

Hello, I was wondering if there is any particular reason to have it disabled?

I found the disabled flag at /var/abs/extra/vim/PKGBUILD.

Thanks.
This task depends upon

Closed by  Thomas Dziedzic (tomd123)
Tuesday, 27 May 2014, 13:44 GMT
Reason for closing:  Implemented
Additional comments about closing:  added a python3 version to extra
Comment by Eric Belanger (Snowman) - Thursday, 21 March 2013, 18:17 GMT
python 2 and python 3 support can't be enabled at same time.
Comment by Thomas Dziedzic (tomd123) - Tuesday, 26 March 2013, 06:52 GMT
There was a previous thread on this here: https://bbs.archlinux.org/viewtopic.php?id=133900

But since I'm assuming things have not changed since the last time this was looked at, especially since https://aur.archlinux.org/packages.php?ID=61870 (gvim-python) disables py2 and enables py3 support I think I will close this as wont implement soon.
Comment by Eric Belanger (Snowman) - Tuesday, 26 March 2013, 13:47 GMT
See  FS#27527  for the details. You could always check it it has changed. If not, you could bring it upstream.
Comment by Thomas Dziedzic (tomd123) - Wednesday, 27 March 2013, 04:56 GMT
Yup, I'm still getting the error when I enable both py2 and py3 support:

:python import glib

Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/glib/__init__.py", line 22, in <module>
from glib._glib import *
ImportError: /usr/lib/libpyglib-2.0-python2.so.0: undefined symbol: _Py_ZeroStruct
Comment by Thomas Dziedzic (tomd123) - Wednesday, 27 March 2013, 05:15 GMT
I honestly don't know what the best action is to take here.

1) I could just close this bug report like the one from 2011, but then if I do, this "feature" will be opened up again in 2 years.

2) I could open up a bug report with vim, but heftig's reason for why it is failing makes it sound like this really isn't something vim can fix:
"Looks like building both python2 and python3 support into vim causes it to load the interpreter via dlopen() and RTLD_LOCAL, as they contain conflicting symbols. Since the symbols are not globally available, loading extensions not explicitly linked to the right libpython will fail."

3) As a result of the previous number, we could enable both py2 and py3 support, and open up upstream bug reports with each of the libraries that encounter this issue with vim.
Comment by Eric Belanger (Snowman) - Wednesday, 27 March 2013, 05:52 GMT
There's also:
4) Enable py3 support but disable py2 support.
Comment by Ignas Anikevicius (Liuuutas) - Wednesday, 27 March 2013, 14:37 GMT
Also, I found that the support can be dynamic.

--enable-pythoninterp=OPTS Include Python interpreter. default=no OPTS=no/yes/dynamic
--enable-python3interp=OPTS Include Python3 interpreter. default=no OPTS=no/yes/dynamic

from ./configure -h.

We could have:

--enable-pythoninterp=dynamic
--enable-python3interp=dynamic

As far as I understand, python2 and python3 can not be used both at the same time then. Thogh, I did not dig deep enough to see how to switch from one to another interpreter.
Comment by Thomas Dziedzic (tomd123) - Wednesday, 27 March 2013, 15:18 GMT
@Eric
true, we could do that, but it would require some research into the current state of vim python plugins migration. Making sure that all or the majority of the most popular plugins have a python3 version available.

@Ignas
seems interesting and if that would not cause any problems while still being able to choose between py2 and py3 versions, then it may remove the need for branched vim packages on the aur like vim-python
I found some interesting documentation in http://vimdoc.sourceforge.net/htmldoc/if_pyth.html#python3

more specifically the last section:
"Here Vim's behavior depends on the system in which it was configured. In a
system where both versions of Python were configured with --enable-shared,
both versions of Python will be activated at the same time. There will still
be problems with other third party libraries that were not linked to
libPython.

To work around such problems there are these options:
1. The problematic library is recompiled to link to the according
libpython.so.
2. Vim is recompiled for only one Python version.
3. You undefine PY_NO_RTLD_GLOBAL in auto/config.h after configuration. This
may crash Vim though."

Edit, Oh ya, also the vim doc states that if both py2 and py3 are enabled, then they are compiled with the dynamic flag already.
So Ignas, your solution is the one that we've been using all along :P, relevant quote "4. Python 2 and 3 support (+python/dyn, +python3/dyn)"
Comment by Thomas Dziedzic (tomd123) - Wednesday, 29 May 2013, 02:42 GMT
I think enabling both pythons isn't ideal because it causes issues.
And I have investigated which distros are using --enable-python3interp and none do afaik, including debian and fedora.

I will keep this bug report open in the hopes that either someone else or I will have time to investigate the top (20 to 50) python plugins for vim and see if there is a large majority (80% to 90%) of python3 compatible plugins.
If the majority are, then I might consider enabling strictly python3 in vim in [testing].
Otherwise this feature request might have to wait until more plugins get on board.

Feel free to do the investigation if you wish :) Otherwise I will put this on the wayyy bottom of my todo list.
Also, the numbers above are just example numbers that I pulled out of thin air.
They are just guides not, rules.
Comment by lilydjwg (lilydjwg) - Saturday, 15 February 2014, 15:45 GMT
Hi there,

I compile Vim myself, with both Python versions enabled and usable at the same time. The only problem I get on Arch is, as Thomas quoted, importing third party libraries that were not linked to libpython will crash. A few packages in the repo doesn't do this, e.g. python2-xapian. There aren't too much (especially when compared to Ubuntu). If all these packages are found and rebuilt, Vim with both +python/dyn and +python3/dyn can be used without problems. Plugins with both Python supports will choose one at its liking, and those only supports Python 2 will continue to work as before.
Comment by Thomas Dziedzic (tomd123) - Saturday, 24 May 2014, 15:13 GMT
There is now a package for vim with python3 support named gvim-python3 in testing. You should be able to cherry pick this package safely from testing, with vim-runtime of course. Please test and let me know if you find any issues.
Comment by Thomas Dziedzic (tomd123) - Tuesday, 27 May 2014, 13:44 GMT
moved gvim-python3 to [extra], closing ticket:

https://www.archlinux.org/packages/extra/x86_64/gvim-python3/

Loading...