Signed-off-by: Michał Górny <[email protected]>
---
eclass/distutils-r2.eclass | 2 +-
eclass/python-any-r2.eclass | 12 +--
eclass/python-r2.eclass | 12 +--
eclass/python-single-r2.eclass | 8 +-
eclass/python-utils-r2.eclass | 149 ++++----------------------------
eclass/tests/python-utils-r2.sh | 2 +-
6 files changed, 36 insertions(+), 149 deletions(-)
diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass
index 1b3f9e89fc49..3863e0679e5b 100644
--- a/eclass/distutils-r2.eclass
+++ b/eclass/distutils-r2.eclass
@@ -730,7 +730,7 @@ _distutils-r2_wrap_scripts() {
local bindir=${2}
local PYTHON_SCRIPTDIR
- python_export PYTHON_SCRIPTDIR
+ _python_export PYTHON_SCRIPTDIR
local f python_files=() non_python_files=()
diff --git a/eclass/python-any-r2.eclass b/eclass/python-any-r2.eclass
index bedd4aa6cae1..11ff29167f56 100644
--- a/eclass/python-any-r2.eclass
+++ b/eclass/python-any-r2.eclass
@@ -147,7 +147,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}"
@@ -228,7 +228,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
@@ -295,7 +295,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
return
fi
@@ -303,7 +303,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
return
fi
@@ -318,7 +318,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
return
fi
@@ -327,7 +327,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
return
diff --git a/eclass/python-r2.eclass b/eclass/python-r2.eclass
index 4dac2513c12b..c5881a21d8cd 100644
--- a/eclass/python-r2.eclass
+++ b/eclass/python-r2.eclass
@@ -169,7 +169,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
@@ -440,7 +440,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
@@ -518,7 +518,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
@@ -592,7 +592,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
"${@}"
@@ -715,7 +715,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
@@ -757,7 +757,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-r2.eclass b/eclass/python-single-r2.eclass
index fdb3438f0531..2132141c82aa 100644
--- a/eclass/python-single-r2.eclass
+++ b/eclass/python-single-r2.eclass
@@ -209,7 +209,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
@@ -432,7 +432,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
@@ -461,7 +461,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
return
fi
@@ -478,7 +478,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
fi
done
diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index b9baf0267a47..e7f2b4c68c59 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -224,116 +224,9 @@ _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
-# @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
-
-# @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
-
-# @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
-
-# @FUNCTION: python_export
+# @FUNCTION: _python_export
# @USAGE: [<impl>] <variables>...
+# @INTERNAL
# @DESCRIPTION:
# Set and export the Python implementation-relevant variables passed
# as parameters.
@@ -346,7 +239,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
@@ -363,7 +256,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
@@ -491,7 +384,7 @@ python_export() {
debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR =
${PYTHON_SCRIPTDIR}"
;;
*)
- die "python_export: unknown variable ${var}"
+ die "_python_export: unknown variable ${var}"
esac
done
}
@@ -502,13 +395,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}"
}
@@ -517,13 +407,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}"
}
@@ -538,7 +425,7 @@ python_get_includedir() {
python_get_library_path() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_LIBPATH
+ _python_export "${@}" PYTHON_LIBPATH
echo "${PYTHON_LIBPATH}"
}
@@ -555,7 +442,7 @@ python_get_library_path() {
python_get_CFLAGS() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_CFLAGS
+ _python_export "${@}" PYTHON_CFLAGS
echo "${PYTHON_CFLAGS}"
}
@@ -572,7 +459,7 @@ python_get_CFLAGS() {
python_get_LIBS() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_LIBS
+ _python_export "${@}" PYTHON_LIBS
echo "${PYTHON_LIBS}"
}
@@ -589,7 +476,7 @@ python_get_LIBS() {
python_get_PYTHON_CONFIG() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_CONFIG
+ _python_export "${@}" PYTHON_CONFIG
echo "${PYTHON_CONFIG}"
}
@@ -602,7 +489,7 @@ python_get_PYTHON_CONFIG() {
python_get_scriptdir() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_SCRIPTDIR
+ _python_export "${@}" PYTHON_SCRIPTDIR
echo "${PYTHON_SCRIPTDIR}"
}
@@ -667,7 +554,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
@@ -771,7 +658,7 @@ python_newexe() {
local newfn=${2}
local PYTHON_SCRIPTDIR d
- python_export PYTHON_SCRIPTDIR
+ _python_export PYTHON_SCRIPTDIR
d=${PYTHON_SCRIPTDIR#${EPREFIX}}
(
@@ -899,7 +786,7 @@ python_domodule() {
else
# relative to site-packages
local PYTHON_SITEDIR=${PYTHON_SITEDIR}
- [[ ${PYTHON_SITEDIR} ]] || python_export PYTHON_SITEDIR
+ [[ ${PYTHON_SITEDIR} ]] || _python_export PYTHON_SITEDIR
d=${PYTHON_SITEDIR#${EPREFIX}}/${python_moduleroot//.//}
fi
@@ -932,7 +819,7 @@ python_doheader() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is
null).'
local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
- [[ ${PYTHON_INCLUDEDIR} ]] || python_export PYTHON_INCLUDEDIR
+ [[ ${PYTHON_INCLUDEDIR} ]] || _python_export PYTHON_INCLUDEDIR
d=${PYTHON_INCLUDEDIR#${EPREFIX}}
@@ -976,7 +863,7 @@ _python_wrapper_setup() {
rm -f "${workdir}"/pkgconfig/python{,2,3}.pc || die
local EPYTHON PYTHON
- python_export "${impl}" EPYTHON PYTHON
+ _python_export "${impl}" EPYTHON PYTHON
local pyver pyother
if python_is_python3; then
@@ -1094,7 +981,7 @@ _python_is_installed() {
;;
*)
local PYTHON_PKG_DEP
- python_export "${impl}" PYTHON_PKG_DEP
+ _python_export "${impl}" PYTHON_PKG_DEP
has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
;;
esac
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index 64490cb0d24a..c5e618256519 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.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 ${?}
--
2.25.1