[gentoo-dev] [PATCH 25/25] python-multi-r2.eclass: Report python_setup impl verbosely

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-multi-r2.eclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/eclass/python-multi-r2.eclass b/eclass/python-multi-r2.eclass
index 093f794b909b..f7964d0842ae 100644
--- a/eclass/python-multi-r2.eclass
+++ b/eclass/python-multi-r2.eclass
@@ -739,6 +739,7 @@ python_setup() {
fi
 
_python_wrapper_setup
+   einfo "Using ${EPYTHON} in global scope"
 }
 
 # @FUNCTION: python_replicate_script
-- 
2.25.1




[gentoo-dev] [PATCH 24/25] python-single-r2.eclass: Report used impl verbosely

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-single-r2.eclass | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/eclass/python-single-r2.eclass b/eclass/python-single-r2.eclass
index 833622f1a49a..0d86aa0cf512 100644
--- a/eclass/python-single-r2.eclass
+++ b/eclass/python-single-r2.eclass
@@ -463,6 +463,7 @@ python_setup() {
 
_python_export "${impls[0]}" EPYTHON PYTHON
_python_wrapper_setup
+   einfo "Using ${EPYTHON} to build"
return
fi
 
@@ -480,6 +481,7 @@ python_setup() {
 
_python_export "${impl}" EPYTHON PYTHON
_python_wrapper_setup
+   einfo "Using ${EPYTHON} to build"
fi
done
 
-- 
2.25.1




[gentoo-dev] [PATCH 20/25] python-single-r2.eclass: PYTHON_MULTI_USEDEP → PYTHON_USEDEP

2020-02-29 Thread Michał Górny
Rename PYTHON_MULTI_USEDEP to PYTHON_USEDEP for consistency with other
eclasses.  Since the old PYTHON_USEDEP API is no longer supported,
the name is free again.

Signed-off-by: Michał Górny 
---
 eclass/python-single-r2.eclass | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/eclass/python-single-r2.eclass b/eclass/python-single-r2.eclass
index 2132141c82aa..2c73ec4d11fb 100644
--- a/eclass/python-single-r2.eclass
+++ b/eclass/python-single-r2.eclass
@@ -21,7 +21,7 @@
 # The eclass exports PYTHON_SINGLE_USEDEP that is suitable for depending
 # on other packages using the eclass.  Dependencies on packages using
 # python-r2 should be created via python_gen_cond_dep() function,
-# using PYTHON_MULTI_USEDEP placeholder.
+# using PYTHON_USEDEP placeholder.
 #
 # Please note that packages support multiple Python implementations
 # (using python-r2 eclass) can not depend on packages not supporting
@@ -142,7 +142,7 @@ EXPORT_FUNCTIONS pkg_setup
 # Python implementations.
 #
 # If you need to depend on a multi-impl (python-r2) package, use
-# python_gen_cond_dep with PYTHON_MULTI_USEDEP placeholder instead.
+# python_gen_cond_dep with PYTHON_USEDEP placeholder instead.
 #
 # Example use:
 # @CODE
@@ -154,7 +154,7 @@ EXPORT_FUNCTIONS pkg_setup
 # python_single_target_python3_4(-)?
 # @CODE
 
-# @ECLASS-VARIABLE: PYTHON_MULTI_USEDEP
+# @ECLASS-VARIABLE: PYTHON_USEDEP
 # @DESCRIPTION:
 # This is a placeholder variable supported by python_gen_cond_dep,
 # in order to depend on python-r2 packages built for the same Python
@@ -163,7 +163,7 @@ EXPORT_FUNCTIONS pkg_setup
 # Example use:
 # @CODE
 # RDEPEND="$(python_gen_cond_dep '
-# dev-python/foo[${PYTHON_MULTI_USEDEP}]
+# dev-python/foo[${PYTHON_USEDEP}]
 #   ')"
 # @CODE
 #
@@ -341,7 +341,7 @@ python_gen_useflags() {
 # to prevent accidental shell filename expansion.
 #
 # In order to enforce USE constraints on the packages, verbatim
-# '${PYTHON_SINGLE_USEDEP}' and '${PYTHON_MULTI_USEDEP}' (quoted!) may
+# '${PYTHON_SINGLE_USEDEP}' and '${PYTHON_USEDEP}' (quoted!) may
 # be placed in the dependency specification. It will get expanded within
 # the function into a proper USE dependency string.
 #
@@ -349,7 +349,7 @@ python_gen_useflags() {
 # @CODE
 # PYTHON_COMPAT=( python{2_7,3_{3,4}} pypy )
 # RDEPEND="$(python_gen_cond_dep \
-#   'dev-python/unittest2[${PYTHON_MULTI_USEDEP}]' python2_7 pypy )"
+#   'dev-python/unittest2[${PYTHON_USEDEP}]' python2_7 pypy )"
 # @CODE
 #
 # It will cause the variable to look like:
@@ -379,7 +379,7 @@ python_gen_cond_dep() {
local multi_usedep="python_targets_${impl}(-)"
 
matches+=( "python_single_target_${impl}? (
-   
${dep//\$\{PYTHON_MULTI_USEDEP\}/${multi_usedep}} )" )
+   ${dep//\$\{PYTHON_USEDEP\}/${multi_usedep}} )" )
fi
done
 
-- 
2.25.1




[gentoo-dev] [PATCH 22/25] eclass: python-r2.eclass → python-multi-r2.eclass

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/distutils-r2.eclass| 14 
 eclass/python-any-r2.eclass   |  9 +++--
 ...ython-r2.eclass => python-multi-r2.eclass} | 33 +--
 eclass/python-single-r2.eclass| 16 -
 eclass/python-utils-r2.eclass |  8 ++---
 5 files changed, 39 insertions(+), 41 deletions(-)
 rename eclass/{python-r2.eclass => python-multi-r2.eclass} (96%)

diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass
index b155c31d121e..b1bc7aadae57 100644
--- a/eclass/distutils-r2.eclass
+++ b/eclass/distutils-r2.eclass
@@ -14,7 +14,7 @@
 # the src_* phases. Each of the phases runs two pseudo-phases:
 # python_..._all() (e.g. python_prepare_all()) once in ${S}, then
 # python_...() (e.g. python_prepare()) for each implementation
-# (see: python_foreach_impl() in python-r2).
+# (see: python_foreach_impl() in python-multi-r2).
 #
 # In distutils-r2_src_prepare(), the 'all' function is run before
 # per-implementation ones (because it creates the implementations),
@@ -35,9 +35,9 @@
 # Please note that distutils-r2 sets RDEPEND and DEPEND unconditionally
 # for you.
 #
-# Also, please note that distutils-r2 will always inherit python-r2
-# as well. Thus, all the variables defined and documented there are
-# relevant to the packages using distutils-r2.
+# Also, please note that distutils-r2 will always inherit
+# python-multi-r2 or python-single-r2.  Thus, all the variables defined
+# and documented there are relevant to the packages using distutils-r2.
 
 case "${EAPI:-0}" in
0|1|2|3|4)
@@ -66,8 +66,8 @@ esac
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # If set to a non-null value, the ebuild will support setting a single
-# Python implementation only. It will effectively replace the python-r2
-# eclass inherit with python-single-r2.
+# Python implementation only. It will effectively replace
+# the python-multi-r2 eclass inherit with python-single-r2.
 #
 # Note that inheriting python-single-r2 will cause pkg_setup()
 # to be exported. It must be run in order for the eclass functions
@@ -97,7 +97,7 @@ if [[ ! ${_DISTUTILS_R2} ]]; then
 inherit multiprocessing toolchain-funcs
 
 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
-   inherit python-r2
+   inherit python-multi-r2
 else
inherit python-single-r2
 fi
diff --git a/eclass/python-any-r2.eclass b/eclass/python-any-r2.eclass
index 11ff29167f56..d6523a93646a 100644
--- a/eclass/python-any-r2.eclass
+++ b/eclass/python-any-r2.eclass
@@ -40,8 +40,8 @@ esac
 
 if [[ ! ${_PYTHON_ANY_R2} ]]; then
 
-if [[ ${_PYTHON_R2} ]]; then
-   die 'python-any-r2.eclass can not be used with python-r2.eclass.'
+if [[ ${_PYTHON_MULTI_R2} ]]; then
+   die 'python-any-r2.eclass can not be used with python-multi-r2.eclass.'
 elif [[ ${_PYTHON_SINGLE_R2} ]]; then
die 'python-any-r2.eclass can not be used with python-single-r2.eclass.'
 fi
@@ -124,9 +124,8 @@ EXPORT_FUNCTIONS pkg_setup
 # An eclass-generated USE-dependency string for the currently tested
 # implementation. It is set locally for python_check_deps() call.
 #
-# The generate USE-flag list is compatible with packages using python-r2,
-# python-single-r2 and python-distutils-ng eclasses. It must not be used
-# on packages using python.eclass.
+# The generate USE-flag list is compatible with packages using
+# python-multi-r2 eclass.
 #
 # Example use:
 # @CODE
diff --git a/eclass/python-r2.eclass b/eclass/python-multi-r2.eclass
similarity index 96%
rename from eclass/python-r2.eclass
rename to eclass/python-multi-r2.eclass
index f7a92c500317..093f794b909b 100644
--- a/eclass/python-r2.eclass
+++ b/eclass/python-multi-r2.eclass
@@ -1,7 +1,7 @@
 # Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-# @ECLASS: python-r2.eclass
+# @ECLASS: python-multi-r2.eclass
 # @MAINTAINER:
 # Python team 
 # @AUTHOR:
@@ -15,15 +15,15 @@
 #
 # This eclass sets correct IUSE. Modification of REQUIRED_USE has to
 # be done by the author of the ebuild (but PYTHON_REQUIRED_USE is
-# provided for convenience, see below). python-r2 exports PYTHON_DEPS
-# and PYTHON_USEDEP so you can create correct dependencies for your
-# package easily. It also provides methods to easily run a command for
-# each enabled Python implementation and duplicate the sources for them.
+# provided for convenience, see below). python-multi-r2 exports
+# PYTHON_DEPS and PYTHON_USEDEP so you can create correct dependencies
+# for your package easily. It also provides methods to easily run
+# a command for each enabled Python implementation and duplicate
+# the sources for them.
 #
-# Please note that python-r2 will always inherit python-utils-r2 as
-# well. Thus, all the functions defined there can be used
-# in the packages using python-r2, and there is no need ever to inherit
-# both.
+# Please note that python-multi-r2 will always inherit python-utils-r2.
+# Thus, all the function

[gentoo-dev] [PATCH 23/25] python-any-r2.eclass: Verbosely report used implementation

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-any-r2.eclass | 4 
 1 file changed, 4 insertions(+)

diff --git a/eclass/python-any-r2.eclass b/eclass/python-any-r2.eclass
index d6523a93646a..e7e5b3b9c68f 100644
--- a/eclass/python-any-r2.eclass
+++ b/eclass/python-any-r2.eclass
@@ -296,6 +296,7 @@ python_setup() {
 
_python_export "${impls[0]}" EPYTHON PYTHON
_python_wrapper_setup
+   einfo "Using ${EPYTHON} to build"
return
fi
 
@@ -304,6 +305,7 @@ python_setup() {
if _python_EPYTHON_supported "${EPYTHON}"; then
_python_export EPYTHON PYTHON
_python_wrapper_setup
+   einfo "Using ${EPYTHON} to build"
return
fi
fi
@@ -319,6 +321,7 @@ python_setup() {
elif _python_EPYTHON_supported "${i}"; then
_python_export "${i}" EPYTHON PYTHON
_python_wrapper_setup
+   einfo "Using ${EPYTHON} to build"
return
fi
done
@@ -329,6 +332,7 @@ python_setup() {
_python_export "${_PYTHON_SUPPORTED_IMPLS[i]}" EPYTHON PYTHON
if _python_EPYTHON_supported "${EPYTHON}"; then
_python_wrapper_setup
+   einfo "Using ${EPYTHON} to build"
return
fi
done
-- 
2.25.1




[gentoo-dev] [PATCH 21/25] distutils-r2.eclass: Pass --skip-build to install

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/distutils-r2.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass
index 6a52e261498c..b155c31d121e 100644
--- a/eclass/distutils-r2.eclass
+++ b/eclass/distutils-r2.eclass
@@ -832,7 +832,7 @@ distutils-r2_python_install() {
local root=${D%/}/_${EPYTHON}
[[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D%/}
 
-   esetup.py install --root="${root}" "${args[@]}"
+   esetup.py install --skip-build --root="${root}" "${args[@]}"
 
local forbidden_package_names=( examples test tests .pytest_cache )
local p
-- 
2.25.1




[gentoo-dev] [PATCH 19/25] python-utils-r2.eclass: Remove PYTHON_SCRIPTDIR export

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/distutils-r2.eclass  |  3 +--
 eclass/python-r2.eclass |  3 +--
 eclass/python-utils-r2.eclass   | 21 +++--
 eclass/tests/python-utils-r2.sh | 12 ++--
 4 files changed, 15 insertions(+), 24 deletions(-)

diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass
index 3863e0679e5b..6a52e261498c 100644
--- a/eclass/distutils-r2.eclass
+++ b/eclass/distutils-r2.eclass
@@ -729,8 +729,7 @@ _distutils-r2_wrap_scripts() {
local path=${1}
local bindir=${2}
 
-   local PYTHON_SCRIPTDIR
-   _python_export PYTHON_SCRIPTDIR
+   local PYTHON_SCRIPTDIR=$(python_get_scriptdir)
 
local f python_files=() non_python_files=()
 
diff --git a/eclass/python-r2.eclass b/eclass/python-r2.eclass
index c5881a21d8cd..f7a92c500317 100644
--- a/eclass/python-r2.eclass
+++ b/eclass/python-r2.eclass
@@ -756,8 +756,7 @@ python_replicate_script() {
_python_replicate_script() {
local _PYTHON_FIX_SHEBANG_QUIET=1
 
-   local PYTHON_SCRIPTDIR
-   _python_export PYTHON_SCRIPTDIR
+   local PYTHON_SCRIPTDIR=$(python_get_scriptdir)
 
(
exeopts -m 0755
diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index 7c438e59aa6a..8486ee901cd9 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -295,11 +295,6 @@ _python_export() {
export PYTHON_PKG_DEP
debug-print "${FUNCNAME}: PYTHON_PKG_DEP = 
${PYTHON_PKG_DEP}"
;;
-   PYTHON_SCRIPTDIR)
-   local dir
-   export 
PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl}
-   debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = 
${PYTHON_SCRIPTDIR}"
-   ;;
*)
die "_python_export: unknown variable ${var}"
esac
@@ -443,16 +438,15 @@ python_get_PYTHON_CONFIG() {
 }
 
 # @FUNCTION: python_get_scriptdir
-# @USAGE: []
 # @DESCRIPTION:
-# Obtain and print the script install path for the given
-# implementation. If no implementation is provided, ${EPYTHON} will
-# be used.
+# Obtain and print the script install path for ${EPYTHON}.
 python_get_scriptdir() {
debug-print-function ${FUNCNAME} "${@}"
+   [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
 
-   _python_export "${@}" PYTHON_SCRIPTDIR
-   echo "${PYTHON_SCRIPTDIR}"
+   local out=${EPREFIX}/usr/lib/python-exec/${impl}
+   debug-print "${FUNCNAME} -> ${out}"
+   echo "${out}"
 }
 
 # @FUNCTION: _python_ln_rel
@@ -619,9 +613,8 @@ python_newexe() {
local f=${1}
local newfn=${2}
 
-   local PYTHON_SCRIPTDIR d
-   _python_export PYTHON_SCRIPTDIR
-   d=${PYTHON_SCRIPTDIR#${EPREFIX}}
+   local PYTHON_SCRIPTDIR=$(python_get_scriptdir)
+   local d=${PYTHON_SCRIPTDIR#${EPREFIX}}
 
(
dodir "${wrapd}"
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index 0b41a7bcdb53..b4b37efe179b 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -84,7 +84,7 @@ if [[ -x /usr/bin/python2.7 ]]; then
test_get LIBS python2.7 "*-lpython2.7*"
 fi
 test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
-test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
+test_get scriptdir python2.7 /usr/lib/python-exec/python2.7
 
 test_var EPYTHON python3_6 python3.6
 test_var PYTHON python3_6 /usr/bin/python3.6
@@ -98,7 +98,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
test_get LIBS python3.6 "*-lpython3.6*"
 fi
 test_var PYTHON_PKG_DEP python3_6 '*dev-lang/python*:3.6'
-test_var PYTHON_SCRIPTDIR python3_6 /usr/lib/python-exec/python3.6
+test_get scriptdir python3.6 /usr/lib/python-exec/python3.6
 
 test_var EPYTHON python3_7 python3.7
 test_var PYTHON python3_7 /usr/bin/python3.7
@@ -112,7 +112,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
test_get LIBS python3.7 "*-lpython3.7*"
 fi
 test_var PYTHON_PKG_DEP python3_7 '*dev-lang/python*:3.7'
-test_var PYTHON_SCRIPTDIR python3_7 /usr/lib/python-exec/python3.7
+test_get scriptdir python3.7 /usr/lib/python-exec/python3.7
 
 test_var EPYTHON jython2_7 jython2.7
 test_var PYTHON jython2_7 /usr/bin/jython2.7
@@ -120,7 +120,7 @@ if [[ -x /usr/bin/jython2.7 ]]; then
test_get sitedir jython2.7 /usr/share/jython-2.7/Lib/site-packages
 fi
 test_var PYTHON_PKG_DEP jython2_7 '*dev-java/jython*:2.7'
-test_var PYTHON_SCRIPTDIR jython2_7 /usr/lib/python-exec/jython2.7
+test_get scriptdir jython2.7 /usr/lib/python-exec/jython2.7
 
 test_var EPYTHON pypy pypy
 test_var PYTHON pypy /usr/bin/pypy
@@ -129,7 +129,7 @@ if [[ -x /usr/bin/pypy ]]; then
test_get includedir pypy "/usr/lib*/pypy2.7

[gentoo-dev] [PATCH 18/25] python-utils-r2.eclass: Remove PYTHON_CONFIG export

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-utils-r2.eclass   | 41 +++--
 eclass/tests/python-utils-r2.sh |  6 ++---
 2 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index 00bc635ebab4..7c438e59aa6a 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -268,23 +268,6 @@ _python_export() {
export PYTHON=${EPREFIX}/usr/bin/${impl}
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
-   PYTHON_CONFIG)
-   local flags val
-
-   case "${impl}" in
-   python*)
-   [[ -n ${PYTHON} ]] || die 
"PYTHON needs to be set for ${var} to be exported, or requested before it"
-   flags=$("${PYTHON}" -c 'import 
sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")') || die
-   val=${PYTHON}${flags}-config
-   ;;
-   *)
-   die "${impl}: obtaining ${var} 
not supported"
-   ;;
-   esac
-
-   export PYTHON_CONFIG=${val}
-   debug-print "${FUNCNAME}: PYTHON_CONFIG = 
${PYTHON_CONFIG}"
-   ;;
PYTHON_PKG_DEP)
local d
case ${impl} in
@@ -431,20 +414,32 @@ python_get_LIBS() {
 }
 
 # @FUNCTION: python_get_PYTHON_CONFIG
-# @USAGE: []
 # @DESCRIPTION:
-# Obtain and print the PYTHON_CONFIG location for the given
-# implementation. If no implementation is provided, ${EPYTHON} will be
-# used.
+# Obtain and print the PYTHON_CONFIG location for ${EPYTHON}.
 #
 # Please note that this function can be used with CPython only.
 # It requires Python installed, and therefore proper build-time
 # dependencies need be added to the ebuild.
 python_get_PYTHON_CONFIG() {
debug-print-function ${FUNCNAME} "${@}"
+   [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
+
+   local flags out
+   local PYTHON
+   _python_export PYTHON
 
-   _python_export "${@}" PYTHON_CONFIG
-   echo "${PYTHON_CONFIG}"
+   case ${EPYTHON} in
+   python*)
+   flags=$("${EPYTHON}" -c 'import sysconfig; 
print(sysconfig.get_config_var("ABIFLAGS") or "")') || die
+   out=${PYTHON}${flags}-config
+   ;;
+   *)
+   die "${EPYTHON}: obtaining PYTHON_CONFIG not supported"
+   ;;
+   esac
+
+   debug-print "${FUNCNAME} -> ${out}"
+   echo "${out}"
 }
 
 # @FUNCTION: python_get_scriptdir
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index 8758f6d20464..0b41a7bcdb53 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -79,7 +79,7 @@ if [[ -x /usr/bin/python2.7 ]]; then
test_get sitedir python2.7 "/usr/lib*/python2.7/site-packages"
test_get includedir python2.7 /usr/include/python2.7
test_get library_path python2.7 "/usr/lib*/libpython2.7$(get_libname)"
-   test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
+   test_get PYTHON_CONFIG python2.7 /usr/bin/python2.7-config
test_get CFLAGS python2.7 "*-I/usr/include/python2.7*"
test_get LIBS python2.7 "*-lpython2.7*"
 fi
@@ -93,7 +93,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
test_get sitedir python3.6 "/usr/lib*/python3.6/site-packages"
test_get includedir python3.6 "/usr/include/python3.6${abiflags}"
test_get library_path python3.6 
"/usr/lib*/libpython3.6${abiflags}$(get_libname)"
-   test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
+   test_get PYTHON_CONFIG python3.6 "/usr/bin/python3.6${abiflags}-config"
test_get CFLAGS python3.6 "*-I/usr/include/python3.6*"
test_get LIBS python3.6 "*-lpython3.6*"
 fi
@@ -107,7 +107,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
test_get sitedir python3.7 "/usr/lib/python3.7/site-packages"
test_get includedir python3.7 "/usr/include/python3.7${abiflags}"
test_get library_path python3.7 
"/usr/lib*/libpython3.7${abiflags}$(get_libname)"
-   test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config"
+   test_get PYTHON_CONFIG python3.7 "/usr/bin/python3.7${abiflags}-config"
test_get CFLAGS python3.7 "*-I/usr/include/python3.7*"
test_get LIBS python3.7 "*-lpython3.7*"
 fi
-- 
2.25.1




[gentoo-dev] [PATCH 17/25] python-utils-r2.eclass: Remove PYTHON_LIBS export

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-utils-r2.eclass   | 36 ++---
 eclass/tests/python-utils-r2.sh |  6 +++---
 2 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index dc5c8dafd12c..00bc635ebab4 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -268,22 +268,6 @@ _python_export() {
export PYTHON=${EPREFIX}/usr/bin/${impl}
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
-   PYTHON_LIBS)
-   local val
-
-   case "${impl}" in
-   python*)
-   # python-2.7, python-3.2, etc.
-   val=$($(tc-getPKG_CONFIG) 
--libs ${impl/n/n-}) || die
-   ;;
-   *)
-   die "${impl}: obtaining ${var} 
not supported"
-   ;;
-   esac
-
-   export PYTHON_LIBS=${val}
-   debug-print "${FUNCNAME}: PYTHON_LIBS = 
${PYTHON_LIBS}"
-   ;;
PYTHON_CONFIG)
local flags val
 
@@ -420,20 +404,30 @@ python_get_CFLAGS() {
 }
 
 # @FUNCTION: python_get_LIBS
-# @USAGE: []
 # @DESCRIPTION:
 # Obtain and print the compiler flags for linking against Python,
-# for the given implementation. If no implementation is provided,
-# ${EPYTHON} will be used.
+# for ${EPYTHON}.
 #
 # Please note that this function can be used with CPython only.
 # It requires Python and pkg-config installed, and therefore proper
 # build-time dependencies need be added to the ebuild.
 python_get_LIBS() {
debug-print-function ${FUNCNAME} "${@}"
+   [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
+
+   local out
+   case ${EPYTHON} in
+   python*)
+   # python-2.7, python-3.2, etc.
+   out=$($(tc-getPKG_CONFIG) --libs ${EPYTHON/n/n-}) || die
+   ;;
+   *)
+   die "${EPYTHON}: obtaining LIBS not supported"
+   ;;
+   esac
 
-   _python_export "${@}" PYTHON_LIBS
-   echo "${PYTHON_LIBS}"
+   debug-print "${FUNCNAME} -> ${out}"
+   echo "${out}"
 }
 
 # @FUNCTION: python_get_PYTHON_CONFIG
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index fd0883376ab7..8758f6d20464 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -81,7 +81,7 @@ if [[ -x /usr/bin/python2.7 ]]; then
test_get library_path python2.7 "/usr/lib*/libpython2.7$(get_libname)"
test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
test_get CFLAGS python2.7 "*-I/usr/include/python2.7*"
-   test_var PYTHON_LIBS python2_7 "*-lpython2.7*"
+   test_get LIBS python2.7 "*-lpython2.7*"
 fi
 test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
 test_var PYTHON_SCRIPTDIR python2_7 /usr/lib/python-exec/python2.7
@@ -95,7 +95,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
test_get library_path python3.6 
"/usr/lib*/libpython3.6${abiflags}$(get_libname)"
test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
test_get CFLAGS python3.6 "*-I/usr/include/python3.6*"
-   test_var PYTHON_LIBS python3_6 "*-lpython3.6*"
+   test_get LIBS python3.6 "*-lpython3.6*"
 fi
 test_var PYTHON_PKG_DEP python3_6 '*dev-lang/python*:3.6'
 test_var PYTHON_SCRIPTDIR python3_6 /usr/lib/python-exec/python3.6
@@ -109,7 +109,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
test_get library_path python3.7 
"/usr/lib*/libpython3.7${abiflags}$(get_libname)"
test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config"
test_get CFLAGS python3.7 "*-I/usr/include/python3.7*"
-   test_var PYTHON_LIBS python3_7 "*-lpython3.7*"
+   test_get LIBS python3.7 "*-lpython3.7*"
 fi
 test_var PYTHON_PKG_DEP python3_7 '*dev-lang/python*:3.7'
 test_var PYTHON_SCRIPTDIR python3_7 /usr/lib/python-exec/python3.7
-- 
2.25.1




[gentoo-dev] [PATCH 14/25] python-utils-r2.eclass: Remove PYTHON_INCLUDEDIR export

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-utils-r2.eclass   | 30 --
 eclass/tests/python-utils-r2.sh | 10 +-
 2 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index 971dd4393963..87c7dd506274 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -268,17 +268,6 @@ _python_export() {
export PYTHON=${EPREFIX}/usr/bin/${impl}
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
-   PYTHON_INCLUDEDIR)
-   [[ -n ${PYTHON} ]] || die "PYTHON needs to be 
set for ${var} to be exported, or requested before it"
-   PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import 
distutils.sysconfig; print(distutils.sysconfig.get_python_inc())') || die
-   export PYTHON_INCLUDEDIR
-   debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = 
${PYTHON_INCLUDEDIR}"
-
-   # Jython gives a non-existing directory
-   if [[ ! -d ${PYTHON_INCLUDEDIR} ]]; then
-   die "${impl} does not install any 
header files!"
-   fi
-   ;;
PYTHON_LIBPATH)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be 
set for ${var} to be exported, or requested before it"
PYTHON_LIBPATH=$("${PYTHON}" -c 'import 
os.path, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR"), 
sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") 
else "")') || die
@@ -392,15 +381,21 @@ python_get_sitedir() {
 }
 
 # @FUNCTION: python_get_includedir
-# @USAGE: []
 # @DESCRIPTION:
-# Obtain and print the include path for the given implementation. If no
-# implementation is provided, ${EPYTHON} will be used.
+# Obtain and print the include path for ${EPYTHON}.
 python_get_includedir() {
debug-print-function ${FUNCNAME} "${@}"
+   [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
 
-   _python_export "${@}" PYTHON_INCLUDEDIR
-   echo "${PYTHON_INCLUDEDIR}"
+   local out=$("${EPYTHON}" -c 'import distutils.sysconfig; 
print(distutils.sysconfig.get_python_inc())') || die
+   debug-print "${FUNCNAME} -> ${out}"
+
+   # Jython gives a non-existing directory
+   if [[ ! -d ${out} ]]; then
+   die "${EPYTHON} does not install any header files!"
+   fi
+
+   echo "${out}"
 }
 
 # @FUNCTION: python_get_library_path
@@ -806,8 +801,7 @@ python_doheader() {
 
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is 
null).'
 
-   local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
-   [[ ${PYTHON_INCLUDEDIR} ]] || _python_export PYTHON_INCLUDEDIR
+   local d PYTHON_INCLUDEDIR=$(python_get_includedir)
 
d=${PYTHON_INCLUDEDIR#${EPREFIX}}
 
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index 423a0465d39a..a6221a625c50 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -77,7 +77,7 @@ test_var EPYTHON python2_7 python2.7
 test_var PYTHON python2_7 /usr/bin/python2.7
 if [[ -x /usr/bin/python2.7 ]]; then
test_get sitedir python2.7 "/usr/lib*/python2.7/site-packages"
-   test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7
+   test_get includedir python2.7 /usr/include/python2.7
test_var PYTHON_LIBPATH python2_7 "/usr/lib*/libpython2.7$(get_libname)"
test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
test_var PYTHON_CFLAGS python2_7 "*-I/usr/include/python2.7*"
@@ -91,7 +91,7 @@ test_var PYTHON python3_6 /usr/bin/python3.6
 if [[ -x /usr/bin/python3.6 ]]; then
abiflags=$(/usr/bin/python3.6 -c 'import sysconfig; 
print(sysconfig.get_config_var("ABIFLAGS"))')
test_get sitedir python3.6 "/usr/lib*/python3.6/site-packages"
-   test_var PYTHON_INCLUDEDIR python3_6 "/usr/include/python3.6${abiflags}"
+   test_get includedir python3.6 "/usr/include/python3.6${abiflags}"
test_var PYTHON_LIBPATH python3_6 
"/usr/lib*/libpython3.6${abiflags}$(get_libname)"
test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
test_var PYTHON_CFLAGS python3_6 "*-I/usr/include/python3.6*"
@@ -105,7 +105,7 @@ test_var PYTHON python3_7 /usr/bin/python3.7
 if [[ -x /usr/bin/python3.7 ]]; then
abiflags=$(/usr/bin/python3.7 -c 'import sysconfig; 
print(sysconfig.get_config_var("ABIFLAGS"))')
test_get sitedir python3.7 "/usr/lib/python3.7/site-packages"
-   test_var PYTHON_INCLUDEDIR python3_7 "/usr/include/python3.7${abiflags}"
+   test_get includedir python3.7 "/usr/include/python3.7${abiflags}"
tes

[gentoo-dev] [PATCH 16/25] python-utils-r2.eclass: Remove PYTHON_CFLAGS export

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-utils-r2.eclass   | 36 ++---
 eclass/tests/python-utils-r2.sh |  6 +++---
 2 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index edf030b24683..dc5c8dafd12c 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -268,22 +268,6 @@ _python_export() {
export PYTHON=${EPREFIX}/usr/bin/${impl}
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
-   PYTHON_CFLAGS)
-   local val
-
-   case "${impl}" in
-   python*)
-   # python-2.7, python-3.2, etc.
-   val=$($(tc-getPKG_CONFIG) 
--cflags ${impl/n/n-}) || die
-   ;;
-   *)
-   die "${impl}: obtaining ${var} 
not supported"
-   ;;
-   esac
-
-   export PYTHON_CFLAGS=${val}
-   debug-print "${FUNCNAME}: PYTHON_CFLAGS = 
${PYTHON_CFLAGS}"
-   ;;
PYTHON_LIBS)
local val
 
@@ -409,20 +393,30 @@ python_get_library_path() {
 }
 
 # @FUNCTION: python_get_CFLAGS
-# @USAGE: []
 # @DESCRIPTION:
 # Obtain and print the compiler flags for building against Python,
-# for the given implementation. If no implementation is provided,
-# ${EPYTHON} will be used.
+# for ${EPYTHON}.
 #
 # Please note that this function can be used with CPython only.
 # It requires Python and pkg-config installed, and therefore proper
 # build-time dependencies need be added to the ebuild.
 python_get_CFLAGS() {
debug-print-function ${FUNCNAME} "${@}"
+   [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
 
-   _python_export "${@}" PYTHON_CFLAGS
-   echo "${PYTHON_CFLAGS}"
+   local out
+   case ${EPYTHON} in
+   python*)
+   # python-2.7, python-3.2, etc.
+   out=$($(tc-getPKG_CONFIG) --cflags ${EPYTHON/n/n-}) || 
die
+   ;;
+   *)
+   die "${impl}: obtaining CFLAGS not supported"
+   ;;
+   esac
+
+   debug-print "${FUNCNAME} -> ${out}"
+   echo "${out}"
 }
 
 # @FUNCTION: python_get_LIBS
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index cba74b84c70a..fd0883376ab7 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -80,7 +80,7 @@ if [[ -x /usr/bin/python2.7 ]]; then
test_get includedir python2.7 /usr/include/python2.7
test_get library_path python2.7 "/usr/lib*/libpython2.7$(get_libname)"
test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
-   test_var PYTHON_CFLAGS python2_7 "*-I/usr/include/python2.7*"
+   test_get CFLAGS python2.7 "*-I/usr/include/python2.7*"
test_var PYTHON_LIBS python2_7 "*-lpython2.7*"
 fi
 test_var PYTHON_PKG_DEP python2_7 '*dev-lang/python*:2.7'
@@ -94,7 +94,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
test_get includedir python3.6 "/usr/include/python3.6${abiflags}"
test_get library_path python3.6 
"/usr/lib*/libpython3.6${abiflags}$(get_libname)"
test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
-   test_var PYTHON_CFLAGS python3_6 "*-I/usr/include/python3.6*"
+   test_get CFLAGS python3.6 "*-I/usr/include/python3.6*"
test_var PYTHON_LIBS python3_6 "*-lpython3.6*"
 fi
 test_var PYTHON_PKG_DEP python3_6 '*dev-lang/python*:3.6'
@@ -108,7 +108,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
test_get includedir python3.7 "/usr/include/python3.7${abiflags}"
test_get library_path python3.7 
"/usr/lib*/libpython3.7${abiflags}$(get_libname)"
test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config"
-   test_var PYTHON_CFLAGS python3_7 "*-I/usr/include/python3.7*"
+   test_get CFLAGS python3.7 "*-I/usr/include/python3.7*"
test_var PYTHON_LIBS python3_7 "*-lpython3.7*"
 fi
 test_var PYTHON_PKG_DEP python3_7 '*dev-lang/python*:3.7'
-- 
2.25.1




[gentoo-dev] [PATCH 15/25] python-utils-r2.eclass: Remove PYTHON_LIBPATH export

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-utils-r2.eclass   | 25 ++---
 eclass/tests/python-utils-r2.sh |  6 +++---
 2 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index 87c7dd506274..edf030b24683 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -268,16 +268,6 @@ _python_export() {
export PYTHON=${EPREFIX}/usr/bin/${impl}
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
-   PYTHON_LIBPATH)
-   [[ -n ${PYTHON} ]] || die "PYTHON needs to be 
set for ${var} to be exported, or requested before it"
-   PYTHON_LIBPATH=$("${PYTHON}" -c 'import 
os.path, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR"), 
sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") 
else "")') || die
-   export PYTHON_LIBPATH
-   debug-print "${FUNCNAME}: PYTHON_LIBPATH = 
${PYTHON_LIBPATH}"
-
-   if [[ ! ${PYTHON_LIBPATH} ]]; then
-   die "${impl} lacks a (usable) dynamic 
library"
-   fi
-   ;;
PYTHON_CFLAGS)
local val
 
@@ -399,18 +389,23 @@ python_get_includedir() {
 }
 
 # @FUNCTION: python_get_library_path
-# @USAGE: []
 # @DESCRIPTION:
-# Obtain and print the Python library path for the given implementation.
-# If no implementation is provided, ${EPYTHON} will be used.
+# Obtain and print the Python library path for ${EPYTHON}.
 #
 # Please note that this function can be used with CPython only. Use
 # in another implementation will result in a fatal failure.
 python_get_library_path() {
debug-print-function ${FUNCNAME} "${@}"
+   [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
 
-   _python_export "${@}" PYTHON_LIBPATH
-   echo "${PYTHON_LIBPATH}"
+   local out=$("${EPYTHON}" -c 'import os.path, sysconfig; 
print(os.path.join(sysconfig.get_config_var("LIBDIR"), 
sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") 
else "")') || die
+   debug-print "${FUNCNAME} -> ${out}"
+
+   if [[ ! ${out} ]]; then
+   die "${EPYTHON} lacks a (usable) dynamic library"
+   fi
+
+   echo "${out}"
 }
 
 # @FUNCTION: python_get_CFLAGS
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index a6221a625c50..cba74b84c70a 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -78,7 +78,7 @@ test_var PYTHON python2_7 /usr/bin/python2.7
 if [[ -x /usr/bin/python2.7 ]]; then
test_get sitedir python2.7 "/usr/lib*/python2.7/site-packages"
test_get includedir python2.7 /usr/include/python2.7
-   test_var PYTHON_LIBPATH python2_7 "/usr/lib*/libpython2.7$(get_libname)"
+   test_get library_path python2.7 "/usr/lib*/libpython2.7$(get_libname)"
test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
test_var PYTHON_CFLAGS python2_7 "*-I/usr/include/python2.7*"
test_var PYTHON_LIBS python2_7 "*-lpython2.7*"
@@ -92,7 +92,7 @@ if [[ -x /usr/bin/python3.6 ]]; then
abiflags=$(/usr/bin/python3.6 -c 'import sysconfig; 
print(sysconfig.get_config_var("ABIFLAGS"))')
test_get sitedir python3.6 "/usr/lib*/python3.6/site-packages"
test_get includedir python3.6 "/usr/include/python3.6${abiflags}"
-   test_var PYTHON_LIBPATH python3_6 
"/usr/lib*/libpython3.6${abiflags}$(get_libname)"
+   test_get library_path python3.6 
"/usr/lib*/libpython3.6${abiflags}$(get_libname)"
test_var PYTHON_CONFIG python3_6 "/usr/bin/python3.6${abiflags}-config"
test_var PYTHON_CFLAGS python3_6 "*-I/usr/include/python3.6*"
test_var PYTHON_LIBS python3_6 "*-lpython3.6*"
@@ -106,7 +106,7 @@ if [[ -x /usr/bin/python3.7 ]]; then
abiflags=$(/usr/bin/python3.7 -c 'import sysconfig; 
print(sysconfig.get_config_var("ABIFLAGS"))')
test_get sitedir python3.7 "/usr/lib/python3.7/site-packages"
test_get includedir python3.7 "/usr/include/python3.7${abiflags}"
-   test_var PYTHON_LIBPATH python3_7 
"/usr/lib*/libpython3.7${abiflags}$(get_libname)"
+   test_get library_path python3.7 
"/usr/lib*/libpython3.7${abiflags}$(get_libname)"
test_var PYTHON_CONFIG python3_7 "/usr/bin/python3.7${abiflags}-config"
test_var PYTHON_CFLAGS python3_7 "*-I/usr/include/python3.7*"
test_var PYTHON_LIBS python3_7 "*-lpython3.7*"
-- 
2.25.1




[gentoo-dev] [PATCH 12/25] python-utils-r2.eclass: Mark python_export private

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 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() {
 
loca

[gentoo-dev] [PATCH 11/25] python-utils-r2.eclass: Fix obsolete docs on python_export_best

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-utils-r2.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index c0f3b7220a68..b9baf0267a47 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -194,7 +194,7 @@ _python_impl_matches() {
 # This variable is set automatically in the following contexts:
 #
 # python-r2: Set in functions called by python_foreach_impl() or after
-# calling python_export_best().
+# calling python_setup().
 #
 # python-single-r2: Set after calling python-single-r2_pkg_setup().
 #
@@ -213,7 +213,7 @@ _python_impl_matches() {
 # This variable is set automatically in the following contexts:
 #
 # python-r2: Set in functions called by python_foreach_impl() or after
-# calling python_export_best().
+# calling python_setup().
 #
 # python-single-r2: Set after calling python-single-r2_pkg_setup().
 #
-- 
2.25.1




[gentoo-dev] [PATCH 13/25] python-utils-r2.eclass: Remove PYTHON_SITEDIR export

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-utils-r2.eclass   | 34 +++--
 eclass/tests/python-utils-r2.sh | 25 ++--
 2 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index e7f2b4c68c59..971dd4393963 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -235,10 +235,6 @@ _python_impl_matches() {
 # implementation (either as PYTHON_TARGETS value, e.g. python2_7,
 # or an EPYTHON one, e.g. python2.7). If no implementation passed,
 # the current one will be obtained from ${EPYTHON}.
-#
-# The variables which can be exported are: PYTHON, EPYTHON,
-# PYTHON_SITEDIR. They are described more completely in the eclass
-# variable documentation.
 _python_export() {
debug-print-function ${FUNCNAME} "${@}"
 
@@ -272,15 +268,6 @@ _python_export() {
export PYTHON=${EPREFIX}/usr/bin/${impl}
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
-   PYTHON_SITEDIR)
-   [[ -n ${PYTHON} ]] || die "PYTHON needs to be 
set for ${var} to be exported, or requested before it"
-   # sysconfig can't be used because:
-   # 1) pypy doesn't give site-packages but stdlib
-   # 2) jython gives paths with wrong case
-   PYTHON_SITEDIR=$("${PYTHON}" -c 'import 
distutils.sysconfig; print(distutils.sysconfig.get_python_lib())') || die
-   export PYTHON_SITEDIR
-   debug-print "${FUNCNAME}: PYTHON_SITEDIR = 
${PYTHON_SITEDIR}"
-   ;;
PYTHON_INCLUDEDIR)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be 
set for ${var} to be exported, or requested before it"
PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import 
distutils.sysconfig; print(distutils.sysconfig.get_python_inc())') || die
@@ -390,16 +377,18 @@ _python_export() {
 }
 
 # @FUNCTION: python_get_sitedir
-# @USAGE: []
 # @DESCRIPTION:
-# Obtain and print the 'site-packages' path for the given
-# implementation. If no implementation is provided, ${EPYTHON} will
-# be used.
+# Obtain and print the 'site-packages' path for ${EPYTHON}.
 python_get_sitedir() {
debug-print-function ${FUNCNAME} "${@}"
-
-   _python_export "${@}" PYTHON_SITEDIR
-   echo "${PYTHON_SITEDIR}"
+   [[ ${EPYTHON} ]] || die "EPYTHON must be set before calling ${FUNCNAME}"
+
+   # sysconfig can't be used because:
+   # 1) pypy doesn't give site-packages but stdlib
+   # 2) jython gives paths with wrong case
+   local out=$("${EPYTHON}" -c 'import distutils.sysconfig; 
print(distutils.sysconfig.get_python_lib())') || die
+   debug-print "${FUNCNAME} -> ${out}"
+   echo "${out}"
 }
 
 # @FUNCTION: python_get_includedir
@@ -749,7 +738,7 @@ python_newscript() {
 # @CODE
 # src_install() {
 #   python_moduleinto bar
-#   # installs ${PYTHON_SITEDIR}/bar/baz.py
+#   # installs $(python_get_sitedir)/bar/baz.py
 #   python_foreach_impl python_domodule baz.py
 # }
 # @CODE
@@ -785,8 +774,7 @@ python_domodule() {
d=${python_moduleroot}
else
# relative to site-packages
-   local PYTHON_SITEDIR=${PYTHON_SITEDIR}
-   [[ ${PYTHON_SITEDIR} ]] || _python_export PYTHON_SITEDIR
+   local PYTHON_SITEDIR=$(python_get_sitedir)
 
d=${PYTHON_SITEDIR#${EPREFIX}}/${python_moduleroot//.//}
fi
diff --git a/eclass/tests/python-utils-r2.sh b/eclass/tests/python-utils-r2.sh
index c5e618256519..423a0465d39a 100755
--- a/eclass/tests/python-utils-r2.sh
+++ b/eclass/tests/python-utils-r2.sh
@@ -19,6 +19,19 @@ test_var() {
tend ${?}
 }
 
+test_get() {
+   local getter=python_get_${1}
+   local impl=${2}
+   local expect=${3}
+
+   tbegin "${getter} for ${impl}"
+
+   local val=$(EPYTHON=${impl} ${getter})
+   [[ ${val} == ${expect} ]] || eerror "(${impl}: ${getter}: ${val} != 
${expect}"
+
+   tend ${?}
+}
+
 test_is() {
local func=${1}
local expect=${2}
@@ -63,7 +76,7 @@ inherit python-utils-r2
 test_var EPYTHON python2_7 python2.7
 test_var PYTHON python2_7 /usr/bin/python2.7
 if [[ -x /usr/bin/python2.7 ]]; then
-   test_var PYTHON_SITEDIR python2_7 "/usr/lib*/python2.7/site-packages"
+   test_get sitedir python2.7 "/usr/lib*/python2.7/site-packages"
test_var PYTHON_INCLUDEDIR python2_7 /usr/include/python2.7
test_var PYTHON_LIBPATH python2_7 "/usr/lib*/libpython2.7$(get_libname)"
test_var PYTHON_CONFIG python2_7 /usr/bin/python2.7-config
@@ -77,7 +90,7 @@ test_var EPYTHON python3_6 python3.6
 test_var PYTHON python3_6 /usr/bin/python3.6
 if [[ -x /usr/bin/pytho

[gentoo-dev] [PATCH 10/25] python-utils-r2.eclass: Add missing @INTERNAL to private func

2020-02-29 Thread Michał Górny
---
 eclass/python-utils-r2.eclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index bbd1802e3e7a..c0f3b7220a68 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -1257,6 +1257,7 @@ python_fix_shebang() {
 
 # @FUNCTION: _python_check_locale_sanity
 # @USAGE: 
+# @INTERNAL
 # @RETURN: 0 if sane, 1 otherwise
 # @DESCRIPTION:
 # Check whether the specified locale sanely maps between lowercase
-- 
2.25.1




[gentoo-dev] [PATCH 07/25] python-utils-r2.eclass: Remove python.eclass checks

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-utils-r2.eclass | 170 --
 1 file changed, 170 deletions(-)

diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index 9821c043021a..1f904d035050 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -967,8 +967,6 @@ python_wrapper_setup() {
[[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON specified."
 
if [[ ! -x ${workdir}/bin/python ]]; then
-   _python_check_dead_variables
-
mkdir -p "${workdir}"/{bin,pkgconfig} || die
 
# Clean up, in case we were supposed to do a cheap update.
@@ -1346,173 +1344,5 @@ build_sphinx() {
HTML_DOCS+=( "${dir}/_build/html/." )
 }
 
-# -- python.eclass functions --
-
-_python_check_dead_variables() {
-   local v
-
-   for v in PYTHON_DEPEND PYTHON_USE_WITH{,_OR,_OPT} 
{RESTRICT,SUPPORT}_PYTHON_ABIS
-   do
-   if [[ ${!v} ]]; then
-   die "${v} is invalid for python-r2 suite, please take a 
look @ 
https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Ebuild_head";
-   fi
-   done
-
-   for v in PYTHON_{CPPFLAGS,CFLAGS,CXXFLAGS,LDFLAGS}
-   do
-   if [[ ${!v} ]]; then
-   die "${v} is invalid for python-r2 suite, please take a 
look @ 
https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#PYTHON_CFLAGS";
-   fi
-   done
-
-   for v in PYTHON_TESTS_RESTRICTED_ABIS PYTHON_EXPORT_PHASE_FUNCTIONS \
-   PYTHON_VERSIONED_{SCRIPTS,EXECUTABLES} 
PYTHON_NONVERSIONED_EXECUTABLES
-   do
-   if [[ ${!v} ]]; then
-   die "${v} is invalid for python-r2 suite"
-   fi
-   done
-
-   for v in DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES 
DISTUTILS_SETUP_FILES \
-   DISTUTILS_GLOBAL_OPTIONS DISTUTILS_SRC_TEST PYTHON_MODNAME
-   do
-   if [[ ${!v} ]]; then
-   die "${v} is invalid for distutils-r2, please take a 
look @ 
https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#${v}";
-   fi
-   done
-
-   if [[ ${DISTUTILS_DISABLE_TEST_DEPENDENCY} ]]; then
-   die "${v} is invalid for distutils-r2, please take a look @ 
https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#DISTUTILS_SRC_TEST";
-   fi
-
-   # python.eclass::progress
-   for v in PYTHON_BDEPEND PYTHON_MULTIPLE_ABIS PYTHON_ABI_TYPE \
-   PYTHON_RESTRICTED_ABIS PYTHON_TESTS_FAILURES_TOLERANT_ABIS \
-   PYTHON_CFFI_MODULES_GENERATION_COMMANDS
-   do
-   if [[ ${!v} ]]; then
-   die "${v} is invalid for python-r2 suite"
-   fi
-   done
-}
-
-python_pkg_setup() {
-   die "${FUNCNAME}() is invalid for python-r2 suite, please take a look @ 
https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup";
-}
-
-python_convert_shebangs() {
-   die "${FUNCNAME}() is invalid for python-r2 suite, please take a look @ 
https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_convert_shebangs";
-}
-
-python_clean_py-compile_files() {
-   die "${FUNCNAME}() is invalid for python-r2 suite"
-}
-
-python_clean_installation_image() {
-   die "${FUNCNAME}() is invalid for python-r2 suite"
-}
-
-python_execute_function() {
-   die "${FUNCNAME}() is invalid for python-r2 suite, please take a look @ 
https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_execute_function";
-}
-
-python_generate_wrapper_scripts() {
-   die "${FUNCNAME}() is invalid for python-r2 suite"
-}
-
-python_merge_intermediate_installation_images() {
-   die "${FUNCNAME}() is invalid for python-r2 suite"
-}
-
-python_set_active_version() {
-   die "${FUNCNAME}() is invalid for python-r2 suite, please take a look @ 
https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup";
-}
-
-python_need_rebuild() {
-   die "${FUNCNAME}() is invalid for python-r2 suite"
-}
-
-PYTHON() {
-   die "${FUNCNAME}() is invalid for python-r2 suite, please take a look @ 
https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#.24.28PYTHON.29.2C_.24.7BEPYTHON.7D";
-}
-
-python_get_implementation() {
-   die "${FUNCNAME}() is invalid for python-r2 suite"
-}
-
-python_get_implementational_package() {
-   die "${FUNCNAME}() is invalid for python-r2 suite"
-}
-
-python_get_libdir() {
-   die "${FUNCNAME}() is invalid for python-r2 suite"
-}
-
-python_get_library() {
-   die "${FUNCNAME}() is invalid for python-r2 suite"
-}
-
-python_get_version() {
-   die "${FUNCNAME}() is invalid for python-r2 suite"
-}
-
-python_get_implementation_and_version() {
-   die "${FUNCNAME}() is invalid for python-r2 suite"
-}
-
-python_execute_nosetests() {
-   die "$

[gentoo-dev] [PATCH 09/25] python-utils-r2.eclass: Mark python_is_installed private

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-any-r2.eclass   | 2 +-
 eclass/python-r2.eclass   | 2 +-
 eclass/python-utils-r2.eclass | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/eclass/python-any-r2.eclass b/eclass/python-any-r2.eclass
index 05e614ca4899..bedd4aa6cae1 100644
--- a/eclass/python-any-r2.eclass
+++ b/eclass/python-any-r2.eclass
@@ -259,7 +259,7 @@ _python_EPYTHON_supported() {
esac
 
if has "${i}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then
-   if python_is_installed "${i}"; then
+   if _python_is_installed "${i}"; then
if declare -f python_check_deps >/dev/null; then
local 
PYTHON_USEDEP="python_targets_${i}(-),python_single_target_${i}(+)"
python_check_deps
diff --git a/eclass/python-r2.eclass b/eclass/python-r2.eclass
index feb8229eb2c5..4dac2513c12b 100644
--- a/eclass/python-r2.eclass
+++ b/eclass/python-r2.eclass
@@ -720,7 +720,7 @@ python_setup() {
# if python_check_deps() is declared, switch into any-of mode
if [[ ${has_check_deps} ]]; then
# first check if the interpreter is installed
-   python_is_installed "${impl}" || continue
+   _python_is_installed "${impl}" || continue
# then run python_check_deps
local 
PYTHON_USEDEP="python_targets_${impl}(-),python_single_target_${impl}(+)"
python_check_deps || continue
diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index f0d8f366c050..bbd1802e3e7a 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -1059,14 +1059,15 @@ python_is_python3() {
[[ ${impl} == python3* || ${impl} == pypy3 ]]
 }
 
-# @FUNCTION: python_is_installed
+# @FUNCTION: _python_is_installed
 # @USAGE: []
+# @INTERNAL
 # @DESCRIPTION:
 # Check whether the interpreter for  (or ${EPYTHON}) is installed.
 # Uses has_version with a proper dependency string.
 #
 # Returns 0 (true) if it is, 1 (false) otherwise.
-python_is_installed() {
+_python_is_installed() {
local impl=${1:-${EPYTHON}}
[[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
local hasv_args=()
-- 
2.25.1




[gentoo-dev] [PATCH 08/25] python-utils-r2.eclass: Mark python_wrapper_setup private

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-any-r2.eclass| 8 
 eclass/python-r2.eclass| 4 ++--
 eclass/python-single-r2.eclass | 4 ++--
 eclass/python-utils-r2.eclass  | 5 +++--
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/eclass/python-any-r2.eclass b/eclass/python-any-r2.eclass
index cf70f23f69d5..05e614ca4899 100644
--- a/eclass/python-any-r2.eclass
+++ b/eclass/python-any-r2.eclass
@@ -296,7 +296,7 @@ python_setup() {
ewarn "Dependencies won't be satisfied, and 
EPYTHON/eselect-python will be ignored."
 
python_export "${impls[0]}" EPYTHON PYTHON
-   python_wrapper_setup
+   _python_wrapper_setup
return
fi
 
@@ -304,7 +304,7 @@ python_setup() {
if [[ ${EPYTHON} ]]; then
if _python_EPYTHON_supported "${EPYTHON}"; then
python_export EPYTHON PYTHON
-   python_wrapper_setup
+   _python_wrapper_setup
return
fi
fi
@@ -319,7 +319,7 @@ python_setup() {
break
elif _python_EPYTHON_supported "${i}"; then
python_export "${i}" EPYTHON PYTHON
-   python_wrapper_setup
+   _python_wrapper_setup
return
fi
done
@@ -329,7 +329,7 @@ python_setup() {
for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do
python_export "${_PYTHON_SUPPORTED_IMPLS[i]}" EPYTHON PYTHON
if _python_EPYTHON_supported "${EPYTHON}"; then
-   python_wrapper_setup
+   _python_wrapper_setup
return
fi
done
diff --git a/eclass/python-r2.eclass b/eclass/python-r2.eclass
index 1ebc424bc9b3..feb8229eb2c5 100644
--- a/eclass/python-r2.eclass
+++ b/eclass/python-r2.eclass
@@ -593,7 +593,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_wrapper_setup
+   _python_wrapper_setup
 
"${@}"
 }
@@ -739,7 +739,7 @@ python_setup() {
die "${FUNCNAME}: no enabled implementation satisfy 
requirements"
fi
 
-   python_wrapper_setup
+   _python_wrapper_setup
 }
 
 # @FUNCTION: python_replicate_script
diff --git a/eclass/python-single-r2.eclass b/eclass/python-single-r2.eclass
index 5bf6ea7221bc..fdb3438f0531 100644
--- a/eclass/python-single-r2.eclass
+++ b/eclass/python-single-r2.eclass
@@ -462,7 +462,7 @@ python_setup() {
ewarn "Dependencies won't be satisfied, and 
PYTHON_SINGLE_TARGET flags will be ignored."
 
python_export "${impls[0]}" EPYTHON PYTHON
-   python_wrapper_setup
+   _python_wrapper_setup
return
fi
 
@@ -479,7 +479,7 @@ python_setup() {
fi
 
python_export "${impl}" EPYTHON PYTHON
-   python_wrapper_setup
+   _python_wrapper_setup
fi
done
 
diff --git a/eclass/python-utils-r2.eclass b/eclass/python-utils-r2.eclass
index 1f904d035050..f0d8f366c050 100644
--- a/eclass/python-utils-r2.eclass
+++ b/eclass/python-utils-r2.eclass
@@ -943,8 +943,9 @@ python_doheader() {
)
 }
 
-# @FUNCTION: python_wrapper_setup
+# @FUNCTION: _python_wrapper_setup
 # @USAGE: [ []]
+# @INTERNAL
 # @DESCRIPTION:
 # Create proper 'python' executable and pkg-config wrappers
 # (if available) in the directory named by . Set up PATH
@@ -957,7 +958,7 @@ python_doheader() {
 # be assumed to contain proper wrappers already and only environment
 # setup will be done. If wrapper update is requested, the directory
 # shall be removed first.
-python_wrapper_setup() {
+_python_wrapper_setup() {
debug-print-function ${FUNCNAME} "${@}"
 
local workdir=${1:-${T}/${EPYTHON}}
-- 
2.25.1




[gentoo-dev] [PATCH 05/25] distutils-r2.eclass: Make all old QA warnings fatal

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/distutils-r2.eclass | 23 ---
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass
index 66df9e8f7272..1b3f9e89fc49 100644
--- a/eclass/distutils-r2.eclass
+++ b/eclass/distutils-r2.eclass
@@ -93,7 +93,6 @@ esac
 
 if [[ ! ${_DISTUTILS_R2} ]]; then
 
-[[ ${EAPI} == [456] ]] && inherit eutils
 [[ ${EAPI} == [56] ]] && inherit xdg-utils
 inherit multiprocessing toolchain-funcs
 
@@ -462,9 +461,10 @@ _distutils_verify_use_setuptools() {
local def=
[[ ${DISTUTILS_USE_SETUPTOOLS} == bdepend ]] && def=' 
(default?)'
 
-   eqawarn "DISTUTILS_USE_SETUPTOOLS value is probably 
incorrect"
-   eqawarn "  value:
DISTUTILS_USE_SETUPTOOLS=${DISTUTILS_USE_SETUPTOOLS}${def}"
-   eqawarn "  expected: 
DISTUTILS_USE_SETUPTOOLS=${expected}"
+   ewarn "DISTUTILS_USE_SETUPTOOLS value is probably 
incorrect"
+   ewarn "  value:
DISTUTILS_USE_SETUPTOOLS=${DISTUTILS_USE_SETUPTOOLS}${def}"
+   ewarn "  expected: DISTUTILS_USE_SETUPTOOLS=${expected}"
+   die "Incorrect DISTUTILS_USE_SETUPTOOLS"
fi
fi
 }
@@ -852,9 +852,7 @@ distutils-r2_python_install() {
${shopt_save}
 
if [[ -n ${pypy_dirs} ]]; then
-   local cmd=die
-   [[ ${EAPI} == [45] ]] && cmd=eqawarn
-   "${cmd}" "Package installs 'share' in PyPy prefix, see bug 
#465546."
+   die "Package installs 'share' in PyPy prefix, see bug #465546."
fi
 
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
@@ -1001,10 +999,7 @@ distutils-r2_src_prepare() {
fi
 
if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then
-   local cmd=die
-   [[ ${EAPI} == [45] ]] && cmd=eqawarn
-
-   "${cmd}" "QA: python_prepare_all() didn't call 
distutils-r2_python_prepare_all"
+   die "QA: python_prepare_all() didn't call 
distutils-r2_python_prepare_all"
fi
 
if declare -f python_prepare >/dev/null; then
@@ -1086,6 +1081,7 @@ _distutils-r2_check_namespace_pth() {
ewarn "the ebuild accordingly:"
ewarn
ewarn "  
https://wiki.gentoo.org/wiki/Project:Python/Namespace_packages";
+   die ".pth files installed"
fi
 }
 
@@ -1107,10 +1103,7 @@ distutils-r2_src_install() {
fi
 
if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then
-   local cmd=die
-   [[ ${EAPI} == [45] ]] && cmd=eqawarn
-
-   "${cmd}" "QA: python_install_all() didn't call 
distutils-r2_python_install_all"
+   die "QA: python_install_all() didn't call 
distutils-r2_python_install_all"
fi
 
_distutils-r2_check_namespace_pth
-- 
2.25.1




[gentoo-dev] [PATCH 06/25] python-r2.eclass: Remove python_gen_usedep

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/python-r2.eclass | 43 +
 1 file changed, 1 insertion(+), 42 deletions(-)

diff --git a/eclass/python-r2.eclass b/eclass/python-r2.eclass
index 8bf0b1a1ac29..1ebc424bc9b3 100644
--- a/eclass/python-r2.eclass
+++ b/eclass/python-r2.eclass
@@ -282,8 +282,7 @@ _python_validate_useflags() {
 # python_is_python3). Remember to escape or quote the fnmatch patterns
 # to prevent accidental shell filename expansion.
 #
-# This is an internal function used to implement python_gen_cond_dep
-# and deprecated python_gen_usedep.
+# This is an internal function used to implement python_gen_cond_dep.
 _python_gen_usedep() {
debug-print-function ${FUNCNAME} "${@}"
 
@@ -304,46 +303,6 @@ _python_gen_usedep() {
echo "${out// /,}"
 }
 
-# @FUNCTION: python_gen_usedep
-# @USAGE:  [...]
-# @DESCRIPTION:
-# DEPRECATED.  Please use python_gen_cond_dep instead.
-#
-# Output a USE dependency string for Python implementations which
-# are both in PYTHON_COMPAT and match any of the patterns passed
-# as parameters to the function.
-#
-# The patterns can be either fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate
-# appropriately all enabled Python 2/3 implementations (alike
-# python_is_python3). Remember to escape or quote the fnmatch patterns
-# to prevent accidental shell filename expansion.
-#
-# When all implementations are requested, please use ${PYTHON_USEDEP}
-# instead. Please also remember to set an appropriate REQUIRED_USE
-# to avoid ineffective USE flags.
-#
-# Example:
-# @CODE
-# PYTHON_COMPAT=( python{2_7,3_4} )
-# DEPEND="doc? ( dev-python/epydoc[$(python_gen_usedep 'python2*')] )"
-# @CODE
-#
-# It will cause the dependency to look like:
-# @CODE
-# DEPEND="doc? ( dev-python/epydoc[python_targets_python2_7?] )"
-# @CODE
-python_gen_usedep() {
-   debug-print-function ${FUNCNAME} "${@}"
-
-   # output only once, during some reasonable phase
-   # (avoid spamming cache regen runs)
-   if [[ ${EBUILD_PHASE} == setup ]]; then
-   eqawarn "python_gen_usedep() is deprecated. Please use 
python_gen_cond_dep instead."
-   fi
-   _python_gen_usedep "${@}"
-}
-
 # @FUNCTION: python_gen_useflags
 # @USAGE: [...]
 # @DESCRIPTION:
-- 
2.25.1




[gentoo-dev] [PATCH 04/25] distutils-r2.eclass: Remove distutils.eclass checks

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/distutils-r2.eclass | 34 --
 1 file changed, 34 deletions(-)

diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass
index cc555771a46c..66df9e8f7272 100644
--- a/eclass/distutils-r2.eclass
+++ b/eclass/distutils-r2.eclass
@@ -1116,39 +1116,5 @@ distutils-r2_src_install() {
_distutils-r2_check_namespace_pth
 }
 
-# -- distutils.eclass functions --
-
-distutils_get_intermediate_installation_image() {
-   die "${FUNCNAME}() is invalid for distutils-r2"
-}
-
-distutils_src_unpack() {
-   die "${FUNCNAME}() is invalid for distutils-r2, and you don't want it 
in EAPI ${EAPI} anyway"
-}
-
-distutils_src_prepare() {
-   die "${FUNCNAME}() is invalid for distutils-r2, you probably want: 
${FUNCNAME/_/-r2_}"
-}
-
-distutils_src_compile() {
-   die "${FUNCNAME}() is invalid for distutils-r2, you probably want: 
${FUNCNAME/_/-r2_}"
-}
-
-distutils_src_test() {
-   die "${FUNCNAME}() is invalid for distutils-r2, you probably want: 
${FUNCNAME/_/-r2_}"
-}
-
-distutils_src_install() {
-   die "${FUNCNAME}() is invalid for distutils-r2, you probably want: 
${FUNCNAME/_/-r2_}"
-}
-
-distutils_pkg_postinst() {
-   die "${FUNCNAME}() is invalid for distutils-r2, and pkg_postinst is 
unnecessary"
-}
-
-distutils_pkg_postrm() {
-   die "${FUNCNAME}() is invalid for distutils-r2, and pkg_postrm is 
unnecessary"
-}
-
 _DISTUTILS_R2=1
 fi
-- 
2.25.1




[gentoo-dev] [PATCH 03/25] distutils-r2.eclass: Remove no-op subphase defaults

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/distutils-r2.eclass | 18 --
 1 file changed, 18 deletions(-)

diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass
index ec1eda6682ae..cc555771a46c 100644
--- a/eclass/distutils-r2.eclass
+++ b/eclass/distutils-r2.eclass
@@ -623,24 +623,6 @@ distutils-r2_python_prepare_all() {
_DISTUTILS_DEFAULT_CALLED=1
 }
 
-# @FUNCTION: distutils-r2_python_prepare
-# @DESCRIPTION:
-# The default python_prepare(). A no-op.
-distutils-r2_python_prepare() {
-   debug-print-function ${FUNCNAME} "${@}"
-
-   [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI 6 (it was a 
no-op)"
-}
-
-# @FUNCTION: distutils-r2_python_configure
-# @DESCRIPTION:
-# The default python_configure(). A no-op.
-distutils-r2_python_configure() {
-   debug-print-function ${FUNCNAME} "${@}"
-
-   [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI 6 (it was a 
no-op)"
-}
-
 # @FUNCTION: _distutils-r2_create_setup_cfg
 # @INTERNAL
 # @DESCRIPTION:
-- 
2.25.1




[gentoo-dev] [PATCH 01/25] eclass: Copy python-r1 suite to python-r2

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/distutils-r2.eclass  | 1198 
 eclass/python-any-r2.eclass |  357 
 eclass/python-r2.eclass |  825 +
 eclass/python-single-r2.eclass  |  507 +++
 eclass/python-utils-r2.eclass   | 1518 +++
 eclass/tests/distutils-r2.sh|   98 ++
 eclass/tests/python-utils-r2.sh |  237 +
 7 files changed, 4740 insertions(+)
 create mode 100644 eclass/distutils-r2.eclass
 create mode 100644 eclass/python-any-r2.eclass
 create mode 100644 eclass/python-r2.eclass
 create mode 100644 eclass/python-single-r2.eclass
 create mode 100644 eclass/python-utils-r2.eclass
 create mode 100755 eclass/tests/distutils-r2.sh
 create mode 100755 eclass/tests/python-utils-r2.sh

diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass
new file mode 100644
index ..662bad3b9bcd
--- /dev/null
+++ b/eclass/distutils-r2.eclass
@@ -0,0 +1,1198 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: distutils-r2.eclass
+# @MAINTAINER:
+# Python team 
+# @AUTHOR:
+# Author: Michał Górny 
+# @SUPPORTED_EAPIS: 5 6 7
+# @BLURB: A simple eclass to build Python packages using distutils.
+# @DESCRIPTION:
+# A simple eclass providing functions to build Python packages using
+# the distutils build system. It exports phase functions for all
+# the src_* phases. Each of the phases runs two pseudo-phases:
+# python_..._all() (e.g. python_prepare_all()) once in ${S}, then
+# python_...() (e.g. python_prepare()) for each implementation
+# (see: python_foreach_impl() in python-r2).
+#
+# In distutils-r2_src_prepare(), the 'all' function is run before
+# per-implementation ones (because it creates the implementations),
+# per-implementation functions are run in a random order.
+#
+# In remaining phase functions, the per-implementation functions are run
+# before the 'all' one, and they are ordered from the least to the most
+# preferred implementation (so that 'better' files overwrite 'worse'
+# ones).
+#
+# If the ebuild doesn't specify a particular pseudo-phase function,
+# the default one will be used (distutils-r2_...). Defaults are provided
+# for all per-implementation pseudo-phases, python_prepare_all()
+# and python_install_all(); whenever writing your own pseudo-phase
+# functions, you should consider calling the defaults (and especially
+# distutils-r2_python_prepare_all).
+#
+# Please note that distutils-r2 sets RDEPEND and DEPEND unconditionally
+# for you.
+#
+# Also, please note that distutils-r2 will always inherit python-r2
+# as well. Thus, all the variables defined and documented there are
+# relevant to the packages using distutils-r2.
+
+case "${EAPI:-0}" in
+   0|1|2|3|4)
+   die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
+   ;;
+   5|6|7)
+   ;;
+   *)
+   die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+   ;;
+esac
+
+# @ECLASS-VARIABLE: DISTUTILS_OPTIONAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-null value, distutils part in the ebuild will
+# be considered optional. No dependencies will be added and no phase
+# functions will be exported.
+#
+# If you enable DISTUTILS_OPTIONAL, you have to set proper dependencies
+# for your package (using ${PYTHON_DEPS}) and to either call
+# distutils-r2 default phase functions or call the build system
+# manually.
+
+# @ECLASS-VARIABLE: DISTUTILS_SINGLE_IMPL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-null value, the ebuild will support setting a single
+# Python implementation only. It will effectively replace the python-r2
+# eclass inherit with python-single-r2.
+#
+# Note that inheriting python-single-r2 will cause pkg_setup()
+# to be exported. It must be run in order for the eclass functions
+# to function properly.
+
+# @ECLASS-VARIABLE: DISTUTILS_USE_SETUPTOOLS
+# @PRE_INHERIT
+# @DESCRIPTION:
+# Controls adding dev-python/setuptools dependency.  The allowed values
+# are:
+#
+# - no -- do not add the dependency (pure distutils package)
+# - bdepend -- add it to BDEPEND (the default)
+# - rdepend -- add it to BDEPEND+RDEPEND (when using entry_points)
+# - pyproject.toml -- use pyproject2setuptools to install a project
+# using pyproject.toml (flit, poetry...)
+# - manual -- do not add the depedency and suppress the checks
+# (assumes you will take care of doing it correctly)
+#
+# This variable is effective only if DISTUTILS_OPTIONAL is disabled.
+# It needs to be set before the inherit line.
+: ${DISTUTILS_USE_SETUPTOOLS:=bdepend}
+
+if [[ ! ${_DISTUTILS_R2} ]]; then
+
+[[ ${EAPI} == [456] ]] && inherit eutils
+[[ ${EAPI} == [56] ]] && inherit xdg-utils
+inherit multiprocessing toolchain-funcs
+
+if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+   inherit python-r2
+else
+   inherit python-single-r2
+fi
+
+fi
+
+if [[ 

[gentoo-dev] [PATCH 02/25] distutils-r2.eclass: Remove EXAMPLES

2020-02-29 Thread Michał Górny
Signed-off-by: Michał Górny 
---
 eclass/distutils-r2.eclass | 28 +---
 1 file changed, 1 insertion(+), 27 deletions(-)

diff --git a/eclass/distutils-r2.eclass b/eclass/distutils-r2.eclass
index 662bad3b9bcd..ec1eda6682ae 100644
--- a/eclass/distutils-r2.eclass
+++ b/eclass/distutils-r2.eclass
@@ -198,26 +198,6 @@ unset -f _distutils_set_globals
 # HTML_DOCS=( doc/html/. )
 # @CODE
 
-# @ECLASS-VARIABLE: EXAMPLES
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# OBSOLETE: this variable is deprecated and banned in EAPI 6
-#
-# An array containing examples installed into 'examples' doc
-# subdirectory. The files and directories listed there must exist
-# in the directory from which distutils-r2_python_install_all() is run
-# (${S} by default).
-#
-# The 'examples' subdirectory will be marked not to be compressed
-# automatically.
-#
-# If unset, no examples will be installed.
-#
-# Example:
-# @CODE
-# EXAMPLES=( examples/. demos/. )
-# @CODE
-
 # @ECLASS-VARIABLE: DISTUTILS_IN_SOURCE_BUILD
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -910,13 +890,7 @@ distutils-r2_python_install_all() {
einstalldocs
 
if declare -p EXAMPLES &>/dev/null; then
-   [[ ${EAPI} != [45] ]] && die "EXAMPLES are banned in EAPI 
${EAPI}"
-
-   (
-   docinto examples
-   dodoc -r "${EXAMPLES[@]}"
-   )
-   docompress -x "/usr/share/doc/${PF}/examples"
+   die "EXAMPLES are no longer supported in distutils-r2"
fi
 
_DISTUTILS_DEFAULT_CALLED=1
-- 
2.25.1




[gentoo-dev] [PATCH 00/25] python-r2 eclass suite

2020-02-29 Thread Michał Górny
Hello,

Here's a first proposed version of python-r2 suite.  This aims to switch
the eclasses into more proactive versioning model over deprecating
and removing API in place.  The main idea is that for the majority
of ebuilds (and especially those that do not trigger QA warnings right
now), the migration should be as simple as applying a few sed patterns.

Another implication of this model is that I'm going to provide a simple
conversion script once the eclasses are ready.  While it won't be able
to fix all possible issues, it should be able to fix the common renames,
and catch the removed bits.

The list of changes included so far:

- all deprecated things (read: those triggering deprecation warnings)
  have been removed or explicitly banned

- python.eclass / distutils.eclass failed migration checks have been
  removed

- some functions were explicitly made internal:

  a. python_wrapper_setup -- called by python_setup

  b. python_is_installed -- used by any-r1 python_setup

  c. python_export -- some bits are used only internally, others are now
  available via python_get* only

- multi-impl eclass is now called python-multi-r2, to stop confusing
  people into using it

- distutils-r1 now passes --skip-build to install phase

- in python-single-r1, PYTHON_MULTI_USEDEP has been renamed back
  to PYTHON_USEDEP, for consistency between eclasses
  (PYTHON_SINGLE_USEDEP is still a thing)

I'm open to further suggestions.

-- 
Best regards,
Michał Górny

Michał Górny (25):
  eclass: Copy python-r1 suite to python-r2
  distutils-r2.eclass: Remove EXAMPLES
  distutils-r2.eclass: Remove no-op subphase defaults
  distutils-r2.eclass: Remove distutils.eclass checks
  distutils-r2.eclass: Make all old QA warnings fatal
  python-r2.eclass: Remove python_gen_usedep
  python-utils-r2.eclass: Remove python.eclass checks
  python-utils-r2.eclass: Mark python_wrapper_setup private
  python-utils-r2.eclass: Mark python_is_installed private
  python-utils-r2.eclass: Add missing @INTERNAL to private func
  python-utils-r2.eclass: Fix obsolete docs on python_export_best
  python-utils-r2.eclass: Mark python_export private
  python-utils-r2.eclass: Remove PYTHON_SITEDIR export
  python-utils-r2.eclass: Remove PYTHON_INCLUDEDIR export
  python-utils-r2.eclass: Remove PYTHON_LIBPATH export
  python-utils-r2.eclass: Remove PYTHON_CFLAGS export
  python-utils-r2.eclass: Remove PYTHON_LIBS export
  python-utils-r2.eclass: Remove PYTHON_CONFIG export
  python-utils-r2.eclass: Remove PYTHON_SCRIPTDIR export
  python-single-r2.eclass: PYTHON_MULTI_USEDEP → PYTHON_USEDEP
  distutils-r2.eclass: Pass --skip-build to install
  eclass: python-r2.eclass → python-multi-r2.eclass
  python-any-r2.eclass: Verbosely report used implementation
  python-single-r2.eclass: Report used impl verbosely
  python-multi-r2.eclass: Report python_setup impl verbosely

 eclass/distutils-r2.eclass  | 1112 +
 eclass/python-any-r2.eclass |  360 ++
 eclass/python-multi-r2.eclass   |  783 
 eclass/python-single-r2.eclass  |  509 +
 eclass/python-utils-r2.eclass   | 1191 +++
 eclass/tests/distutils-r2.sh|   98 +++
 eclass/tests/python-utils-r2.sh |  250 +++
 7 files changed, 4303 insertions(+)
 create mode 100644 eclass/distutils-r2.eclass
 create mode 100644 eclass/python-any-r2.eclass
 create mode 100644 eclass/python-multi-r2.eclass
 create mode 100644 eclass/python-single-r2.eclass
 create mode 100644 eclass/python-utils-r2.eclass
 create mode 100755 eclass/tests/distutils-r2.sh
 create mode 100755 eclass/tests/python-utils-r2.sh

-- 
2.25.1




Re: [gentoo-dev] Package up for grab: app-crypt/scute

2020-02-29 Thread David Seifert
On Sat, 2020-02-29 at 08:53 +0200, Joonas Niilola wrote:
> app-crypt/scute up for grabs due to retirement of a proxy-maintainer. One bug
> open requesting a version bump. 
> 
> 
> 
> -- juippis

I'll take this.