Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Feb 2018 22:59:59 +0100
From:      Roland Smith <rsmith@xs4all.nl>
To:        Gerhard Schmidt <schmidt@ze.tum.de>
Cc:        Gerhard Schmidt <estartu@ze.tum.de>, FreeBSD Python <freebsd-python@freebsd.org>
Subject:   Re: Installing a port to a specific python version
Message-ID:  <20180201215959.GB56934@slackbox.erewhon.home>
In-Reply-To: <799f50a9-4cb5-7e71-a3fb-bb030d80d864@ze.tum.de>
References:  <6825a87e-60ec-f3bd-3368-2a6a519667bb@ze.tum.de> <20180201151021.GA52705@slackbox.erewhon.home> <799f50a9-4cb5-7e71-a3fb-bb030d80d864@ze.tum.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 01, 2018 at 04:54:24PM +0100, Gerhard Schmidt wrote:
> Am 01.02.2018 um 16:10 schrieb Roland Smith:
> > On Wed, Jan 31, 2018 at 08:00:55AM +0100, Gerhard Schmidt wrote:
> >> Hi
> >>
> >> I'm having a small problem with python and FreeBSD. I'm a python
> >> developer. I Maintain some legacy code written in python2.7 and some new
> >> projects in Python 3.6 and for testing purposes i need python 3.4 and
> >> 3.5. So I need all this versions of python on my system, at least to be
> >> able to create virtual envs.
> >>
> >> Installing the python interpreters is not a problem, but installing
> >> python packages.
> >>
> >> How can in say a port it shouldn't use the default version stated in
> >> make.conf but a specific version. I don't want to change the default
> >> version every time i install a Port.
> >>
> >> I've tried to set PYTHON_VERSION as environment variable.
> >> I've tried to give PYTHON_VERSION as parameter to make.
> >> I've tried to give PYTHON as parameter to make.
> >> I've tried python3.5 python35 3.5 and 35 with each of them, it still
> >> installed the default python version.
> >>
> >> Then i tried make PYTHON_DEFAULT=3.5 and get a error message.
> > 
> > Python ports work with "flavors" now. See the entries for 20171130 in
> > /usr/ports/UPDATING.
> > 
> > Use it like this::
> > 
> >     cd /usr/ports/<foo>
> >     make FLAVOR=py36 install clean
> > 
> > If you always want a specific version of a port, you can put the following in
> > /etc/make.conf::
> > 
> >     .if ${.CURDIR:M*/devel/ipython}
> >     FLAVOR=py36
> >     .endif
> > 
> > If you always want to build ports for all supported versions of Python, use
> > the following in /etc/make.conf::
> > 
> >     BUILD_ALL_PYTHON_FLAVORS=true
> > 
> > You *might* be able to restrict that to a specific package, like this::
> > 
> >     .if ${.CURDIR:M*/www/py-requests}
> >     BUILD_ALL_PYTHON_FLAVORS=true
> >     .endif
> > 
> > According to the docs, `pkg` supports flavors. But I can't find anything in
> > the manpage.
> 
> portupgrade seams not to support this right now.

According to "/usr/ports/UPDATING":

  Flavors are already supported by make, pkg, poudriere, and synth; see the
  manpages for those tools for usage instructions. Portmaster and portupgrade
  don't support flavors yet, but community work on those tools is in progress.

(With the recent updates, portmaster works fine for me with flavors now.)

> pkg displays it. But
> pkg has it's own set of problems renders it practical impossible to use.
<snip>
> 
> seams i have to do the updating of any python package by hand. Not much
> fun with 200+ FreeBSD Systems with differing python installations.

Try using portmaster. It works for me as of 3.18 (current is 3.19_4).

> Whould anybody be so kind to explain to me why this has to be changed.
> Loved working with FreeBSD and python for the last 15 Years. Never had
> any issues with the PYTHON_VERSION approach. And portupgrade did work
> with updating python3.6 packages while python2.7 was default.

Flavors are a way to have multiple variations of a port. (Chapter 7 porters
handbook.)

If you look at pkg.freebsd.org you'll see that e.g. python packages are now
built for each supported version of python. So you can now do things like::

    # pkg install py36-aniso8601

and that will find and install the python 3.6 version of the package even
though the default python is still 2.7. This is a huge win, IMHO.


Roland
-- 
R.F.Smith                                   http://rsmith.home.xs4all.nl/
[plain text email much appreciated]



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