Monday, April 3, 2017

Re: How to make vim embed my own custom version of python ?

On Mon, Apr 3, 2017 at 2:13 PM, Jacky Liu <bluegene8210@gmail.com> wrote:
> On Monday, April 3, 2017 at 11:11:27 AM UTC+8, Tony Mechelynck wrote:
>> Configure has a lot, but really a lot, of possible arguments. To see
>> them all, use
>>
>> src/auto/configure --help |less
>>
>> For your usecase, I think the following might perhaps be relevant (but
>> you might want to read it all):
>>
>> --enable-pythoninterp=OPTS Include Python interpreter. default=no
>> OPTS=no/yes/dynamic
>> --enable-python3interp=OPTS Include Python3 interpreter.
>> default=no OPTS=no/yes/dynamic
>>
>> --with-plthome=PLTHOME Use PLTHOME.
>> --with-python-config-dir=PATH Python's config directory
>> --with-python3-config-dir=PATH Python's config directory
>>
>> Also, --disable-blablabla is equivalent to --enable-blablabla=no and
>> --without-blablabla is equivalent to --with-blablabla=no for any value
>> of blablabla.
>>
>> In any case, I recommend not to edit the makefile, and not to invoke
>> configure directly yourself with arguments on the command-line, but
>> instead to set the configure arguments by means of environments
>> variables set by sourcing a script, so you can be sure to use the
>> right arguments every time.
>>
>> For details, see the last two links above the bottom line of
>> http://users.skynet.be/antoine.mechelynck/vim/
>>
>> Best regards,
>> Tony.
>>
>
>
> You were right about using environment variables instead of arguments. After carefully checking /src/auto/configure I added this line to my script:
>
> export vi_cv_path_python3=/home/mydir/.local/bin/python3.6
>
> and it worked, vim found the specified version of Python.
>
> Thank you !
>
>
I meant setting configure arguments as environment variables to make,
but since it works for you, so much the better.

This is the script I source (running it isn't enough) when opening the
terminal where I'll be compiling Vim (and I may then compile it
repeatedly as new patches arrive, without sourcing the script again:

#!/bin/bash
export CONF_OPT_GUI='--enable-gui=gtk3 --enable-gnome-check'
export CONF_OPT_PERL='--enable-perlinterp'
export CONF_OPT_PYTHON='--enable-pythoninterp'
export CONF_OPT_PYTHON3='--disable-python3interp'
export CONF_OPT_TCL='--enable-tclinterp'
# /usr/bin/tclsh (softlink) is correctly set
export CONF_OPT_RUBY='--enable-rubyinterp'
export CONF_OPT_LUA='--enable-luainterp'
export CONF_OPT_MZSCHEME='--disable-mzschemeinterp'
#export CONF_OPT_PLTHOME='--with-plthome=/usr/local/plt'
export CONF_OPT_CSCOPE='--enable-cscope'
export CONF_OPT_MULTIBYTE='--enable-multibyte'
export CONF_OPT_FEAT='--with-features=huge'
export CONF_OPT_COMPBY='"--with-compiledby=antoine.mechelynck@gmail.com"'

The shebang line is probably unneeded, since this script must be
"sourced" by the instance of bash which will be running make, not
"run" as a program (which would get its own environment, forgotten on
return).

And I repeat, I never invoke configure on the command-line but only
through make: "make config" or "make reconfig", and sometimes just
plain "make" decides that it needs to run configure anyway. In all
these cases, especially the latter one, the correct configure
arguments are set.

If there is a command-line configure argument for the Python path
(--with-python3-config-dir maybe? On my system, python3-config is a
Python script which, just like the Python3 interpreter, lives in
/usr/bin) you could have added it space-separated inside the value for
CONF_OPT_PYTHON3, something like

export CONF_OPT_PYTHON3='--enable-python3interp
--with-python3-config-dir=/home/jackyliu/.local/dir'

If you haven't changed python-config, and haven't copied it or linked
it in your patched Python interpreter's directory, then I suppose your
hack of setting $vi_cv_path_python3 is the least bad solution.

Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment