gentoo-ebuilds/dev-build/gyp/gyp-99999999999999.ebuild
Sam James 6cc9b02ac6
dev-build/gyp: port to python-single-r1
The package isn't suitable for PEP517, as it installs data files and
it simply happens to be written in Python, rather than intending to be
imported and so on.

Unfortunately, for the remaining PEP517 holdouts, there's little pressure
upstream for them to port to a proper build system yet, as while setuptools
deprecated the `setup.py` entrypoint some time ago, there's no removal
in sight yet, so the only pressing side is on Gentoo's where we want
to cleanup distutils-r1's support for that.

It was arguably a mistake to really have these packages use distutils-r1
in the first place.

The obvious workaround for now is to invoke setup.py manually w/ python-single-r1,
and punt the question until setuptools removal of the entrypoint looks
closer (at which time, other distros will be putting pressure on upstreams
too). Of course, if at the time of such a setuptools change, the package
is still not fixed, then we'd have to remove it.

(The same issues apply to bug #922396 which isn't fixed by this, but
hopefully won't be an actual problem until that aforementioned removal
in setuptools itself of the other bits.)

Bug: https://bugs.gentoo.org/922396
Closes: https://bugs.gentoo.org/909980
Closes: https://bugs.gentoo.org/923435
Closes: https://bugs.gentoo.org/952274
Signed-off-by: Sam James <sam@gentoo.org>
2025-03-31 18:32:00 +01:00

67 lines
1.8 KiB
Bash

# Copyright 2017-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
inherit edo python-single-r1
DESCRIPTION="GYP (Generate Your Projects) meta-build system"
HOMEPAGE="https://gyp.gsrc.io/ https://chromium.googlesource.com/external/gyp"
if [[ ${PV} == 99999999999999 ]]; then
EGIT_REPO_URI="https://chromium.googlesource.com/external/gyp"
inherit git-r3
else
SRC_URI="https://home.apache.org/~arfrever/distfiles/${P}.tar.xz"
KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~x86"
fi
LICENSE="BSD"
SLOT="0"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
# Needs review after updating to a newer commit
RESTRICT="test"
RDEPEND="${PYTHON_DEPS}"
BDEPEND="
$(python_gen_cond_dep '
dev-python/setuptools[${PYTHON_USEDEP}]
')
"
src_prepare() {
default
sed -e "s/' Linux %s' % ' '\.join(platform.linux_distribution())/' Linux'/" -i gyptest.py || die
sed \
-e "s/import collections/import collections.abc/" \
-e "s/collections\.MutableSet/collections.abc.MutableSet/" \
-i pylib/gyp/common.py || die
sed -e "s/the_dict_key is 'variables'/the_dict_key == 'variables'/" -i pylib/gyp/input.py || die
sed \
-e "s/import collections/import collections.abc/" \
-e "s/collections\.Iterable/collections.abc.Iterable/" \
-i pylib/gyp/msvs_emulation.py || die
sed \
-e "s/os\.environ\['PRESERVE'\] is not ''/os.environ['PRESERVE'] != ''/" \
-e "s/conditions is ()/conditions == ()/" \
-i test/lib/TestCmd.py || die
}
src_compile() {
edo ${EPYTHON} setup.py build
}
src_test() {
# More errors with DeprecationWarnings enabled.
local -x PYTHONWARNINGS=""
edo "${PYTHON}" gyptest.py --all --verbose
}
src_install() {
edo ${EPYTHON} setup.py install --prefix="${EPREFIX}/usr" --root="${D}"
python_optimize
einstalldocs
}