summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-03-20 09:16:27 +0100
committerMichał Górny <mgorny@gentoo.org>2020-03-22 06:36:57 +0100
commite230589a0c796ee7e7b22ed52d1a32ef88763b32 (patch)
tree6d43c03c25b47f502d75906f1fd8516c18aa8949 /eclass
parentpython-utils-r1.eclass: Replace python_export with getters (diff)
downloadgentoo-e230589a0c796ee7e7b22ed52d1a32ef88763b32.tar.gz
gentoo-e230589a0c796ee7e7b22ed52d1a32ef88763b32.tar.bz2
gentoo-e230589a0c796ee7e7b22ed52d1a32ef88763b32.zip
python-utils-r1.eclass: Mark python_export private
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/python-any-r1.eclass12
-rw-r--r--eclass/python-r1.eclass12
-rw-r--r--eclass/python-single-r1.eclass8
-rw-r--r--eclass/python-utils-r1.eclass150
-rwxr-xr-xeclass/tests/python-utils-r1.sh2
5 files changed, 43 insertions, 141 deletions
diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
index d16677debd2a..eef4c57b7e25 100644
--- a/eclass/python-any-r1.eclass
+++ b/eclass/python-any-r1.eclass
@@ -151,7 +151,7 @@ _python_any_set_globals() {
_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}"
@@ -232,7 +232,7 @@ python_gen_any_dep() {
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
@@ -299,7 +299,7 @@ python_setup() {
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
@@ -308,7 +308,7 @@ python_setup() {
# 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
@@ -324,7 +324,7 @@ python_setup() {
# 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
@@ -334,7 +334,7 @@ python_setup() {
# 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"
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index 3ac35e401217..8687b595123a 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.eclass
@@ -173,7 +173,7 @@ _python_set_globals() {
_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
@@ -485,7 +485,7 @@ python_gen_impl_dep() {
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
@@ -563,7 +563,7 @@ python_gen_any_dep() {
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
@@ -637,7 +637,7 @@ _python_multibuild_wrapper() {
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
"${@}"
@@ -760,7 +760,7 @@ python_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
@@ -803,7 +803,7 @@ python_replicate_script() {
local _PYTHON_FIX_SHEBANG_QUIET=1
local PYTHON_SCRIPTDIR
- python_export PYTHON_SCRIPTDIR
+ _python_export PYTHON_SCRIPTDIR
(
exeopts -m 0755
diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
index 888db3631d9c..ab3df94dcf11 100644
--- a/eclass/python-single-r1.eclass
+++ b/eclass/python-single-r1.eclass
@@ -213,7 +213,7 @@ _python_single_set_globals() {
local deps= i PYTHON_PKG_DEP
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
- python_export "${i}" PYTHON_PKG_DEP
+ _python_export "${i}" PYTHON_PKG_DEP
# 1) well, python-exec would suffice as an RDEP
# but no point in making this overcomplex, BDEP doesn't hurt anyone
# 2) python-exec should be built with all targets forced anyway
@@ -436,7 +436,7 @@ python_gen_impl_dep() {
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_single_target_${impl}? ( ${PYTHON_PKG_DEP} )" )
fi
done
@@ -465,7 +465,7 @@ python_setup() {
ewarn
ewarn "Dependencies won't be satisfied, and PYTHON_SINGLE_TARGET flags will be ignored."
- python_export "${impls[0]}" EPYTHON PYTHON
+ _python_export "${impls[0]}" EPYTHON PYTHON
_python_wrapper_setup
einfo "Using ${EPYTHON} to build"
return
@@ -483,7 +483,7 @@ python_setup() {
die "More than one implementation in PYTHON_SINGLE_TARGET."
fi
- python_export "${impl}" EPYTHON PYTHON
+ _python_export "${impl}" EPYTHON PYTHON
_python_wrapper_setup
einfo "Using ${EPYTHON} to build"
fi
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 064114b4faa3..aacee5ac35a0 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -228,116 +228,24 @@ _python_impl_matches() {
# 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.
@@ -350,7 +258,7 @@ _python_impl_matches() {
# 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
@@ -367,7 +275,7 @@ python_export() {
*)
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
@@ -495,7 +403,7 @@ python_export() {
debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}"
;;
*)
- die "python_export: unknown variable ${var}"
+ die "_python_export: unknown variable ${var}"
esac
done
}
@@ -506,13 +414,10 @@ python_export() {
# 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}"
}
@@ -521,13 +426,10 @@ python_get_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}"
}
@@ -542,7 +444,7 @@ python_get_includedir() {
python_get_library_path() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_LIBPATH
+ _python_export "${@}" PYTHON_LIBPATH
echo "${PYTHON_LIBPATH}"
}
@@ -559,7 +461,7 @@ python_get_library_path() {
python_get_CFLAGS() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_CFLAGS
+ _python_export "${@}" PYTHON_CFLAGS
echo "${PYTHON_CFLAGS}"
}
@@ -576,7 +478,7 @@ python_get_CFLAGS() {
python_get_LIBS() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_LIBS
+ _python_export "${@}" PYTHON_LIBS
echo "${PYTHON_LIBS}"
}
@@ -593,7 +495,7 @@ python_get_LIBS() {
python_get_PYTHON_CONFIG() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_CONFIG
+ _python_export "${@}" PYTHON_CONFIG
echo "${PYTHON_CONFIG}"
}
@@ -606,7 +508,7 @@ python_get_PYTHON_CONFIG() {
python_get_scriptdir() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_SCRIPTDIR
+ _python_export "${@}" PYTHON_SCRIPTDIR
echo "${PYTHON_SCRIPTDIR}"
}
@@ -671,7 +573,7 @@ python_optimize() {
[[ ${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
@@ -991,7 +893,7 @@ _python_wrapper_setup() {
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
@@ -1101,7 +1003,7 @@ python_is_installed() {
esac
local PYTHON_PKG_DEP
- python_export "${impl}" PYTHON_PKG_DEP
+ _python_export "${impl}" PYTHON_PKG_DEP
has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
}
diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh
index 4367890a08a1..2ce425be15e6 100755
--- a/eclass/tests/python-utils-r1.sh
+++ b/eclass/tests/python-utils-r1.sh
@@ -13,7 +13,7 @@ test_var() {
tbegin "${var} for ${impl}"
local ${var}
- python_export ${impl} PYTHON ${var}
+ _python_export ${impl} PYTHON ${var}
[[ ${!var} == ${expect} ]] || eerror "(${impl}: ${var}: ${!var} != ${expect}"
tend ${?}