views:

669

answers:

2

Hi,

I hope this is the right place to ask this question:

I am trying to compile gVim with python 3 support using cygwin under windows:

I changed the Make_cyg.mak files Python section to the following:

##############################
# DYNAMIC_PYTHON=yes works.
# DYNAMIC_PYTHON=no does not (unresolved externals on link).
##############################
ifdef PYTHON
DEFINES += -DFEAT_PYTHON
INCLUDES += -I$(PYTHON)/include
EXTRA_OBJS += $(OUTDIR)/if_python.o

ifndef DYNAMIC_PYTHON
DYNAMIC_PYTHON = yes
endif

ifndef PYTHON_VER
PYTHON_VER = 30
endif

ifeq (yes, $(DYNAMIC_PYTHON))
DEFINES += -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
else
EXTRA_LIBS += $(PYTHON)/libs/python$(PYTHON_VER).lib
endif
endif

However when running:

$ make -f Make_cyg.mak OLE=Yes PYTHON=/cygdrive/p/Applications/PortablePython_1.1_py3.0.1/App/ RUBY=/cygdrive/c/Programme/Ruby/

this results in the following errors:

In file included from /cygdrive/p/Applications/PortablePython_1.1_py3.0.1/App//i
nclude/Python.h:70,
                 from if_python.c:43:
/cygdrive/p/Applications/PortablePython_1.1_py3.0.1/App//include/bytesobject.h:1
04:1: warning: "F_BLANK" redefined
In file included from globals.h:1554,
                 from vim.h:1831,
                 from if_python.c:20:
farsi.h:74:1: warning: this is the location of the previous definition
if_python.c:729: warning: initialization makes integer from pointer without a ca
st
if_python.c:733: warning: initialization from incompatible pointer type
if_python.c:734: warning: initialization from incompatible pointer type
if_python.c:735: warning: initialization from incompatible pointer type
if_python.c:737: error: `cmpfunc' undeclared here (not in a function)
if_python.c:737: error: initializer element is not constant
if_python.c:737: error: (near initialization for `OutputType.tp_repr')
if_python.c:737: error: parse error before numeric constant
/** more errors **/
if_python.c:2256: warning: initialization from incompatible pointer type
if_python.c:2257: warning: initialization from incompatible pointer type
if_python.c: In function `PythonMod_Init':
if_python.c:2351: error: structure has no member named `ob_type'
if_python.c:2352: error: structure has no member named `ob_type'
if_python.c:2353: error: structure has no member named `ob_type'
if_python.c:2354: error: structure has no member named `ob_type'
if_python.c:2355: error: structure has no member named `ob_type'
if_python.c:2356: error: structure has no member named `ob_type'
make: *** [gobj/if_python.o] Error 1

I am using a portable python install from Portable Python. I don't know if that may be the source of the error.

I am hoping someone knows how to compile vim with python 3 support (if I only compile it with ruby support it compiles nicely).

Thanks in advance,

Gjallar

+1  A: 

There is a lot of things going on at once here. First of all, why do you want Python 3.0? If you really want Python 3, then you should use Python 3.1.

Second of all, what does "Python 3 support" mean in the case of gVim? Is it to make extensions with Python? Then you don't want Python 3 support, as any extension that exists for gVim is going to be written for Python 2.

And yeah, it seems very strange to use portable python. Since you are compiling gVim with cygwin, you should reasonably use a Python compiled with the same Cygwin.

Doesn't the normal gvim for Windows have Python support?

Lennart Regebro
Hi, I try to compile it with Portable Python as I want to use the resulting exe with my portable gVim too. You need to compile vim with PYTHON and RUBY set to gain access to the autocompletion features of those languages. (I think so at least - I am new to vim)In case of compiling vim with just RUBY it is working nicely with new vim autocompletion feature. As I wanted to learn Python 3 I thaught it would be nice to be able to use vim with my portable python 3 (which does not exist for Python 3.1 currently).Hope this information helps and thanks for taking the time to help me.- Gjallar
Gjallar
I don't think what version of python you compile it with will make a difference for the autocompletion feature. I don't know how the autocompletion feature in vim works, but Python 3 support is most likely completely independent from what version of Python you have compiled it with. The autocompletion feature isn't a part of Python, but of vim.
Lennart Regebro
@Gjallar: Also, you definitely want to use Python 3.1. In short, I don't see a reason why you would not just use the standard version of vim compiled for Windows. You are most likely trying to fix the wrong problem.
Lennart Regebro
A: 

I have compiled vim with python3 support. Here is the Patch updated for vim 7.2.411.

For compilation instruction check out my 2009 September 22 mail on

groups.google.com/group/vim_dev/browse_frm/month/2009-09

(adding a second hyperlink didn't work)

Roland Puntaier