From c01c3cbddc8ea0575bbea41b644f14704fff7741 Mon Sep 17 00:00:00 2001
From: Michał Górny python_foreach_impl
function is used to repeat the install step
for all enabled implementations.
For simple use cases, the install command can be inlined:
- # Copyright 1999-2020 Gentoo Foundation
- # Distributed under the terms of the GNU General Public License v2
+ # Copyright 1999-2020 Gentoo Foundation
+ # Distributed under the terms of the GNU General Public License v2
- EAPI=7
+ EAPI=7
- PYTHON_COMPAT=( python2_7 )
- inherit python-r1
+ PYTHON_COMPAT=( python2_7 )
+ inherit python-r1
- DESCRIPTION="MySQL abstraction layer for python"
- HOMEPAGE="http://software.fionet.com/pSQL/"
- SRC_URI="http://software.fionet.com/pSQL/release/${P}.tar.gz"
-
- SLOT="0"
- LICENSE="GPL-2"
- KEYWORDS="~amd64 ~x86"
- IUSE=""
- REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+ DESCRIPTION="MySQL abstraction layer for python"
+ HOMEPAGE="http://software.fionet.com/pSQL/"
+ SRC_URI="http://software.fionet.com/pSQL/release/${P}.tar.gz"
+
+ SLOT="0"
+ LICENSE="GPL-2"
+ KEYWORDS="~amd64 ~x86"
+ IUSE=""
+ REQUIRED_USE="${PYTHON_REQUIRED_USE}"
- RDEPEND="${PYTHON_DEPS}"
- DEPEND="${RDEPEND}"
+ RDEPEND="${PYTHON_DEPS}"
+ DEPEND="${RDEPEND}"
- src_install() {
- python_foreach_impl python_domodule pSQL.py
- }
+ src_install() {
+ python_foreach_impl python_domodule pSQL.py
+ }
While python_foreach_impl
can be repeated multiple times, it is
generally better to declare a function when multiple install commands
need to be executed:
- # Copyright 1999-2020 Gentoo Authors
- # Distributed under the terms of the GNU General Public License v2
+ # Copyright 1999-2020 Gentoo Authors
+ # Distributed under the terms of the GNU General Public License v2
- EAPI=7
+ EAPI=7
- PYTHON_COMPAT=( python2_7 )
- inherit python-r1
+ PYTHON_COMPAT=( python2_7 )
+ inherit python-r1
- DESCRIPTION="Proxy cache for Gentoo packages"
- HOMEPAGE="https://sourceforge.net/projects/http-replicator"
- SRC_URI="mirror://sourceforge/${PN}/${P}.tgz"
+ DESCRIPTION="Proxy cache for Gentoo packages"
+ HOMEPAGE="https://sourceforge.net/projects/http-replicator"
+ SRC_URI="mirror://sourceforge/${PN}/${P}.tgz"
- LICENSE="GPL-2"
- SLOT="0"
- KEYWORDS="~alpha amd64 hppa ppc ~sparc x86"
- IUSE=""
- REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+ LICENSE="GPL-2"
+ SLOT="0"
+ KEYWORDS="~alpha amd64 hppa ppc ~sparc x86"
+ IUSE=""
+ REQUIRED_USE="${PYTHON_REQUIRED_USE}"
- RDEPEND="${PYTHON_DEPS}"
- DEPEND="${RDEPEND}"
+ RDEPEND="${PYTHON_DEPS}"
+ DEPEND="${RDEPEND}"
- python_install() {
- python_doscript http-replicator
- python_domodule *.py
- }
+ python_install() {
+ python_doscript http-replicator
+ python_domodule *.py
+ }
- src_install() {
- python_foreach_impl python_install
- }
+ src_install() {
+ python_foreach_impl python_install
+ }
@@ -118,7 +115,7 @@ declared in order to ensure that the dependencies would be built against
all the Python implementations enabled for the package. This is easily
done via appending the USE dependency string from ${PYTHON_USEDEP}
to the dependencies:
-RDEPEND="${PYTHON_DEPS}
+RDEPEND="${PYTHON_DEPS}
sys-apps/portage[${PYTHON_USEDEP}]
"
DEPEND="${RDEPEND}"
@@ -132,53 +129,53 @@ with a non-standard build system. In this case, it is generally
necessary to call phase functions via python_foreach_impl
. Whenever
possible, out-of-source builds are recommended (i.e. installing to
separate directories from a single source directory).
- # Copyright 1999-2020 Gentoo Authors
- # Distributed under the terms of the GNU General Public License v2
+ # Copyright 1999-2020 Gentoo Authors
+ # Distributed under the terms of the GNU General Public License v2
- EAPI="6"
- PYTHON_COMPAT=( python3_6 )
+ EAPI="6"
+ PYTHON_COMPAT=( python3_6 )
- inherit autotools python-r1
+ inherit autotools python-r1
- DESCRIPTION="Python wrapper for libcangjie"
- HOMEPAGE="http://cangjians.github.io/"
- SRC_URI="https://github.com/Cangjians/py${PN}/releases/download/v${PV}/${P#py}.tar.xz"
+ DESCRIPTION="Python wrapper for libcangjie"
+ HOMEPAGE="http://cangjians.github.io/"
+ SRC_URI="https://github.com/Cangjians/py${PN}/releases/download/v${PV}/${P#py}.tar.xz"
- LICENSE="LGPL-3+"
- SLOT="0"
- KEYWORDS="~amd64 ~x86"
- IUSE=""
- REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+ LICENSE="LGPL-3+"
+ SLOT="0"
+ KEYWORDS="~amd64 ~x86"
+ IUSE=""
+ REQUIRED_USE="${PYTHON_REQUIRED_USE}"
- RDEPEND="${PYTHON_DEPS}
+ RDEPEND="${PYTHON_DEPS}
app-i18n/libcangjie"
- DEPEND="${RDEPEND}
+ DEPEND="${RDEPEND}
dev-python/cython[${PYTHON_USEDEP}]
virtual/pkgconfig"
- src_prepare() {
- default
- eautoreconf
- }
-
- src_configure() {
- local ECONF_SOURCE=${S}
- python_foreach_impl run_in_build_dir default
- }
-
- src_compile() {
- python_foreach_impl run_in_build_dir default
- }
-
- src_test() {
- python_foreach_impl run_in_build_dir default
- }
-
- src_install() {
- python_foreach_impl run_in_build_dir default
- einstalldocs
- find "${D}" -name '*.la' -delete || die
- }
+ src_prepare() {
+ default
+ eautoreconf
+ }
+
+ src_configure() {
+ local ECONF_SOURCE=${S}
+ python_foreach_impl run_in_build_dir default
+ }
+
+ src_compile() {
+ python_foreach_impl run_in_build_dir default
+ }
+
+ src_test() {
+ python_foreach_impl run_in_build_dir default
+ }
+
+ src_install() {
+ python_foreach_impl run_in_build_dir default
+ einstalldocs
+ find "${D}" -name '*.la' -delete || die
+ }
Note the use of run_in_build_dir
helper from multibuild
eclass
@@ -198,53 +195,53 @@ afterwards.
can be used to duplicate the package’s sources in build directories
for each implementation. The same ebuild easily can be changed
to do that:
- # Copyright 1999-2020 Gentoo Authors
- # Distributed under the terms of the GNU General Public License v2
+ # Copyright 1999-2020 Gentoo Authors
+ # Distributed under the terms of the GNU General Public License v2
- EAPI="6"
- PYTHON_COMPAT=( python3_6 )
+ EAPI="6"
+ PYTHON_COMPAT=( python3_6 )
- inherit autotools python-r1
+ inherit autotools python-r1
- DESCRIPTION="Python wrapper for libcangjie"
- HOMEPAGE="http://cangjians.github.io/"
- SRC_URI="https://github.com/Cangjians/py${PN}/releases/download/v${PV}/${P#py}.tar.xz"
+ DESCRIPTION="Python wrapper for libcangjie"
+ HOMEPAGE="http://cangjians.github.io/"
+ SRC_URI="https://github.com/Cangjians/py${PN}/releases/download/v${PV}/${P#py}.tar.xz"
- LICENSE="LGPL-3+"
- SLOT="0"
- KEYWORDS="~amd64 ~x86"
- IUSE=""
- REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+ LICENSE="LGPL-3+"
+ SLOT="0"
+ KEYWORDS="~amd64 ~x86"
+ IUSE=""
+ REQUIRED_USE="${PYTHON_REQUIRED_USE}"
- RDEPEND="${PYTHON_DEPS}
+ RDEPEND="${PYTHON_DEPS}
app-i18n/libcangjie"
- DEPEND="${RDEPEND}
+ DEPEND="${RDEPEND}
dev-python/cython[${PYTHON_USEDEP}]
virtual/pkgconfig"
- src_prepare() {
- default
- eautoreconf
- python_copy_sources
- }
-
- src_configure() {
- python_foreach_impl run_in_build_dir default
- }
-
- src_compile() {
- python_foreach_impl run_in_build_dir default
- }
-
- src_test() {
- python_foreach_impl run_in_build_dir default
- }
-
- src_install() {
- python_foreach_impl run_in_build_dir default
- einstalldocs
- find "${D}" -name '*.la' -delete || die
- }
+ src_prepare() {
+ default
+ eautoreconf
+ python_copy_sources
+ }
+
+ src_configure() {
+ python_foreach_impl run_in_build_dir default
+ }
+
+ src_compile() {
+ python_foreach_impl run_in_build_dir default
+ }
+
+ src_test() {
+ python_foreach_impl run_in_build_dir default
+ }
+
+ src_install() {
+ python_foreach_impl run_in_build_dir default
+ einstalldocs
+ find "${D}" -name '*.la' -delete || die
+ }
Note that besides adding python_copy_sources
call, ECONF_SOURCE
@@ -255,55 +252,55 @@ has been removed in order to disable out-of-source builds.
When the package installs Python components conditionally to a USE flag,
the respective USE conditional needs to be consistently used in metadata
variables and in python_foreach_impl
calls.
- # Copyright 1999-2020 Gentoo Authors
- # Distributed under the terms of the GNU General Public License v2
+ # Copyright 1999-2020 Gentoo Authors
+ # Distributed under the terms of the GNU General Public License v2
- EAPI=6
- PYTHON_COMPAT=( python2_7 )
+ EAPI=6
+ PYTHON_COMPAT=( python2_7 )
- inherit gnome2 python-r1
+ inherit gnome2 python-r1
- DESCRIPTION="Canvas widget for GTK+ using the cairo 2D library for drawing"
- HOMEPAGE="https://wiki.gnome.org/GooCanvas"
+ DESCRIPTION="Canvas widget for GTK+ using the cairo 2D library for drawing"
+ HOMEPAGE="https://wiki.gnome.org/GooCanvas"
- LICENSE="LGPL-2"
- SLOT="2.0"
- KEYWORDS="~alpha amd64 ia64 ppc ppc64 sparc x86"
- IUSE="python"
- REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+ LICENSE="LGPL-2"
+ SLOT="2.0"
+ KEYWORDS="~alpha amd64 ia64 ppc ppc64 sparc x86"
+ IUSE="python"
+ REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
- # python only enables python specific binding override
- RDEPEND="
+ # python only enables python specific binding override
+ RDEPEND="
python? (
- ${PYTHON_DEPS}
+ ${PYTHON_DEPS}
>=dev-python/pygobject-2.90.4:3[${PYTHON_USEDEP}] )
"
- DEPEND="${RDEPEND}"
-
- src_prepare() {
- # Python bindings are built/installed manually.
- sed -e "/SUBDIRS = python/d" -i bindings/Makefile.am \
- bindings/Makefile.in || die
-
- gnome2_src_prepare
- }
-
- src_configure() {
- gnome2_src_configure \
- --disable-python
- }
-
- src_install() {
- gnome2_src_install
-
- if use python; then
- sub_install() {
- python_moduleinto $(python -c "import gi;print gi._overridesdir")
- python_domodule bindings/python/GooCanvas.py
- }
- python_foreach_impl sub_install
- fi
- }
+ DEPEND="${RDEPEND}"
+
+ src_prepare() {
+ # Python bindings are built/installed manually.
+ sed -e "/SUBDIRS = python/d" -i bindings/Makefile.am \
+ bindings/Makefile.in || die
+
+ gnome2_src_prepare
+ }
+
+ src_configure() {
+ gnome2_src_configure \
+ --disable-python
+ }
+
+ src_install() {
+ gnome2_src_install
+
+ if use python; then
+ sub_install() {
+ python_moduleinto $(python -c "import gi;print gi._overridesdir")
+ python_domodule bindings/python/GooCanvas.py
+ }
+ python_foreach_impl sub_install
+ fi
+ }
Note that in many cases, you will end up having to disable upstream
@@ -322,47 +319,47 @@ the routine requiring Python. It will choose the most preferred
of enabled implementations, and set the global environment for it. Note
that it is entirely normal that the same environment will be set inside
python_foreach_impl
afterwards.
- 1 # Copyright 1999-2020 Gentoo Authors
- 2 # Distributed under the terms of the GNU General Public License v2
+ 1 # Copyright 1999-2020 Gentoo Authors
+ 2 # Distributed under the terms of the GNU General Public License v2
3
- 4 EAPI="7"
+ 4 EAPI="7"
5
- 6 PYTHON_COMPAT=( python{3_6,3_7} )
- 7 PYTHON_REQ_USE="ncurses,readline"
- 8 inherit python-r1
+ 6 PYTHON_COMPAT=( python{3_6,3_7} )
+ 7 PYTHON_REQ_USE="ncurses,readline"
+ 8 inherit python-r1
9
-10 DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
-11 HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
-12 SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.xz"
+10 DESCRIPTION="QEMU + Kernel-based Virtual Machine userland tools"
+11 HOMEPAGE="http://www.qemu.org http://www.linux-kvm.org"
+12 SRC_URI="http://wiki.qemu-project.org/download/${P}.tar.xz"
13
-14 LICENSE="GPL-2 LGPL-2 BSD-2"
-15 SLOT="0"
-16 KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86"
-17 IUSE="python"
-18 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+14 LICENSE="GPL-2 LGPL-2 BSD-2"
+15 SLOT="0"
+16 KEYWORDS="amd64 ~arm64 ~ppc ~ppc64 x86"
+17 IUSE="python"
+18 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
19
-20 BDEPEND="${PYTHON_DEPS}"
-21 RDEPEND="python? ( ${PYTHON_DEPS} )"
+20 BDEPEND="${PYTHON_DEPS}"
+21 RDEPEND="python? ( ${PYTHON_DEPS} )"
22
-23 src_configure() {
-24 python_setup
-25 ./configure || die
-26 }
+23 src_configure() {
+24 python_setup
+25 ./configure || die
+26 }
27
-28 qemu_python_install() {
-29 python_domodule "${S}/python/qemu"
+28 qemu_python_install() {
+29 python_domodule "${S}/python/qemu"
30
-31 python_doscript "${S}/scripts/kvm/vmxcap"
-32 python_doscript "${S}/scripts/qmp/qmp-shell"
-33 python_doscript "${S}/scripts/qmp/qemu-ga-client"
-34 }
+31 python_doscript "${S}/scripts/kvm/vmxcap"
+32 python_doscript "${S}/scripts/qmp/qmp-shell"
+33 python_doscript "${S}/scripts/qmp/qemu-ga-client"
+34 }
35
-36 src_install() {
-37 default
-38 if use python; then
-39 python_foreach_impl qemu_python_install
-40 fi
-41 }
+36 src_install() {
+37 default
+38 if use python; then
+39 python_foreach_impl qemu_python_install
+40 fi
+41 }
Note that the parts affecting installation of runtime components
@@ -456,7 +453,7 @@ flag, while parts affecting build time (Sphinx 5.3.0
+ Powered by Sphinx 6.1.3
& Alabaster 0.7.12
|
--
cgit v1.2.3-65-gdbad