From 7bc9c63c9da678a7e6fceb095d56c634afd22c56 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 15 Dec 2019 18:09:03 +0000 Subject: gentoo resync : 15.12.2019 --- eclass/python-utils-r1.eclass | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'eclass/python-utils-r1.eclass') diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 647eb04344d2..3eadc50f93e6 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -164,11 +164,12 @@ _python_set_impls() { } # @FUNCTION: _python_impl_matches -# @USAGE: ... +# @USAGE: [...] # @INTERNAL # @DESCRIPTION: # Check whether the specified matches at least one # of the patterns following it. Return 0 if it does, 1 otherwise. +# Matches if no patterns are provided. # # can be in PYTHON_COMPAT or EPYTHON form. The patterns can be # either: @@ -176,17 +177,17 @@ _python_set_impls() { # b) '-2' to indicate all Python 2 variants (= !python_is_python3) # c) '-3' to indicate all Python 3 variants (= python_is_python3) _python_impl_matches() { - [[ ${#} -ge 2 ]] || die "${FUNCNAME}: takes at least 2 parameters" + [[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter" + [[ ${#} -eq 1 ]] && return 0 local impl=${1} pattern shift for pattern; do if [[ ${pattern} == -2 ]]; then - ! python_is_python3 "${impl}" - return + python_is_python3 "${impl}" || return 0 elif [[ ${pattern} == -3 ]]; then - python_is_python3 "${impl}" + python_is_python3 "${impl}" && return 0 return # unify value style to allow lax matching elif [[ ${impl/./_} == ${pattern/./_} ]]; then @@ -1344,6 +1345,31 @@ python_export_utf8_locale() { return 0 } +# @FUNCTION: build_sphinx +# @USAGE: +# @DESCRIPTION: +# Build HTML documentation using dev-python/sphinx in the specified +# . Takes care of disabling Intersphinx and appending +# to HTML_DOCS. +# +# If is relative to the current directory, care needs +# to be taken to run einstalldocs from the same directory +# (usually ${S}). +build_sphinx() { + debug-print-function ${FUNCNAME} "${@}" + [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes 1 arg: " + + local dir=${1} + + sed -i -e 's:^intersphinx_mapping:disabled_&:' \ + "${dir}"/conf.py || die + # not all packages include the Makefile in pypi tarball + sphinx-build -b html -d "${dir}"/_build/doctrees "${dir}" \ + "${dir}"/_build/html || die + + HTML_DOCS+=( "${dir}/_build/html/." ) +} + # -- python.eclass functions -- _python_check_dead_variables() { -- cgit v1.2.3