2014-08-09 17:44:27 +02:00
# $FreeBSD$
#
# Provide support for Python related ports. This includes detecting Python
# interpreters, ports providing package and modules for python as well as
# consumer ports requiring Python at build or run time.
#
# Feature: python
# Usage: USES=python or USES=python:args
2018-01-25 13:36:54 +01:00
# Valid ARGS: <version>, patch, build, run, test
2014-08-09 17:44:27 +02:00
#
# version If your port requires only some set of Python versions, you
# can set this to [min]-[max] or min+ or -max or as an
2019-07-03 08:35:48 +02:00
# explicit version (eg. 3.5-3.6 for [min]-[max], 2.7+ or -3.6
2018-02-26 20:33:21 +01:00
# for min+ and -max, 2.7 for an explicit version). Example:
2014-08-09 17:44:27 +02:00
#
# USES=python:2.7 # Only use Python 2.7
2019-07-03 08:35:48 +02:00
# USES=python:3.5+ # Use Python 3.5 or newer
# USES=python:3.5-3.6 # Use Python 3.5 or 3.6
# USES=python:-3.6 # Use any Python up to 3.6
2014-08-09 17:44:27 +02:00
# USES=python # Use the set default Python
# # version
#
2018-01-25 13:36:54 +01:00
# patch Indicates that Python is needed at patch time and adds
# it to PATCH_DEPENDS.
2014-08-09 17:44:27 +02:00
# build Indicates that Python is needed at build time and adds
2016-01-02 16:24:37 +01:00
# it to BUILD_DEPENDS.
2014-08-09 17:44:27 +02:00
# run Indicates that Python is needed at run time and adds
2016-01-02 16:24:37 +01:00
# it to RUN_DEPENDS.
# test Indicates that Python is needed at test time and adds
# it to TEST_DEPENDS.
2017-12-04 16:27:29 +01:00
# env Indicates that the port does not require a dependency on Python
# itself but needs the environment set up. This is mainly used
# when depending on flavored python ports, or when a correct
# PYTHON_CMD is required. It has the same effect than setting
# PYTHON_NO_DEPENDS.
2014-08-09 17:44:27 +02:00
#
2016-01-02 16:24:37 +01:00
# If build, run and test are omitted, Python will be added as BUILD_DEPENDS,
2018-01-25 13:36:54 +01:00
# RUN_DEPENDS and TEST_DEPENDS.
# patch is independant, it does not prevent the default build/run/test
# dependency.
# env or PYTHON_NO_DEPENDS can be set to not add any dependencies.
2014-08-09 17:44:27 +02:00
#
2019-01-16 16:13:51 +01:00
# Exported variables:
2014-08-09 17:44:27 +02:00
#
# PYTHON_VERSION - The chosen Python interpreter including the version,
2019-07-03 08:35:48 +02:00
# e.g. python2.7, python3.5, etc.
2014-08-09 17:44:27 +02:00
#
# Variables, which can be set by the port:
#
2014-08-14 19:04:30 +02:00
# USE_PYTHON - A list of additional features and functionality to
2014-08-09 17:44:27 +02:00
# enable. Supported features are:
#
# concurrent - Indicates that the port can be installed for
# different python versions at the same time. The port
# is supposed to use a unique prefix for certain
# directories using USES=uniquefiles:dirs (see the
# uniquefiles.mk Uses for details about the
# directories), if set to yes. Binaries receive an
# additional suffix, based on ${PYTHON_VER}.
#
# The values for the uniquefiles USES are set as
# follows:
#
# UNIQUE_PREFIX= ${PYTHON_PKGNAMEPREFIX}
# UNIQUE_SUFFIX= -${PYTHON_VER}
#
# If the port is installed for the current default
# python version, scripts and binaries in
#
# ${PREFIX}/bin
# ${PREFIX}/sbin
# ${PREFIX}/libexec
#
# are linked from the prefixed version to the
# prefix-less original name, e.g.
# bin/foo-2.7 --> bin/foo.
#
2017-11-30 16:50:30 +01:00
# cython - Depend on lang/cython at build-time.
#
# cython_run - Depend on lang/cython at run-time.
#
# flavors - Force creation of flavors for Python 2 and 3 default
# versions, where applicable.
#
# noflavors - Disable automatic creation of flavors if they would
# otherwise be created and they are not wanted.
#
# allflavors - Generate flavors for all possible versions and not
2018-01-22 20:59:31 +01:00
# simply the default ones. Only to be used for py-*
# ports that are part of the Python distribution, but
# kept as separate ports.
2017-11-30 16:50:30 +01:00
#
# optsuffix - Set PKGNAMESUFFIX to PYTHON_PKGNAMESUFFIX if not the
# default python version.
#
2014-08-09 17:44:27 +02:00
# distutils - Use distutils as do-configure, do-build and
2017-11-30 16:50:30 +01:00
# do-install targets. implies flavors.
2014-08-09 17:44:27 +02:00
#
# autoplist - Automatically generates the packaging list for a
# port that uses distutils when defined.
# requires: distutils
#
# py3kplist - Automatically generates Python 3.x compatible
# __pycache__ entries from a Python 2.x packaging list
# when defined. Use this for ports that do *not* use
# standard Python packaging mechanisms such as
# distutils, and support *both* Python 2.x and 3.x.
2014-08-14 19:04:30 +02:00
# Not needed, if USE_PYTHON=autoplist is set.
2014-08-09 17:44:27 +02:00
#
# pythonprefix - Says that the port installs in ${PYTHONBASE} instead
# of ${PREFIX}.
#
# noegginfo - Skip an egg-info entry from plist, if defined.
#
# PYTHON_CMD - Python's command line file name, including the
# version number (used for dependencies).
# default: ${PYTHONBASE}/bin/${PYTHON_VERSION}
#
# PYSETUP - Name of the setup script used by the distutils
# package.
# default: setup.py
#
# PYDISTUTILS_PKGNAME
# - Internal name in the distutils for egg-info.
# default: ${PORTNAME}
#
# PYDISTUTILS_PKGVERSION
# - Internal version in the distutils for egg-info.
# default: ${PORTVERSION}
#
# PYDISTUTILS_CONFIGURE_TARGET
# - Pass this command to distutils on configure stage.
# default: config
#
# PYDISTUTILS_BUILD_TARGET
# - Pass this command to distutils on build stage.
# default: build
#
# PYDISTUTILS_INSTALL_TARGET
# - Pass this command to distutils on install stage.
# default: install
#
# PYDISTUTILS_CONFIGUREARGS
# - Arguments to config with distutils.
# default: <empty>
#
# PYDISTUTILS_BUILDARGS
# - Arguments to build with distutils.
# default: <empty>
#
# PYDISTUTILS_INSTALLARGS
# - Arguments to install with distutils.
# default: -c -O1 --prefix=${PREFIX} --single-version-externally-managed --root=${STAGEDIR}
#
# PYDISTUTILS_EGGINFO
# - Canonical name for egg-info.
# default: ${PYDISTUTILS_PKGNAME:C/[^A-Za-z0-9.]+/_/g}-${PYDISTUTILS_PKGVERSION:C/[^A-Za-z0-9.]+/_/g}-py${PYTHON_VER}.egg-info
#
# The following variables can be read by ports and must not be modified:
#
# PYTHONBASE - The installation prefix of the chosen Python
# interpreter, e.g. /usr/local
#
# PYTHON_PORTVERSION
# - Version number suitable for ${PORTVERSION}.
#
# PYTHON_PORTSDIR - The port directory of the chosen Python interpreter
#
# PYTHON_REL - The release number of the chosen Python interpreter
2015-05-26 18:47:02 +02:00
# without dots, e.g. 2706, 3401, ...
2014-08-09 17:44:27 +02:00
#
# PYTHON_SUFFIX - The major-minor release number of the chosen Python
2019-07-03 08:35:48 +02:00
# interpreter without dots, e.g. 27, 36, ...
2014-08-09 17:44:27 +02:00
# Used for prefixes and suffixes.
#
# PYTHON_MAJOR_VER - The major release version of the chosen Python
# interpreter, e.g. 2, 3, ...
#
# PYTHON_VER - The major-minor release version of the chosen Python
2019-07-03 08:35:48 +02:00
# interpreter, e.g. 2.7, 3.6, ...
2014-08-09 17:44:27 +02:00
#
# PYTHON_ABIVER - Additional ABI flags set by the chosen Python
# interpreter, e.g. md
#
# PYTHON_INCLUDEDIR - Location of the Python include files.
# default: ${PYTHONBASE}/include/${PYTHON_VERSION}
#
# PYTHON_LIBDIR - Base of the python library tree
# default: ${PYTHONBASE}/lib/${PYTHON_VERSION}
#
# PYTHON_SITELIBDIR - Location of the site-packages tree. Don't change,
# unless you know what you do.
# default: ${PYTHON_LIBDIR}/site-packages
#
# There are PREFIX-clean variants of the PYTHON_*DIR variables above.
# They are meant to be used by ports instead of the above variables, so the
2014-08-14 19:04:30 +02:00
# ports respect ${PREFIX} (unless USE_PYTHON=pythonprefix is specified).
2014-08-09 17:44:27 +02:00
#
# PYTHONPREFIX_INCLUDEDIR default: ${PREFIX}/include/${PYTHON_VERSION}
# PYTHONPREFIX_LIBDIR default: ${PREFIX}/lib/${PYTHON_VERSION}
# PYTHONPREFIX_SITELIBDIR default: ${PYTHONPREFIX_LIBDIR}/site-packages
#
# PYTHON_PLATFORM - Python's idea of the OS release.
# This is faked with ${OPSYS} and ${OSREL} until we
# find out how to delay defining a variable until
# after a certain target has been built.
#
# PYTHON_PKGNAMEPREFIX
# - Use this as a ${PKGNAMEPREFIX} to distinguish
# packages for different Python versions.
# default: py${PYTHON_SUFFIX}-
#
2019-04-27 20:27:43 +02:00
# PYTHON_PKGNAMESUFFIX
# - Use this as a ${PKGNAMESUFFIX} to distinguish
# packages for different Python versions.
# default: -py${PYTHON_SUFFIX}
#
2014-08-09 17:44:27 +02:00
# Using USES=python.mk also will add some useful entries to PLIST_SUB:
#
# PYTHON_INCLUDEDIR=${PYTHONPREFIX_INCLUDEDIR:S;${PREFIX}/;;}
# PYTHON_LIBDIR=${PYTHONPREFIX_LIBDIR:S;${PREFIX}/;;}
# PYTHON_PLATFORM=${PYTHON_PLATFORM}
# PYTHON_SITELIBDIR=${PYTHONPREFIX_SITELIBDIR:S;${PREFIX}/;;}
2017-01-07 22:42:28 +01:00
# PYTHON_SUFFIX=${PYTHON_SUFFIX}
2014-09-25 23:01:57 +02:00
# PYTHON_VER=${PYTHON_VER}
2016-01-02 18:30:28 +01:00
# PYTHON_VERSION=${PYTHON_VERSION}
2014-08-09 17:44:27 +02:00
#
2017-01-07 22:42:28 +01:00
# and PYTHON2 and PYTHON3 will be set according to the Python version:
#
# PYTHON2="" PYTHON3="@comment " for Python 2.x
# PYTHON2="@comment " PYTHON3="" for Python 3.x
2014-08-09 17:44:27 +02:00
#
# PYDISTUTILS_INSTALLNOSINGLE
# - Deprecated without replacement
#
# MAINTAINER: python@FreeBSD.org
. i f ! d e f i n e d ( _ I N C L U D E _ U S E S _ P Y T H O N _ M K )
_INCLUDE_USES_PYTHON_MK = yes
# What Python version and what Python interpreters are currently supported?
2016-04-14 15:34:25 +02:00
# When adding a version, please keep the comment in
# Mk/bsd.default-versions.mk in sync.
2018-12-18 10:19:03 +01:00
_PYTHON_VERSIONS = 2.7 3.6 3.7 3.5 # preferred first
2014-08-09 17:44:27 +02:00
_PYTHON_PORTBRANCH = 2.7 # ${_PYTHON_VERSIONS:[1]}
_PYTHON_BASECMD = ${ LOCALBASE } /bin/python
2016-04-28 14:17:09 +02:00
_PYTHON_RELPORTDIR = lang/python
2014-08-09 17:44:27 +02:00
2019-04-18 15:16:44 +02:00
# List all valid USE_PYTHON features here
_VALID_PYTHON_FEATURES = allflavors autoplist concurrent cython cython_run \
distutils flavors noegginfo noflavors optsuffix \
py3kplist pythonprefix
_INVALID_PYTHON_FEATURES =
. f o r v a r i n $ { U S E _ P Y T H O N }
. if empty(_VALID_PYTHON_FEATURES : M ${var })
_INVALID_PYTHON_FEATURES += ${ var }
. e n d i f
. e n d f o r
. i f ! e m p t y ( _ I N V A L I D _ P Y T H O N _ F E A T U R E S )
IGNORE = uses unknown USE_PYTHON features: ${ _INVALID_PYTHON_FEATURES }
. e n d i f
2014-08-09 17:44:27 +02:00
# Make each individual feature available as _PYTHON_FEATURE_<FEATURENAME>
2014-08-15 22:55:03 +02:00
. f o r v a r i n $ { U S E _ P Y T H O N }
2017-11-30 16:50:30 +01:00
_PYTHON_FEATURE_${var : C /=.*$//:tu }= ${var :C /.*=//:S /, / /g }
2014-08-09 17:44:27 +02:00
. e n d f o r
2017-11-30 16:50:30 +01:00
# distutils automatically generates flavors depending on the supported
# versions.
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ D I S T U T I L S )
_PYTHON_FEATURE_FLAVORS = yes
. e n d i f
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ N O F L A V O R S )
. u n d e f _ P Y T H O N _ F E A T U R E _ F L A V O R S
. e n d i f
2014-08-09 17:44:27 +02:00
# Make sure that no dependency or some other environment variable
# pollutes the build/run dependency detection
. u n d e f _ P Y T H O N _ B U I L D _ D E P
. u n d e f _ P Y T H O N _ R U N _ D E P
2016-01-02 16:24:37 +01:00
. u n d e f _ P Y T H O N _ T E S T _ D E P
2014-08-09 17:44:27 +02:00
_PYTHON_ARGS = ${ python_ARGS : S /,/ /g }
2018-01-25 13:36:54 +01:00
.if ${_PYTHON_ARGS : Mpatch }
_PYTHON_PATCH_DEP = yes
_PYTHON_ARGS := ${ _PYTHON_ARGS : Npatch }
. e n d i f
2014-08-09 17:44:27 +02:00
.if ${_PYTHON_ARGS : Mbuild }
_PYTHON_BUILD_DEP = yes
_PYTHON_ARGS := ${ _PYTHON_ARGS : Nbuild }
. e n d i f
.if ${_PYTHON_ARGS : Mrun }
_PYTHON_RUN_DEP = yes
_PYTHON_ARGS := ${ _PYTHON_ARGS : Nrun }
. e n d i f
2016-01-02 16:24:37 +01:00
.if ${_PYTHON_ARGS : Mtest }
_PYTHON_TEST_DEP = yes
_PYTHON_ARGS := ${ _PYTHON_ARGS : Ntest }
. e n d i f
2017-12-04 16:27:29 +01:00
.if ${_PYTHON_ARGS : Menv }
PYTHON_NO_DEPENDS = yes
_PYTHON_ARGS := ${ _PYTHON_ARGS : Nenv }
. e n d i f
2014-08-09 17:44:27 +02:00
2016-01-02 16:24:37 +01:00
# The port does not specify a build, run or test dependency, assume all are
2014-08-09 17:44:27 +02:00
# required.
2015-05-15 05:54:47 +02:00
. i f ! d e f i n e d ( _ P Y T H O N _ B U I L D _ D E P ) & & ! d e f i n e d ( _ P Y T H O N _ R U N _ D E P ) & & \
2016-01-02 16:24:37 +01:00
!defined( _PYTHON_TEST_DEP) && !defined( PYTHON_NO_DEPENDS)
2014-08-09 17:44:27 +02:00
_PYTHON_BUILD_DEP = yes
_PYTHON_RUN_DEP = yes
2016-01-02 16:24:37 +01:00
_PYTHON_TEST_DEP = yes
2014-08-09 17:44:27 +02:00
. e n d i f
2017-12-04 12:07:04 +01:00
. i f ${PYTHON2_DEFAULT} != ${ PYTHON_DEFAULT } && ${ PYTHON3_DEFAULT } != ${ PYTHON_DEFAULT }
WARNING += "PYTHON_DEFAULT must be a version present in PYTHON2_DEFAULT or PYTHON3_DEFAULT, if you want more Python flavors, set BUILD_ALL_PYTHON_FLAVORS in your make.conf"
. e n d i f
2014-08-09 17:44:27 +02:00
. i f ${_PYTHON_ARGS} = = "2"
2018-02-26 20:33:21 +01:00
DEV_ERROR += "USES=python:2 is no longer supported, use USES=python:2.7"
2014-08-09 17:44:27 +02:00
. e l i f ${_PYTHON_ARGS} = = "3"
2018-12-18 10:19:03 +01:00
DEV_ERROR += "USES=python:3 is no longer supported, use USES=python:3.5+ or an appropriate version range"
2014-08-09 17:44:27 +02:00
. e n d i f # ${_PYTHON_ARGS} == "2"
. i f d e f i n e d ( P Y T H O N _ V E R S I O N )
# A port/user requests a specific python version for its dependencies via
# DEPENDS_ARGS, since it requires the specific python version itself.
# Several things can happen now:
# a) the dependency supports the requested version -> everything's fine
# b) the dependency does not support the requested version
# 1) the dependency works in a way that the different python
# versions do not matter -> everything's fine
# 2) the dependency is likely to break due to the conflict
# nothing's fine
#
# b.2) needs to be resolved. Due to the complexity of how different pieces of
# software are built, we can't solve this automatically. Instead, let's assume
# that maintainers know what they are doing and assume PYTHON_VERSION to be a
# hint. Just warn maintainers, if the versions do not match
# (_PYTHON_VERSION_NONSUPPORTED).
_PYTHON_VERSION := ${ PYTHON_VERSION : S /^python// }
. e l s e
2018-01-21 11:51:29 +01:00
_PYTHON_VERSION := ${ PYTHON_DEFAULT }
2014-08-09 17:44:27 +02:00
. e n d i f # defined(PYTHON_VERSION)
# Validate Python version whether it meets the version restriction.
_PYTHON_VERSION_CHECK := ${ _PYTHON_ARGS : C /^([1-9] \. [0-9]) $/ \1 - \1 / }
_PYTHON_VERSION_MINIMUM_TMP := ${ _PYTHON_VERSION_CHECK : C /([1-9] \. [0-9])[-+].*/ \1 / }
_PYTHON_VERSION_MINIMUM := ${ _PYTHON_VERSION_MINIMUM_TMP : M [1-9].[0-9] }
_PYTHON_VERSION_MAXIMUM_TMP := ${ _PYTHON_VERSION_CHECK : C /.*-([1-9] \. [0-9])/ \1 / }
_PYTHON_VERSION_MAXIMUM := ${ _PYTHON_VERSION_MAXIMUM_TMP : M [1-9].[0-9] }
2019-04-18 15:16:44 +02:00
# At this point we should have no argument left in ${_PYTHON_ARGS}
# except a version spec
_PYTHON_ARGS := ${ _PYTHON_ARGS : N [1-9].[0-9]-[1-9].[0-9] : N [1-9].[0-9] : N [1-9].[0-9]+ : N -[1-9].[0-9] }
. i f ! e m p t y ( _ P Y T H O N _ A R G S )
IGNORE = uses unknown USES = python arguments: ${ _PYTHON_ARGS }
. e n d i f
2014-08-09 17:44:27 +02:00
. u n d e f _ P Y T H O N _ V E R S I O N _ N O N S U P P O R T E D
. i f ! e m p t y ( _ P Y T H O N _ V E R S I O N _ M I N I M U M ) & & ( $ { _ P Y T H O N _ V E R S I O N } < $ { _ P Y T H O N _ V E R S I O N _ M I N I M U M } )
_PYTHON_VERSION_NONSUPPORTED = ${ _PYTHON_VERSION_MINIMUM } at least
. e l i f ! e m p t y ( _ P Y T H O N _ V E R S I O N _ M A X I M U M ) & & ( $ { _ P Y T H O N _ V E R S I O N } > $ { _ P Y T H O N _ V E R S I O N _ M A X I M U M } )
_PYTHON_VERSION_NONSUPPORTED = ${ _PYTHON_VERSION_MAXIMUM } at most
. e n d i f
# If we have an unsupported version of Python, try another.
. i f d e f i n e d ( _ P Y T H O N _ V E R S I O N _ N O N S U P P O R T E D )
2014-08-10 10:48:41 +02:00
. i f d e f i n e d ( P Y T H O N _ V E R S I O N ) | | d e f i n e d ( P Y T H O N _ C M D )
_PV := ${ _PYTHON_VERSION } # preserve the specified python version
2017-06-18 01:26:58 +02:00
IGNORE = needs Python ${ _PYTHON_VERSION_NONSUPPORTED } , but ${ _PV } was specified
2014-08-10 10:48:41 +02:00
. e n d i f # defined(PYTHON_VERSION) || defined(PYTHON_CMD)
2014-08-09 17:44:27 +02:00
. u n d e f _ P Y T H O N _ V E R S I O N
. f o r v e r i n $ { P Y T H O N 2 _ D E F A U L T } $ { P Y T H O N 3 _ D E F A U L T } $ { _ P Y T H O N _ V E R S I O N S }
__VER = ${ ver }
. i f ! d e f i n e d ( _ P Y T H O N _ V E R S I O N ) & & \
!( !empty( _PYTHON_VERSION_MINIMUM) && ( \
${ __VER } < ${ _PYTHON_VERSION_MINIMUM } ) ) && \
!( !empty( _PYTHON_VERSION_MAXIMUM) && ( \
${ __VER } > ${ _PYTHON_VERSION_MAXIMUM } ) )
_PYTHON_VERSION = ${ ver }
. e n d i f
. e n d f o r
. i f ! d e f i n e d ( _ P Y T H O N _ V E R S I O N )
IGNORE = needs an unsupported version of Python
. e n d i f
. e n d i f # defined(_PYTHON_VERSION_NONSUPPORTED)
2017-11-30 16:50:30 +01:00
# Automatically generates FLAVORS if empty
. i f e m p t y ( F L A V O R S ) & & d e f i n e d ( _ P Y T H O N _ F E A T U R E _ F L A V O R S )
. u n d e f _ V A L I D _ P Y T H O N _ V E R S I O N S
. f o r v e r i n $ { P Y T H O N _ D E F A U L T } $ { P Y T H O N 2 _ D E F A U L T } $ { P Y T H O N 3 _ D E F A U L T } $ { _ P Y T H O N _ V E R S I O N S }
__VER = ${ ver }
. i f ! ( ! e m p t y ( _ P Y T H O N _ V E R S I O N _ M I N I M U M ) & & ( \
${ __VER } < ${ _PYTHON_VERSION_MINIMUM } ) ) && \
!( !empty( _PYTHON_VERSION_MAXIMUM) && ( \
${ __VER } > ${ _PYTHON_VERSION_MAXIMUM } ) )
. if empty(_VALID_PYTHON_VERSIONS : M ${ver })
_VALID_PYTHON_VERSIONS += ${ ver }
. e n d i f
. e n d i f
. e n d f o r
# Get all possible flavors depending on version requirements
. i f d e f i n e d ( _ V A L I D _ P Y T H O N _ V E R S I O N S )
_ALL_PYTHON_FLAVORS = ${ _VALID_PYTHON_VERSIONS : S /.// : S /^/py/ }
. e l s e
_ALL_PYTHON_FLAVORS = ${ _PYTHON_VERSIONS : S /.// : S /^/py/ }
. e n d i f
# Decide how many flavors we want. By default, only generate the default
# versions.
. i f d e f i n e d ( B U I L D _ A L L _ P Y T H O N _ F L A V O R S ) | | d e f i n e d ( _ P Y T H O N _ F E A T U R E _ A L L F L A V O R S )
FLAVORS = ${ _ALL_PYTHON_FLAVORS }
. e l s e
2017-12-04 12:07:07 +01:00
. f o r _ v i n $ { P Y T H O N _ D E F A U L T } $ { P Y T H O N 2 _ D E F A U L T } $ { P Y T H O N 3 _ D E F A U L T }
2017-11-30 16:50:30 +01:00
_f = py${ _v : S /.// }
2017-12-04 12:07:07 +01:00
. if ${_ALL_PYTHON_FLAVORS : M ${_f }} && !${FLAVORS :M ${_f }}
2018-02-06 21:49:09 +01:00
. i f ! e m p t y ( F L A V O R S )
2017-12-04 12:07:07 +01:00
FLAVORS := ${ FLAVORS } ${ _f }
2018-02-06 21:49:09 +01:00
. e l s e
FLAVORS := ${ _f }
. e n d i f
2017-11-30 16:50:30 +01:00
. e n d i f
. e n d f o r
. e n d i f
. i f ! e m p t y ( F L A V O R S ) & & e m p t y ( F L A V O R )
FLAVOR = ${ FLAVORS : [1] }
. e n d i f
. e n d i f
2017-12-12 12:40:45 +01:00
.if ${FLAVOR : Mpy [23][0-9]}
2017-11-30 16:50:30 +01:00
_PYTHON_VERSION = ${ FLAVOR : S /py// : C /(.)/ \1 ./ }
. e n d i f
. i f ! e m p t y ( F L A V O R ) & & ${_PYTHON_VERSION} != ${ PYTHON_DEFAULT }
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ O P T S U F F I X )
2017-12-04 12:26:47 +01:00
DEV_WARNING += "USE_PYTHON=optsuffix is deprecated, consider migrating to using unconditional PKGNAMESUFFIX or PKGNAMEPREFIX"
2017-11-30 16:50:30 +01:00
PKGNAMESUFFIX = ${ PYTHON_PKGNAMESUFFIX }
. e n d i f
. e n d i f
# To avoid having dependencies with @ and empty flavor:
2017-12-14 14:48:58 +01:00
# _PYTHON_VERSION is either set by (first that matches):
# - If using Python flavors, from the current Python flavor
2019-07-03 08:35:48 +02:00
# - If using a version restriction (USES=python:3.5+), from the first
2017-12-14 14:48:58 +01:00
# acceptable default Python version.
# - From PYTHON_DEFAULT
PY_FLAVOR = py${ _PYTHON_VERSION : S /.// }
2017-11-30 16:50:30 +01:00
2014-08-09 17:44:27 +02:00
# Pass PYTHON_VERSION down the dependency chain. This ensures that
# port A -> B -> C all will use the same python version and do not
# try to find a different one, if the passed version fits into
# the supported version range.
PYTHON_VERSION ?= python${ _PYTHON_VERSION }
2017-06-06 02:28:56 +02:00
. i f ! d e f i n e d ( P Y T H O N _ N O _ D E P E N D S ) & & \
2018-01-21 11:51:29 +01:00
${ PYTHON_VERSION } != python${ PYTHON_DEFAULT }
2014-08-09 17:44:27 +02:00
DEPENDS_ARGS += PYTHON_VERSION = ${ PYTHON_VERSION }
2016-02-19 21:44:52 +01:00
. e n d i f
2014-08-09 17:44:27 +02:00
2014-10-27 19:58:21 +01:00
# NOTE:
#
# PYTHON_VERSION will hold whatever is passed down the dependency chain.
2019-07-03 08:35:48 +02:00
# If a user runs `make PYTHON_VERSION=python3.5, PYTHON_VERSION will be
# set to 'python3.5'. A port however may require a different version,
2014-10-27 19:58:21 +01:00
# which is stored (above) in _PYTHON_VERSION.
# Every python bit below hence should use python${_PYTHON_VERSION}, since
# this is the value, the _port_ requires
#
2014-08-09 17:44:27 +02:00
# Got the correct python version, set some publicly accessible variables
PYTHON_VER = ${ _PYTHON_VERSION }
PYTHON_SUFFIX = ${ _PYTHON_VERSION : S /.//g }
PYTHON_MAJOR_VER = ${ PYTHON_VER : R }
PYTHON_REL = # empty
PYTHON_ABIVER = # empty
PYTHON_PORTSDIR = ${ _PYTHON_RELPORTDIR } ${ PYTHON_SUFFIX }
2015-11-09 19:52:19 +01:00
# Protect partial checkouts from Mk/Scripts/functions.sh:export_ports_env().
2016-04-28 14:17:09 +02:00
. i f ! d e f i n e d ( _ P O R T S _ E N V _ C H E C K ) | | e x i s t s ( $ { P O R T S D I R } / $ { P Y T H O N _ P O R T S D I R } )
. i n c l u d e "${PORTSDIR}/${PYTHON_PORTSDIR}/Makefile.version"
2015-10-19 23:10:56 +02:00
. e n d i f
2015-09-14 10:28:57 +02:00
# Create a 4 integer version string, prefixing 0 to the last token if
# it's a single character. Only use the the first 3 tokens of
# PORTVERSION to support pre-release versions (rc3, alpha4, etc) of
# any Python port (lang/pythonXY)
PYTHON_REL = ${ PYTHON_PORTVERSION : C /^([0-9]+ \. [0-9]+ \. [0-9]+).*/ \1 / : C / \. ([0-9]+) $/.0 \1 / : C / \. 0 ?([0-9][0-9]) $/. \1 / : S /.//g }
2014-08-09 17:44:27 +02:00
# Might be overridden by calling ports
PYTHON_CMD ?= ${ _PYTHON_BASECMD } ${ _PYTHON_VERSION }
2016-06-25 21:51:32 +02:00
. i f ${PYTHON_VER} != 2.7
. i f e x i s t s ( $ { P Y T H O N _ C M D } - c o n f i g )
2014-08-09 17:44:27 +02:00
PYTHON_ABIVER != ${ PYTHON_CMD } -config --abiflags
2016-06-25 21:51:32 +02:00
. e l s e
# Default ABI flags for lang/python3x ports
PYTHON_ABIVER = m
. e n d i f
2014-08-09 17:44:27 +02:00
. e n d i f
2015-10-19 23:10:56 +02:00
. i f ! d e f i n e d ( P Y T H O N B A S E )
2014-08-09 17:44:27 +02:00
PYTHONBASE != ( ${ PYTHON_CMD } -c 'import sys; print(sys.prefix)' \
2> /dev/null || ${ ECHO_CMD } ${ LOCALBASE } ) | ${ TAIL } -1
2015-10-19 23:10:56 +02:00
. e n d i f
_EXPORTED_VARS += PYTHONBASE
2014-08-09 17:44:27 +02:00
2014-10-27 19:58:21 +01:00
PYTHON_INCLUDEDIR = ${ PYTHONBASE } /include/python${ _PYTHON_VERSION } ${ PYTHON_ABIVER }
PYTHON_LIBDIR = ${ PYTHONBASE } /lib/python${ _PYTHON_VERSION }
2014-08-09 17:44:27 +02:00
PYTHON_PLATFORM = ${ OPSYS : tl } ${ OSREL : C / \. [0-9.]*// }
PYTHON_SITELIBDIR = ${ PYTHON_LIBDIR } /site-packages
PYTHON_PKGNAMEPREFIX = py${ PYTHON_SUFFIX } -
PYTHON_PKGNAMESUFFIX = -py${ PYTHON_SUFFIX }
PYTHONPREFIX_INCLUDEDIR = ${ PYTHON_INCLUDEDIR : S ; ${ PYTHONBASE } ; ${ PREFIX } ; }
PYTHONPREFIX_LIBDIR = ${ PYTHON_LIBDIR : S ; ${ PYTHONBASE } ; ${ PREFIX } ; }
PYTHONPREFIX_SITELIBDIR = ${ PYTHON_SITELIBDIR : S ; ${ PYTHONBASE } ; ${ PREFIX } ; }
# Used for recording the installed files.
_PYTHONPKGLIST = ${ WRKDIR } /.PLIST.pymodtmp
2017-01-07 22:42:28 +01:00
# PEP 0488 (https://www.python.org/dev/peps/pep-0488/)
. i f $ { P Y T H O N _ R E L } < 3 5 0 0
PYTHON_PYOEXTENSION = pyo
. e l s e
PYTHON_PYOEXTENSION = opt-1.pyc
. e n d i f
2014-08-09 17:44:27 +02:00
# Ports bound to a certain python version SHOULD
# - use the PYTHON_PKGNAMEPREFIX
# - use directories using the PYTHON_PKGNAMEPREFIX
# - install binaries using the required PYTHON_VER, with
# the default python version creating a symlink to the original binary
# name (for staging-aware ports).
#
# What makes a port 'bound' to a certain python version?
# - it installs data into PYTHON_SITELIBDIR, PYTHON_INCLUDEDIR, ...
# - it links against libpython*.so
2014-08-14 19:04:30 +02:00
# - it uses USE_PYTHON=distutils
2014-08-09 17:44:27 +02:00
#
2017-11-30 16:50:30 +01:00
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ C Y T H O N )
BUILD_DEPENDS += cython-${ PYTHON_VER } :lang/cython@${ PY_FLAVOR }
. e n d i f
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ C Y T H O N _ R U N )
RUN_DEPENDS += cython-${ PYTHON_VER } :lang/cython@${ PY_FLAVOR }
. e n d i f
2014-08-09 17:44:27 +02:00
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ C O N C U R R E N T )
2017-12-12 13:31:10 +01:00
.if !defined(_PYTHON_FEATURE_FLAVORS) && (${_PYTHON_VERSION_MINIMUM : M 3*} | | ${_PYTHON_VERSION_MAXIMUM :M 2*})
DEV_WARNING += "USE_PYTHON=concurrent when only one of Python 2 or 3 is supported AND not using flavors does not make any sense"
. e n d i f
2014-08-09 17:44:27 +02:00
_USES_POST += uniquefiles:dirs
2017-12-11 13:41:56 +01:00
.if defined(_PYTHON_FEATURE_FLAVORS) && ${FLAVOR} == ${FLAVORS : [1]}
UNIQUE_DEFAULT_LINKS = yes
2018-01-21 11:51:29 +01:00
. e l i f ! d e f i n e d ( _ P Y T H O N _ F E A T U R E _ F L A V O R S ) & & ${PYTHON_VERSION} = = python${ PYTHON_DEFAULT }
2014-08-09 17:44:27 +02:00
UNIQUE_DEFAULT_LINKS = yes
. e l s e
UNIQUE_DEFAULT_LINKS = no
. e n d i f
UNIQUE_PREFIX = ${ PYTHON_PKGNAMEPREFIX }
UNIQUE_SUFFIX = -${ PYTHON_VER }
2017-12-19 17:23:48 +01:00
UNIQUE_SUFFIX_TYPES += SUFFIX_MAN
UNIQUE_SUFFIX_MAN_WITH_EXT = .[ 1-9ln]
UNIQUE_SUFFIX_MAN_EXTRA_EXT = .gz
2014-08-09 17:44:27 +02:00
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ A U T O P L I S T )
2017-12-19 17:23:48 +01:00
_UNIQUE_FIND_SUFFIX_FILES = ${ SED } -e 's|^${PREFIX}/||' ${ _PYTHONPKGLIST } ${ TMPPLIST }
2014-08-09 17:44:27 +02:00
. e l s e
2017-12-19 17:23:48 +01:00
_UNIQUE_FIND_SUFFIX_FILES = ${ SED } -e 's|^${PREFIX}/||' ${ TMPPLIST } 2>/dev/null
2014-08-09 17:44:27 +02:00
. e n d i f
2017-12-19 17:23:48 +01:00
UNIQUE_FIND_SUFFIX_FILES += ${ _UNIQUE_FIND_SUFFIX_FILES } | \
${ EGREP } -he '^bin/.*$$|^sbin/.*$$|^libexec/.*$$'
UNIQUE_FIND_SUFFIX_MAN_FILES += ${ _UNIQUE_FIND_SUFFIX_FILES } | \
${ EGREP } -he '^man/man[1-9ln]/.*$$'
2014-08-09 17:44:27 +02:00
. e n d i f # defined(_PYTHON_FEATURE_CONCURRENT)
_CURRENTPORT := ${ PKGNAMEPREFIX } ${ PORTNAME } ${ PKGNAMESUFFIX }
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ D I S T U T I L S ) & & \
2017-03-16 20:23:48 +01:00
${ _CURRENTPORT } != ${ PYTHON_PKGNAMEPREFIX } setuptools
2017-11-30 16:50:30 +01:00
BUILD_DEPENDS += ${ PYTHON_PKGNAMEPREFIX } setuptools>0:devel/py-setuptools@${ PY_FLAVOR }
RUN_DEPENDS += ${ PYTHON_PKGNAMEPREFIX } setuptools>0:devel/py-setuptools@${ PY_FLAVOR }
2014-08-09 17:44:27 +02:00
. e n d i f
# distutils support
PYSETUP ?= setup.py
PYDISTUTILS_SETUP ?= -c \
" import sys; import setuptools; \
__file__ = '${PYSETUP}' ; sys.argv[ 0] = '${PYSETUP}' ; \
exec( compile( open( __file__, 'rb' ) .read( ) .replace( b'\\r\\n' , b'\\n' ) , __file__, 'exec' ) ) "
PYDISTUTILS_CONFIGUREARGS ?= # empty
PYDISTUTILS_BUILDARGS ?= # empty
PYDISTUTILS_INSTALLARGS ?= -c -O1 --prefix= ${ PREFIX }
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ D I S T U T I L S )
. i f ! d e f i n e d ( P Y D I S T U T I L S _ I N S T A L L N O S I N G L E )
PYDISTUTILS_INSTALLARGS += --single-version-externally-managed
. e n d i f
PYDISTUTILS_INSTALLARGS += --root= ${ STAGEDIR }
. e n d i f
PYDISTUTILS_INSTALLARGS := --record ${ _PYTHONPKGLIST } \
${ PYDISTUTILS_INSTALLARGS }
PYDISTUTILS_PKGNAME ?= ${ PORTNAME }
PYDISTUTILS_PKGVERSION ?= ${ PORTVERSION }
PYDISTUTILS_EGGINFO ?= ${ PYDISTUTILS_PKGNAME : C /[^A-Za-z0-9.]+/_/g } -${ PYDISTUTILS_PKGVERSION : C /[^A-Za-z0-9.]+/_/g } -py${ PYTHON_VER } .egg-info
PYDISTUTILS_EGGINFODIR ?= ${ STAGEDIR } ${ PYTHONPREFIX_SITELIBDIR }
. i f ! d e f i n e d ( _ P Y T H O N _ F E A T U R E _ N O E G G I N F O ) & & \
!defined( _PYTHON_FEATURE_AUTOPLIST) && \
2014-10-02 09:53:52 +02:00
defined( _PYTHON_FEATURE_DISTUTILS) && \
2014-08-09 17:44:27 +02:00
defined( PYTHON_REL)
2016-04-22 11:24:34 +02:00
_USES_stage += 933:add-plist-egginfo
add-plist-egginfo :
2014-08-09 17:44:27 +02:00
. f o r e g g i n f o i n $ { P Y D I S T U T I L S _ E G G I N F O }
if [ -d " ${ PYDISTUTILS_EGGINFODIR } / ${ egginfo } " ] ; then \
${ LS } ${ PYDISTUTILS_EGGINFODIR } /${ egginfo } | while read f; do \
2014-10-07 18:51:20 +02:00
${ ECHO_CMD } ${ PYDISTUTILS_EGGINFODIR : S ;^ ${ STAGEDIR } ${ PREFIX } /;; } /${ egginfo } /$$ { f} >> ${ TMPPLIST } ; \
2014-08-09 17:44:27 +02:00
done ; \
fi ;
. e n d f o r
. e n d i f
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ A U T O P L I S T ) & & d e f i n e d ( _ P Y T H O N _ F E A T U R E _ D I S T U T I L S )
_RELSITELIBDIR = ${ PYTHONPREFIX_SITELIBDIR : S ; ${ PREFIX } /;; }
_RELLIBDIR = ${ PYTHONPREFIX_LIBDIR : S ; ${ PREFIX } /;; }
2016-04-22 11:24:34 +02:00
_USES_stage += 934:add-plist-pymod
2014-08-09 17:44:27 +02:00
add-plist-pymod :
@${ SED } -e 's|^${STAGEDIR}${PREFIX}/||' \
-e 's|^${PREFIX}/||' \
2014-09-03 17:49:09 +02:00
-e 's|^\(man/.*man[0-9]\)/\(.*\.[0-9]\)$$|\1/\2.gz|' \
2014-09-25 23:01:57 +02:00
-e 's|[[:alnum:]|[:space:]]*/\.\./*||g; s|/\./|/|g' \
2014-08-09 17:44:27 +02:00
${ _PYTHONPKGLIST } | ${ SORT } >> ${ TMPPLIST }
. e l s e
2015-05-26 18:47:02 +02:00
. i f $ { P Y T H O N _ R E L } > = 3 2 0 0 & & d e f i n e d ( _ P Y T H O N _ F E A T U R E _ P Y 3 K P L I S T )
2014-08-09 17:44:27 +02:00
# When Python version is 3.2+ we rewrite all the filenames
# of TMPPLIST that end with .py[co], so that they conform
2018-11-03 23:26:41 +01:00
# to PEP 3147 (see https://www.python.org/dev/peps/pep-3147/)
2018-11-25 18:11:52 +01:00
PYMAGICTAG = ${ PYTHON_CMD } -c 'import sys; print(sys.implementation.cache_tag)'
2016-04-22 11:24:34 +02:00
_USES_stage += 935:add-plist-python
add-plist-python :
2014-08-09 17:44:27 +02:00
@${ AWK } ' \
2015-09-14 14:26:28 +02:00
/\. py[ co] $$ / && !( $$ 0 ~ "/" pc "/" ) { id = match( $$ 0, /\/ [ ^\/ ] +\. py[ co] $$ /) ; if ( id != 0) { d = substr( $$ 0, 1, RSTART - 1) ; dirs[ d] = 1} ; sub( /\. pyc$$ /, "." mt "&" ) ; sub( /\. pyo$$ /, "." mt "." pyo) ; sub( /[ ^\/ ] +\. py[ co] $$ /, pc "/&" ) ; print; next} \
2014-08-09 17:44:27 +02:00
/^@dirrm / { d = substr( $$ 0, 8) ; if ( d in dirs ) { print $$ 0 "/" pc} ; print $$ 0; next} \
/^@dirrmtry / { d = substr( $$ 0, 11) ; if ( d in dirs ) { print $$ 0 "/" pc} ; print $$ 0; next} \
{ print} \
' \
2019-04-25 17:21:51 +02:00
pc = "__pycache__" mt = " $$ ( ${ PYMAGICTAG } ) " pyo = "opt-1.pyc" \
2014-08-09 17:44:27 +02:00
${ TMPPLIST } > ${ TMPPLIST } .pyc_tmp
@${ MV } ${ TMPPLIST } .pyc_tmp ${ TMPPLIST }
2015-05-26 18:47:02 +02:00
. e n d i f # ${PYTHON_REL} >= 3200 && defined(_PYTHON_FEATURE_PY3KPLIST)
2014-08-09 17:44:27 +02:00
. e n d i f # defined(_PYTHON_FEATURE_AUTOPLIST) && defined(_PYTHON_FEATURE_DISTUTILS)
# Fix for programs that build python from a GNU auto* environment
CONFIGURE_ENV += PYTHON = " ${ PYTHON_CMD } "
2015-06-10 11:23:54 +02:00
# By default CMake picks up the highest available version of Python package.
# Enforce the version required by the port or the default.
CMAKE_ARGS += -DPython_ADDITIONAL_VERSIONS= ${ PYTHON_VER }
2014-08-09 17:44:27 +02:00
# Python 3rd-party modules
2017-11-30 16:50:30 +01:00
PYGAME = ${ PYTHON_PKGNAMEPREFIX } game>0:devel/py-game@${ PY_FLAVOR }
2017-12-04 12:17:23 +01:00
PYNUMPY = ${ PYTHON_PKGNAMEPREFIX } numpy>0:math/py-numpy@${ PY_FLAVOR }
2017-11-30 16:50:30 +01:00
# Common Python modules that can be needed but only for some versions of Python.
2019-05-31 12:00:20 +02:00
. i f $ { P Y T H O N _ R E L } < 3 5 0 0
PY_TYPING = ${ PYTHON_PKGNAMEPREFIX } typing>= 3.6.4:devel/py-typing@${ PY_FLAVOR }
. e l s e
PY_TYPING =
. e n d i f
2017-11-30 16:50:30 +01:00
. i f $ { P Y T H O N _ R E L } < 3 4 0 0
PY_ENUM34 = ${ PYTHON_PKGNAMEPREFIX } enum34>0:devel/py-enum34@${ PY_FLAVOR }
PY_ENUM_COMPAT = ${ PYTHON_PKGNAMEPREFIX } enum-compat>0:devel/py-enum-compat@${ PY_FLAVOR }
PY_PATHLIB = ${ PYTHON_PKGNAMEPREFIX } pathlib>0:devel/py-pathlib@${ PY_FLAVOR }
. e l s e
PY_ENUM34 =
PY_ENUM_COMPAT =
PY_PATHLIB =
. e n d i f
. i f $ { P Y T H O N _ R E L } < 3 3 0 0
PY_IPADDRESS = ${ PYTHON_PKGNAMEPREFIX } ipaddress>0:net/py-ipaddress@${ PY_FLAVOR }
. e l s e
PY_IPADDRESS =
. e n d i f
. i f $ { P Y T H O N _ R E L } < 3 2 0 0
2019-06-23 21:21:24 +02:00
PY_FUTURES = ${ PYTHON_PKGNAMEPREFIX } futures>= 3.2:devel/py-futures@${ PY_FLAVOR }
2017-11-30 16:50:30 +01:00
. e l s e
PY_FUTURES =
. e n d i f
2014-08-09 17:44:27 +02:00
2018-04-18 15:58:15 +02:00
CMAKE_ARGS += -DBOOST_PYTHON_SUFFIX:STRING= ${ PYTHON_SUFFIX }
2018-04-18 15:57:42 +02:00
PY_BOOST_LIB = boost_python${ PYTHON_SUFFIX }
2018-02-15 13:34:49 +01:00
PY_BOOST = lib${ PY_BOOST_LIB } .so:devel/boost-python-libs@${ PY_FLAVOR }
2014-08-09 17:44:27 +02:00
# dependencies
2018-01-25 13:36:54 +01:00
. f o r _ s t a g e i n P A T C H B U I L D R U N T E S T
. i f d e f i n e d ( _ P Y T H O N _ $ { _ s t a g e } _ D E P )
${_stage}_DEPENDS += ${ PYTHON_CMD } :${ PYTHON_PORTSDIR }
. e n d i f
. e n d f o r
2014-08-09 17:44:27 +02:00
# set $PREFIX as Python's one
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ P Y T H O N P R E F I X )
PREFIX = ${ PYTHONBASE }
. e n d i f
# Substitutions for pkg-plist
# Use a short form of the PYTHONPREFIX_*DIR variables; we don't need the
# base directory in the plist file.
PLIST_SUB += PYTHON_INCLUDEDIR = ${ PYTHONPREFIX_INCLUDEDIR : S ; ${ PREFIX } /;; } \
PYTHON_LIBDIR = ${ PYTHONPREFIX_LIBDIR : S ; ${ PREFIX } /;; } \
PYTHON_PLATFORM = ${ PYTHON_PLATFORM } \
PYTHON_SITELIBDIR = ${ PYTHONPREFIX_SITELIBDIR : S ; ${ PREFIX } /;; } \
2017-01-07 22:42:28 +01:00
PYTHON_SUFFIX = ${ PYTHON_SUFFIX } \
2016-01-02 18:30:28 +01:00
PYTHON_VER = ${ PYTHON_VER } \
2017-01-07 22:42:28 +01:00
PYTHON_VERSION = ${ PYTHON_VERSION }
. i f $ { P Y T H O N _ R E L } < 3 0 0 0
PLIST_SUB += PYTHON2 = "" PYTHON3 = "@comment "
. e l s e
PLIST_SUB += PYTHON2 = "@comment " PYTHON3 = ""
. e n d i f
2014-08-09 17:44:27 +02:00
_USES_POST += python
. e n d i f # _INCLUDE_USES_PYTHON_MK
. i f d e f i n e d ( _ P O S T M K I N C L U D E D ) & & ! d e f i n e d ( _ I N C L U D E _ U S E S _ P Y T H O N _ P O S T _ M K )
_INCLUDE_USES_PYTHON_POST_MK = yes
# py-distutils support
PYDISTUTILS_CONFIGURE_TARGET ?= config
PYDISTUTILS_BUILD_TARGET ?= build
PYDISTUTILS_INSTALL_TARGET ?= install
. i f d e f i n e d ( _ P Y T H O N _ F E A T U R E _ D I S T U T I L S )
LDSHARED ?= ${ CC } -shared
MAKE_ENV += LDSHARED = " ${ LDSHARED } " PYTHONDONTWRITEBYTECODE = PYTHONOPTIMIZE =
. i f ! t a r g e t ( d o - c o n f i g u r e ) & & ! d e f i n e d ( H A S _ C O N F I G U R E ) & & ! d e f i n e d ( G N U _ C O N F I G U R E )
do-configure :
@( cd ${ BUILD_WRKSRC } ; ${ SETENV } ${ MAKE_ENV } ${ PYTHON_CMD } ${ PYDISTUTILS_SETUP } ${ PYDISTUTILS_CONFIGURE_TARGET } ${ PYDISTUTILS_CONFIGUREARGS } )
. e n d i f
. i f ! t a r g e t ( d o - b u i l d )
do-build :
@( cd ${ BUILD_WRKSRC } ; ${ SETENV } ${ MAKE_ENV } ${ PYTHON_CMD } ${ PYDISTUTILS_SETUP } ${ PYDISTUTILS_BUILD_TARGET } ${ PYDISTUTILS_BUILDARGS } )
. e n d i f
. i f ! t a r g e t ( d o - i n s t a l l )
do-install :
@( cd ${ INSTALL_WRKSRC } ; ${ SETENV } ${ MAKE_ENV } ${ PYTHON_CMD } ${ PYDISTUTILS_SETUP } ${ PYDISTUTILS_INSTALL_TARGET } ${ PYDISTUTILS_INSTALLARGS } )
. e n d i f
. e n d i f # defined(_PYTHON_FEATURE_DISTUTILS)
. e n d i f # defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_PYTHON_POST_MK)