_python_set_impls
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
- python_export "${i}" PYTHON_PKG_DEP
+ _python_export "${i}" PYTHON_PKG_DEP
# note: need to strip '=' slot operator for || deps
deps="${PYTHON_PKG_DEP/:0=/:0} ${deps}"
local i PYTHON_PKG_DEP out=
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
local PYTHON_USEDEP="python_targets_${i}(-),python_single_target_${i}(+)"
- python_export "${i}" PYTHON_PKG_DEP
+ _python_export "${i}" PYTHON_PKG_DEP
local i_depstr=${depstr//\$\{PYTHON_USEDEP\}/${PYTHON_USEDEP}}
# note: need to strip '=' slot operator for || deps
ewarn
ewarn "Dependencies won't be satisfied, and EPYTHON/eselect-python will be ignored."
- python_export "${impls[0]}" EPYTHON PYTHON
+ _python_export "${impls[0]}" EPYTHON PYTHON
_python_wrapper_setup
einfo "Using ${EPYTHON} to build"
return
# first, try ${EPYTHON}... maybe it's good enough for us.
if [[ ${EPYTHON} ]]; then
if _python_EPYTHON_supported "${EPYTHON}"; then
- python_export EPYTHON PYTHON
+ _python_export EPYTHON PYTHON
_python_wrapper_setup
einfo "Using ${EPYTHON} to build"
return
# no eselect-python?
break
elif _python_EPYTHON_supported "${i}"; then
- python_export "${i}" EPYTHON PYTHON
+ _python_export "${i}" EPYTHON PYTHON
_python_wrapper_setup
einfo "Using ${EPYTHON} to build"
return
# fallback to best installed impl.
# (reverse iteration over _PYTHON_SUPPORTED_IMPLS)
for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do
- python_export "${_PYTHON_SUPPORTED_IMPLS[i]}" EPYTHON PYTHON
+ _python_export "${_PYTHON_SUPPORTED_IMPLS[i]}" EPYTHON PYTHON
if _python_EPYTHON_supported "${EPYTHON}"; then
_python_wrapper_setup
einfo "Using ${EPYTHON} to build"
_python_set_impls
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
- python_export "${i}" PYTHON_PKG_DEP
+ _python_export "${i}" PYTHON_PKG_DEP
deps+="python_targets_${i}? ( ${PYTHON_PKG_DEP} ) "
done
for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
if _python_impl_matches "${impl}" "${@}"; then
local PYTHON_PKG_DEP
- python_export "${impl}" PYTHON_PKG_DEP
+ _python_export "${impl}" PYTHON_PKG_DEP
matches+=( "python_targets_${impl}? ( ${PYTHON_PKG_DEP} )" )
fi
done
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
if _python_impl_matches "${i}" "${@}"; then
local PYTHON_USEDEP="python_targets_${i}(-),python_single_target_${i}(+)"
- python_export "${i}" PYTHON_PKG_DEP
+ _python_export "${i}" PYTHON_PKG_DEP
local i_depstr=${depstr//\$\{PYTHON_USEDEP\}/${PYTHON_USEDEP}}
# note: need to strip '=' slot operator for || deps
local -x EPYTHON PYTHON
local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
- python_export "${MULTIBUILD_VARIANT}" EPYTHON PYTHON
+ _python_export "${MULTIBUILD_VARIANT}" EPYTHON PYTHON
_python_wrapper_setup
"${@}"
# check patterns
_python_impl_matches "${impl}" "${@}" || continue
- python_export "${impl}" EPYTHON PYTHON
+ _python_export "${impl}" EPYTHON PYTHON
# if python_check_deps() is declared, switch into any-of mode
if [[ ${has_check_deps} ]]; then
local _PYTHON_FIX_SHEBANG_QUIET=1
local PYTHON_SCRIPTDIR
- python_export PYTHON_SCRIPTDIR
+ _python_export PYTHON_SCRIPTDIR
(
exeopts -m 0755
# python2.7
# @CODE
-# @ECLASS-VARIABLE: PYTHON_SITEDIR
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The path to Python site-packages directory.
-#
-# Set and exported on request using python_export().
-# Requires a proper build-time dependency on the Python implementation.
-#
-# Example value:
-# @CODE
-# /usr/lib64/python2.7/site-packages
-# @CODE
-
-# @ECLASS-VARIABLE: PYTHON_INCLUDEDIR
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The path to Python include directory.
-#
-# Set and exported on request using python_export().
-# Requires a proper build-time dependency on the Python implementation.
-#
-# Example value:
-# @CODE
-# /usr/include/python2.7
-# @CODE
-
-# @ECLASS-VARIABLE: PYTHON_LIBPATH
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The path to Python library.
-#
-# Set and exported on request using python_export().
-# Valid only for CPython. Requires a proper build-time dependency
-# on the Python implementation.
-#
-# Example value:
-# @CODE
-# /usr/lib64/libpython2.7.so
-# @CODE
-
-# @ECLASS-VARIABLE: PYTHON_CFLAGS
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Proper C compiler flags for building against Python. Obtained from
-# pkg-config or python-config.
-#
-# Set and exported on request using python_export().
-# Valid only for CPython. Requires a proper build-time dependency
-# on the Python implementation and on pkg-config.
-#
-# Example value:
-# @CODE
-# -I/usr/include/python2.7
-# @CODE
-
-# @ECLASS-VARIABLE: PYTHON_LIBS
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Proper C compiler flags for linking against Python. Obtained from
-# pkg-config or python-config.
-#
-# Set and exported on request using python_export().
-# Valid only for CPython. Requires a proper build-time dependency
-# on the Python implementation and on pkg-config.
-#
-# Example value:
-# @CODE
-# -lpython2.7
-# @CODE
-
-# @ECLASS-VARIABLE: PYTHON_CONFIG
-# @DEFAULT_UNSET
+# @FUNCTION: python_export
+# @USAGE: [<impl>] <variables>...
+# @INTERNAL
# @DESCRIPTION:
-# Path to the python-config executable.
-#
-# Set and exported on request using python_export().
-# Valid only for CPython. Requires a proper build-time dependency
-# on the Python implementation and on pkg-config.
-#
-# Example value:
-# @CODE
-# /usr/bin/python2.7-config
-# @CODE
+# Backwards compatibility function. The relevant API is now considered
+# private, please use python_get* instead.
+python_export() {
+ debug-print-function ${FUNCNAME} "${@}"
-# @ECLASS-VARIABLE: PYTHON_PKG_DEP
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The complete dependency on a particular Python package as a string.
-#
-# Set and exported on request using python_export().
-#
-# Example value:
-# @CODE
-# dev-lang/python:2.7[xml]
-# @CODE
+ eqawarn "python_export() is part of private eclass API."
+ eqawarn "Please call python_get*() instead."
-# @ECLASS-VARIABLE: PYTHON_SCRIPTDIR
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The location where Python scripts must be installed for current impl.
-#
-# Set and exported on request using python_export().
-#
-# Example value:
-# @CODE
-# /usr/lib/python-exec/python2.7
-# @CODE
+ _python_export "${@}"
+}
-# @FUNCTION: python_export
+# @FUNCTION: _python_export
# @USAGE: [<impl>] <variables>...
+# @INTERNAL
# @DESCRIPTION:
# Set and export the Python implementation-relevant variables passed
# as parameters.
# The variables which can be exported are: PYTHON, EPYTHON,
# PYTHON_SITEDIR. They are described more completely in the eclass
# variable documentation.
-python_export() {
+_python_export() {
debug-print-function ${FUNCNAME} "${@}"
local impl var
*)
impl=${EPYTHON}
if [[ -z ${impl} ]]; then
- die "python_export called without a python implementation and EPYTHON is unset"
+ die "_python_export called without a python implementation and EPYTHON is unset"
fi
;;
esac
debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}"
;;
*)
- die "python_export: unknown variable ${var}"
+ die "_python_export: unknown variable ${var}"
esac
done
}
# Obtain and print the 'site-packages' path for the given
# implementation. If no implementation is provided, ${EPYTHON} will
# be used.
-#
-# If you just need to have PYTHON_SITEDIR set (and exported), then it is
-# better to use python_export() directly instead.
python_get_sitedir() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_SITEDIR
+ _python_export "${@}" PYTHON_SITEDIR
echo "${PYTHON_SITEDIR}"
}
# @DESCRIPTION:
# Obtain and print the include path for the given implementation. If no
# implementation is provided, ${EPYTHON} will be used.
-#
-# If you just need to have PYTHON_INCLUDEDIR set (and exported), then it
-# is better to use python_export() directly instead.
python_get_includedir() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_INCLUDEDIR
+ _python_export "${@}" PYTHON_INCLUDEDIR
echo "${PYTHON_INCLUDEDIR}"
}
python_get_library_path() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_LIBPATH
+ _python_export "${@}" PYTHON_LIBPATH
echo "${PYTHON_LIBPATH}"
}
python_get_CFLAGS() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_CFLAGS
+ _python_export "${@}" PYTHON_CFLAGS
echo "${PYTHON_CFLAGS}"
}
python_get_LIBS() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_LIBS
+ _python_export "${@}" PYTHON_LIBS
echo "${PYTHON_LIBS}"
}
python_get_PYTHON_CONFIG() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_CONFIG
+ _python_export "${@}" PYTHON_CONFIG
echo "${PYTHON_CONFIG}"
}
python_get_scriptdir() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_SCRIPTDIR
+ _python_export "${@}" PYTHON_SCRIPTDIR
echo "${PYTHON_SCRIPTDIR}"
}
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=${PYTHON}
- [[ ${PYTHON} ]] || python_export PYTHON
+ [[ ${PYTHON} ]] || _python_export PYTHON
# default to sys.path
if [[ ${#} -eq 0 ]]; then
rm -f "${workdir}"/pkgconfig/python{2,3}{,-embed}.pc || die
local EPYTHON PYTHON
- python_export "${impl}" EPYTHON PYTHON
+ _python_export "${impl}" EPYTHON PYTHON
local pyver pyother
if python_is_python3; then
esac
local PYTHON_PKG_DEP
- python_export "${impl}" PYTHON_PKG_DEP
+ _python_export "${impl}" PYTHON_PKG_DEP
has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
}