Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Feb 2014 16:55:00 +0100
From:      Marcus von Appen <mva@freebsd.org>
To:        freebsd-ports@freebsd.org
Subject:   Re: What should be in scripts shebangs for python2?
Message-ID:  <20140219165500.Horde.vg_cyo2bAuxp6Rlju1rQeQ1@webmail.df.eu>
In-Reply-To: <254945186.20140219190201@serebryakov.spb.ru>
References:  <254945186.20140219190201@serebryakov.spb.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

Lev Serebryakov <lev@freebsd.org>:

> Hello, Freebsd-ports.
>
>  My port uses some pythons scripts to configure (it is not pythonn-related
> by itself, only authors of this software use python scripts on build
> stage).
>
>  How should I patch these scripts to work? It looks like
> /usr/local/bin/python2 is installed by devel/python2 port, and
> USE_PYTHON_BUILD=yes doesn't depends on this port, but on python27, which

USE_PYTHON_BUILD=yes indicates that the port supports any python  
version, no matter,
if the user chooses python2.X or python3.x as the default for the system.

If your port is compatible with any python version and only uses  
python for configuring
some bits, but does *not* need python at run-time, you should patch  
the scripts to
use ${PYTHON_CMD},  via a ${REINPLACE_CMD} or the proper python_CMD=  
${PYTHON_CMD} command
for the shebang USES.

If your port is only compatible for a specific branch (either 2.x OR  
3.x), use the proper
major number for USE_PYTHON_BUILD, e.g. USE_PYTHON_BUILD=2. If the  
port is only compatible
with a specific release (e.g. 3.2), use USE_PYTHON_BUILD=X.Y. For  
those cases, you also can
rely on ${PYTHON_CMD}, which points to whatever is the most  
appropriate version.

In short:
* Use ${PYTHON_CMD} to replace the shebang lines or references of the  
python command
* Use the proper supported python version (yes for any, 2 or 3 for a  
branch, X.Y for a release)
   for USE_PYTHON_BUILD

> could be changed in future or by users's request, so I don't want to
> hardcode /usr/local/bin/python2.7, too...

Indeed, do not do this.

Cheers
Marcus




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