Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Mar 2016 10:38:15 +1030
From:      Shane Ambler <FreeBSD@ShaneWare.Biz>
To:        Miroslav Lachman <000.fbsd@quip.cz>, ports@FreeBSD.org
Subject:   Re: Multiple versions of Python packages (2.7 vs 3.4)
Message-ID:  <56E9F56F.2080706@ShaneWare.Biz>
In-Reply-To: <56E95B02.8030502@quip.cz>
References:  <56E95B02.8030502@quip.cz>

next in thread | previous in thread | raw e-mail | index | archive | help
On 16/03/2016 23:39, Miroslav Lachman wrote:
> I checked that most files are installed in versioned subdirectory, for
> example python2.7/site-packages, some tools have versioned binaries like
> /usr/local/bin/pip-2.7 but they have also symlink /usr/local/bin/pip.
> Are there any way to create / install those packages without creating
> this symlink?
> If I didn't miss something the symlinks are the only common files for
> both versions so it will be overwritten by the later installation or
> upgrade. Or not?

This is an automated step to allow the python ports to be installed for
more than one python version at the same time. The scripts in
/usr/local/bin being one of the places that a conflict can happen. Docs
and licenses are other paths that can conflict, these other dir names
are altered to match the python version. eg share/licenses/py-pip will
get changed to share/licenses/py27-pip

In the Makefile of the port USE_PYTHON=concurrent enables this feature,
if a port conflicts with multiple python versions then concurrent needs
to be added (or sometimes other adjustments). If you remove concurrent
then the symlinks in bin won't be made.

I don't think there is a way to control this with environment variables
so you would have to alter the ports Makefile and build yourself if you
want it to work differently.

The reason for the symlink is to allow the expected pip script to exist
in bin while preventing multiple python versions conflicting, the pkg
installed for the default version of python will own the bin/pip which
will symlink to it's install of bin/pip-${PYTHON_VER} - pkgs installed
for other versions of python will only install bin/pip-${PYTHON_VER}

So if python 2.7 is the default version, py27-pip will install bin/pip
and bin/pip-2.7 while py34-pip will only install bin/pip-3.4
If you run pip you will get the default py27 version but if you want to
run it for py34 then you need to specifically run pip-3.4

You can alter the default python version by adding to /etc/make.conf

DEFAULT_VERSIONS= python=2.7 python2=2.7 python3=3.4

And if your wondering how to build multiple versions -

cd /usr/ports/devel/py-pip
make PYTHON_VERSION=3.4 install clean

-- 
FreeBSD - the place to B...Software Developing

Shane Ambler




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56E9F56F.2080706>