• Re: [gentoo-dev] [PATCH 1/2] distutils-r1.eclass: Prefer "rm -rf build"

    From Ionen Wolkens@21:1/5 to Alexey Sokolov on Sun Apr 17 13:00:01 2022
    On Sun, Apr 17, 2022 at 11:42:35AM +0100, Alexey Sokolov wrote:
    09.04.2022 17:37, Michał Górny пишет:
    + if [[ ${GPEP517_TESTING} ]]; then
    + rm -rf build || die
    + else
    + esetup.py clean -a
    + fi
    fi
    }


    rm -r build || die

    -f makes it not fail, which makes ||die useless

    -f mostly just means it wont error out if the directory is missing
    which I believe is what is wanted here (this covers a lot of packages
    so there's less certainty than in an ebuild). Then rm could fail for
    other reasons such as failure to call the command, or directory not
    being removable (like no permission to), so should still || die

    --
    ionen

    -----BEGIN PGP SIGNATURE-----

    iQEzBAABCAAdFiEEx3SLh1HBoPy/yLVYskQGsLCsQzQFAmJb8xoACgkQskQGsLCs QzTCxgf/X5n4yw6xknJPLEHEpgbN3kWneqTxZBrggFn6XrOfEuPNa7l/wBsfT3On iq61kjQM3SJlfD9oPtpIu6gmCWqAi3l8qbDVcmO85DNdKQDvnOF+niYdNBxSGNQz kUTgEsKQSJvZ1uslnBuoUZf92ak58bTPqMWXq/g35x8uZEwxvp4fffAIwM8K52Qf RN08mPx6iOS8kxxuizMzIcOVVzKM1a8eOan4XcieNf1al+ZCkoTOpY0Bq2ABHe7P A1kDMcPB/ecIZbYrcp3vCduA8gdLF9qEx6eE63LJIKaW5hV4rzUkjHOP6V7kYu9G 7Hwn1mfMcKHqF+z9l28z7sITkEIf4A==
    =HNMD
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Alexey Sokolov@21:1/5 to All on Sun Apr 17 12:50:01 2022
    09.04.2022 17:37, Michał Górny пишет:
    Prefer using "rm -rf build" directly over "setup.py clean -a". This
    has three advantages:

    1. It is much faster.

    2. It works on packages that have broken "setup.py clean",
    e.g. dev-python/pydantic.

    3. It works on packages that block "setup.py clean" and tell you to use
    "git clean" (sic!), e.g. dev-python/scipy.

    This is a potentially (but unlikely) breaking change, so do it
    conditionally to GPEP517_TESTING.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 6 +++++-
    1 file changed, 5 insertions(+), 1 deletion(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index de891215e688..e6b0ab5e0e32 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -1090,7 +1090,11 @@ distutils_pep517_install() {
    # clean the build tree; otherwise we may end up with PyPy3
    # extensions duplicated into CPython dists
    if [[ ${DISTUTILS_USE_PEP517:-setuptools} == setuptools ]]; then
    - esetup.py clean -a
    + if [[ ${GPEP517_TESTING} ]]; then
    + rm -rf build || die
    + else
    + esetup.py clean -a
    + fi
    fi
    }


    rm -r build || die

    -f makes it not fail, which makes ||die useless

    --
    Best regards,
    Alexey "DarthGandalf" Sokolov

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)