7.4. USES=python and Flavors

When using USES=python and USE_PYTHON=distutils, the port will automatically have FLAVORS filled in with the Python versions it supports.

Example 7.7. Simple USES=python

Supposing the current Python supported versions are 2.7, 3.4, 3.5, and 3.6, and the default Python 2 and 3 versions are 2.7 and 3.6, a port with:

USES=	python
USE_PYTHON=	distutils

Will get these flavors: py27, and py36.

USES=	python
USE_PYTHON=	distutils allflavors

Will get these flavors: py27, py34, py35 and py36.


Example 7.8. USES=python with Version Requirements

Supposing the current Python supported versions are 2.7, 3.4, 3.5, and 3.6, and the default Python 2 and 3 versions are 2.7 and 3.6, a port with:

USES=	python:-3.5
USE_PYTHON=	distutils

Will get this flavor: py27.

USES=	python:-3.5
USE_PYTHON=	distutils allflavors

Will get these flavors: py27, py34, and py35.

USES=	python:3.4+
USE_PYTHON=	distutils

Will get this flavor: py36.

USES=	python:3.4+
USE_PYTHON=	distutils allflavors

Will get these flavors: py34, py35, and py36.


PY_FLAVOR will be available to depend on the correct version of Python modules. This is most useful for ports that are not Python modules and do not have Python flavors but do use python for some part of their operations.

Example 7.9. For a Port Not Using distutils

If the default Python 3 version is 3.6, the following will set PY_FLAVOR to py36:

RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}mutagen>0:audio/py-mutagen@${PY_FLAVOR}

USES=	python:3.5+

All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.