commit:     627a63a27f3b1a37ce3f2800c1d70ea2c9ecd882
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue May 31 08:15:08 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jun  7 06:53:44 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=627a63a2

python-utils-r1.eclass: Strip stray *-pytest-*.pyc files in epytest

The test suites of pytest plugins cause additional *-pytest-*.pyc files
to be created.  Remove them in order to prevent them from being
installed alongside the package.

Closes: https://bugs.gentoo.org/847235
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/python-utils-r1.eclass | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 67dc5bf754d6..9eb068d3b13f 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1318,6 +1318,11 @@ epytest() {
 
        # remove common temporary directories left over by pytest plugins
        rm -rf .hypothesis .pytest_cache || die
+       # pytest plugins create additional .pyc files while testing
+       # see e.g. https://bugs.gentoo.org/847235
+       if [[ -n ${BUILD_DIR} && -d ${BUILD_DIR} ]]; then
+               find "${BUILD_DIR}" -name '*-pytest-*.pyc' -delete || die
+       fi
 
        return ${ret}
 }

Reply via email to