• [gentoo-dev] [PATCH 10/18] python-utils-r1.eclass: Support python_domod

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Sat Jun 4 11:10:01 2022
    Make it possible to use python_domodule() outside src_install(),
    in order to install files into the ${BUILD_DIR}/install tree used
    by distutils-r1.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-utils-r1.eclass | 29 ++++++++++++++++++++++-------
    1 file changed, 22 insertions(+), 7 deletions(-)

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index b3c249dfa694..fd04cf374ce4 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -832,6 +832,10 @@ python_moduleinto() {
    # and packages (directories). All listed files will be installed
    # for all enabled implementations, and compiled afterwards.
    #
    +# The files are installed into ${D} when run in src_install() phase.
    +# Otherwise, they are installed into ${BUILD_DIR}/install location
    +# that is suitable for picking up by distutils-r1 in PEP517 mode.
    +#
    # Example:
    # @CODE
    # src_install() {
    @@ -854,13 +858,24 @@ python_domodule() {
    d=${sitedir#${EPREFIX}}/${_PYTHON_MODULEROOT//.//}
    fi

    - (
    - insopts -m 0644
    - insinto "${d}"
    - doins -r "${@}" || return ${?}
    - )
    -
    - python_optimize "${ED%/}/${d}"
    + if [[ ${EBUILD_PHASE} == install ]]; then
    + (