* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2011-05-05 21:11 Ladislav Láska
0 siblings, 0 replies; 33+ messages in thread
From: Ladislav Láska @ 2011-05-05 21:11 UTC (permalink / raw
To: gentoo-commits
commit: 1a2a12373a548c85d50c0ea5320af9afba90b587
Author: Ladislav Láska <laska <AT> kam <DOT> mff <DOT> cuni <DOT> cz>
AuthorDate: Thu May 5 21:10:30 2011 +0000
Commit: Ladislav Láska <ladislav.laska <AT> gmail <DOT> com>
CommitDate: Thu May 5 21:10:30 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kde-sunset.git;a=commit;h=1a2a1237
Added poppler.eclass, since it was removed from main tree and some
ebuilds still depend on it.
---
eclass/poppler.eclass | 197 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 197 insertions(+), 0 deletions(-)
diff --git a/eclass/poppler.eclass b/eclass/poppler.eclass
new file mode 100644
index 0000000..38da37d
--- /dev/null
+++ b/eclass/poppler.eclass
@@ -0,0 +1,197 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/poppler.eclass,v 1.6 2010/01/03 19:10:49 scarabeus Exp $
+
+# @ECLASS: poppler.eclass
+# @MAINTAINER:
+# Peter Alfredsen <loki_val@gentoo.org>
+# @BLURB: Reduces code duplication in the modularized poppler ebuilds.
+# @DESCRIPTION:
+# Provides an easy template for making modularized poppler-based ebuilds.
+
+inherit base multilib libtool
+
+has 2 ${EAPI} || DEPEND="EAPI-TOO-OLD"
+
+EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
+
+RDEPEND="
+ !app-text/poppler
+ !app-text/poppler-bindings
+ "
+DEPEND="
+ dev-util/pkgconfig
+ userland_GNU? ( >=sys-apps/findutils-4.4.0 )
+ "
+
+
+# @ECLASS-VARIABLE: HOMEPAGE
+# @DESCRIPTION:
+# Default HOMEPAGE
+HOMEPAGE="http://poppler.freedesktop.org/"
+
+# @ECLASS-VARIABLE: SRC_URI
+# @DESCRIPTION:
+# Default SRC_URI
+SRC_URI="http://poppler.freedesktop.org/poppler-${PV}.tar.gz"
+
+# @ECLASS-VARIABLE: S
+# @DESCRIPTION:
+# Default working directory
+S=${WORKDIR}/poppler-${PV}
+
+# @ECLASS-VARIABLE: POPPLER_MODULE
+# @DESCRIPTION:
+# The name of the poppler module. Must be set by the ebuild before inheriting
+# the poppler eclass.
+POPPLER_MODULE=${POPPLER_MODULE}
+
+# @ECLASS-VARIABLE: POPPLER_MODULE_S
+# @DESCRIPTION:
+# The working directory of the poppler module.
+POPPLER_MODULE_S=${S}/${POPPLER_MODULE}
+
+# @FUNCTION: pkg_check_modules_override
+# @USAGE: <GROUP> [package1] [package2]
+# @DESCRIPTION:
+# Will export the appropriate variables to override PKG_CHECK_MODULES autoconf
+# macros, with the string " " by default. If packages are specified, they will
+# be looked up with pkg-config and the appropriate LIBS and CFLAGS substituted.
+# LIBS and CFLAGS can also be specified per-package with the following syntax:
+# @CODE
+# package=LIBS%CFLAGS
+# @CODE
+# = and % have no effect unless both are specified.
+# Here is an example:
+# @CODE
+# pkg_check_modules_override GASH "gtk+-2.0=-jule%" gobject-2.0
+# @CODE
+# The above example will do:
+# @CODE
+# export GASH_CFLAGS+=" -jule"
+# export GASH_LIBS+=" "
+# export GASH_CFLAGS+=" $(pkg-config --cflags gobject-2.0)"
+# export GASH_LIBS+=" $(pkg-config --libs gobject-2.0)"
+# @CODE
+#
+# NOTE: If a package is not found, the string " " will be inserted in place of
+# <GROUP>_CFLAGS and <GROUP>_LIBS
+pkg_check_modules_override() {
+ local package
+ local group="${1}"
+ local packages="${*:2}"
+ export ${group}_CFLAGS=" "
+ export ${group}_LIBS=" "
+
+ if [[ ${#@} -lt 1 ]]
+ then
+ eerror "${FUNCNAME[0]} requires at least one parameter: GROUP"
+ eerror "PKG_CHECK_MODULES(GROUP, package1 package2 etc)"
+ die "${FUNCNAME[0]} requires at least one parameter: GROUP"
+ fi
+
+ for package in $packages
+ do
+ if [[ ${package/=} != ${package} && ${package/\%} != ${package} ]]
+ then
+ package_cflag_libs=${package##*=}
+ export ${group}_CFLAGS+=" ${package_cflag_libs%%\%*}"
+ export ${group}_LIBS+=" ${package_cflag_libs##*\%}"
+ else
+ if pkg-config --exists $package
+ then
+ export ${group}_CFLAGS+=" $(pkg-config --cflags $package)"
+ export ${group}_LIBS+=" $(pkg-config --libs $package)"
+ else
+ export ${group}_CFLAGS+=" "
+ export ${group}_LIBS+=" "
+ fi
+ fi
+ done
+}
+# @FUNCTION: poppler_src_unpack
+# @USAGE:
+# @DESCRIPTION:
+# Runs unpack ${A}
+poppler_src_unpack() {
+ unpack ${A}
+}
+
+# @FUNCTION: poppler_src_prepare
+# @USAGE:
+# @DESCRIPTION:
+# Runs autopatch from base.eclass.
+# Uses sed to replace libpoppler.la references with -lpoppler
+poppler_src_prepare() {
+ base_src_prepare
+ sed -i \
+ -e 's#$(top_builddir)/poppler/libpoppler.la#-lpoppler#' \
+ $(find . -type f -name 'Makefile.in') || die "Failed to sed proper lib into Makefile.am"
+ elibtoolize
+}
+
+# @FUNCTION: poppler_src_configure
+# @USAGE:
+# @DESCRIPTION:
+# Makes sure we get a uniform Makefile environment by using pkg_check_modules_override to
+# fill out some blanks that configure wants filled. Probably not really needed, but
+# insures against future breakage.
+# Calls econf with some defaults.
+poppler_src_configure() {
+ pkg_check_modules_override CAIRO cairo
+ pkg_check_modules_override POPPLER_GLIB glib-2.0
+ pkg_check_modules_override POPPLER_QT4 QtCore QtGui QtXml
+ pkg_check_modules_override POPPLER_QT4_TEST QtTest
+ pkg_check_modules_override ABIWORD libxml-2.0
+ pkg_check_modules_override GTK_TEST gtk+-2.0 gdk-pixbuf-2.0 libglade-2.0 gthread-2.0
+ pkg_check_modules_override POPPLER_GLIB glib-2.0 gobject-2.0
+
+ econf --disable-static \
+ --enable-poppler-qt4 \
+ --enable-poppler-glib \
+ --enable-xpdf-headers \
+ --enable-libjpeg \
+ --enable-libopenjpeg \
+ --enable-zlib \
+ --enable-splash-output \
+ ${POPPLER_CONF}
+}
+
+# @FUNCTION: poppler_src_compile
+# @USAGE:
+# @DESCRIPTION:
+# Removes top_srcdir Makefile to ensure that no accidental recursion happens. The build
+# will just die if it tries to go through top_srcdir.
+# Runs emake "$@" in POPPLER_MODULE_S
+poppler_src_compile() {
+ rm -f "${S}"/Makefile* &> /dev/null
+ cd "${POPPLER_MODULE_S}" || die "POPPLER_MODULE_S=${POPPLER_MODULE_S} - cd failed"
+ einfo "Now in $POPPLER_MODULE_S"
+ emake "$@" || die "emake failed"
+}
+
+# @FUNCTION: poppler_src_install
+# @USAGE:
+# @DESCRIPTION:
+# Runs emake DESTDIR="${D}" ${@:-install} in POPPLER_MODULE_S
+# Removes .la files.
+poppler_src_install() {
+ cd "${POPPLER_MODULE_S}"
+ emake DESTDIR="${D}" ${@:-install} || die "make install failed"
+ for pfile in "${POPPLER_PKGCONFIG[@]}"
+ do
+ insinto /usr/$(get_libdir)/pkgconfig
+ if [[ ${pfile/=} != ${pfile} ]]
+ then
+ if use ${pfile%=*}
+ then
+ pfile=${pfile#*=}
+ else
+ pfile=false
+ fi
+ fi
+ [[ ${pfile} != "false" ]] && doins "${S}/${pfile}"
+ done
+
+ find "${D}" -type f -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed"
+}
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2013-11-13 22:24 Lars Wendler
0 siblings, 0 replies; 33+ messages in thread
From: Lars Wendler @ 2013-11-13 22:24 UTC (permalink / raw
To: gentoo-commits
commit: 6d6dae006ffa71291bf23ed40fd7df8287007f6a
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 13 22:24:24 2013 +0000
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Wed Nov 13 22:24:24 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kde-sunset.git;a=commit;h=6d6dae00
Replaced deprecated "hasq" with "has".
---
eclass/kde-meta.eclass | 6 +++---
eclass/kde.eclass | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/eclass/kde-meta.eclass b/eclass/kde-meta.eclass
index 216344e..884ee05 100644
--- a/eclass/kde-meta.eclass
+++ b/eclass/kde-meta.eclass
@@ -213,8 +213,8 @@ change_makefiles() {
# check if the dir is defined as KMEXTRACTONLY or if it was defined is KMEXTRACTONLY in the parent dir, this is valid only if it's not also defined as KMMODULE, KMEXTRA or KMCOMPILEONLY. They will ovverride KMEXTRACTONLY, but only in the current dir.
isextractonly="false"
- if ( ( hasq "$1" $KMEXTRACTONLYFULLPATH || [[ $2 = "true" ]] ) && \
- ( ! hasq "$1" $KMMODULEFULLPATH $KMEXTRAFULLPATH $KMCOMPILEONLYFULLPATH ) ); then
+ if ( ( has "$1" $KMEXTRACTONLYFULLPATH || [[ $2 = "true" ]] ) && \
+ ( ! has "$1" $KMMODULEFULLPATH $KMEXTRAFULLPATH $KMCOMPILEONLYFULLPATH ) ); then
isextractonly="true"
fi
debug-print "isextractonly = $isextractonly"
@@ -230,7 +230,7 @@ change_makefiles() {
for directory in $dirlistfullpath; do
- if ( hasq "$1" $KMEXTRACTONLYFULLPATH || [[ $2 = "true" ]] ); then
+ if ( has "$1" $KMEXTRACTONLYFULLPATH || [[ $2 = "true" ]] ); then
change_makefiles $directory 'true'
else
change_makefiles $directory 'false'
diff --git a/eclass/kde.eclass b/eclass/kde.eclass
index b85a9bb..eb89f30 100644
--- a/eclass/kde.eclass
+++ b/eclass/kde.eclass
@@ -287,7 +287,7 @@ kde_src_configure() {
else
myconf="$myconf --disable-debug --without-debug"
fi
- if hasq kdeenablefinal ${IUSE}; then
+ if has kdeenablefinal ${IUSE}; then
myconf="$myconf $(use_enable kdeenablefinal final)"
fi
if [[ ${ARTS_REQUIRED} == "never" ]]; then
@@ -403,7 +403,7 @@ EOF
# Visiblity stuff is broken. Just disable it when it's present.
export kde_cv_prog_cxx_fvisibility_hidden=no
- if hasq kdehiddenvisibility ${IUSE} && use kdehiddenvisibility; then
+ if has kdehiddenvisibility ${IUSE} && use kdehiddenvisibility; then
if [[ $(gcc-major-version)$(gcc-minor-version) -ge 41 ]]; then
if [[ ${PN} != "kdelibs" && ${PN} != "arts" ]] && \
! fgrep -q "#define __KDE_HAVE_GCC_VISIBILITY" "${KDEDIR}/include/kdemacros.h"; then
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2015-04-28 19:16 Ian Stakenvicius
0 siblings, 0 replies; 33+ messages in thread
From: Ian Stakenvicius @ 2015-04-28 19:16 UTC (permalink / raw
To: gentoo-commits
commit: c5c6c5ef1d2358984fc233d10ebb388873c59e2d
Author: Ian Stakenvicius <axs <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 28 19:14:43 2015 +0000
Commit: Ian Stakenvicius <axs <AT> gentoo <DOT> org>
CommitDate: Tue Apr 28 19:15:51 2015 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=c5c6c5ef
Ensured EXPORT_FUNCTIONS works for EAPI3-5 in kde{,-meta}.eclass
Signed-off-by: Ian Stakenvicius <axs <AT> gentoo.org>
eclass/kde-meta.eclass | 2 +-
eclass/kde.eclass | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/eclass/kde-meta.eclass b/eclass/kde-meta.eclass
index 884ee05..570efd6 100644
--- a/eclass/kde-meta.eclass
+++ b/eclass/kde-meta.eclass
@@ -459,5 +459,5 @@ kde-meta_src_install() {
}
case ${EAPI:-0} in
0|1) EXPORT_FUNCTIONS src_unpack src_compile src_install;;
- 2) EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install;;
+ 2|3|4|5) EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install;;
esac
diff --git a/eclass/kde.eclass b/eclass/kde.eclass
index eb89f30..eb99669 100644
--- a/eclass/kde.eclass
+++ b/eclass/kde.eclass
@@ -604,5 +604,5 @@ kde_pkg_postrm() {
case ${EAPI:-0} in
0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm pkg_preinst;;
- 2) EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_postinst pkg_postrm pkg_preinst;;
+ 2|3|4|5) EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_postinst pkg_postrm pkg_preinst;;
esac
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2016-04-24 7:07 Lars Wendler
0 siblings, 0 replies; 33+ messages in thread
From: Lars Wendler @ 2016-04-24 7:07 UTC (permalink / raw
To: gentoo-commits
commit: 2dc399cee52a1d4a17dc46b988f5e8d0d7d6dd7d
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 24 07:06:53 2016 +0000
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Sun Apr 24 07:06:53 2016 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=2dc399ce
eclass/kde.eclass: Fixed build with latest autoconf-archive.
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
eclass/kde.eclass | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/eclass/kde.eclass b/eclass/kde.eclass
index d156766..d57d047 100644
--- a/eclass/kde.eclass
+++ b/eclass/kde.eclass
@@ -235,6 +235,13 @@ kde_src_prepare() {
ln -s "${WORKDIR}/admin" "${KDE_S}/admin" || die "Unable to symlink the new admin/ directory"
eend 0
fi
+
+ # >=autoconf-archive-2016.03.20 tries to include
+ # ax_cxx_compile_stdcxx.m4 which these old kde packages seek in ${S}.
+ # Create a symlink so we don't break the build.
+ if [[ -f "/usr/share/aclocal/ax_cxx_compile_stdcxx.m4" ]] ; then
+ ln -s /usr/share/aclocal/ax_cxx_compile_stdcxx.m4 "${S}" || die
+ fi
}
# @FUNCTION: kde_src_configure
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2016-08-03 20:18 Johannes Huber
0 siblings, 0 replies; 33+ messages in thread
From: Johannes Huber @ 2016-08-03 20:18 UTC (permalink / raw
To: gentoo-commits
commit: 72dc9df3c713b3a993de7a3bae2d3780f8fd02a4
Author: Johannes Huber <johu <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 3 20:17:48 2016 +0000
Commit: Johannes Huber <johu <AT> gentoo <DOT> org>
CommitDate: Wed Aug 3 20:17:48 2016 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=72dc9df3
kde4-meta-pkg.eclass: Import from gentoo main tree
eclass/kde4-meta-pkg.eclass | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/eclass/kde4-meta-pkg.eclass b/eclass/kde4-meta-pkg.eclass
new file mode 100644
index 0000000..7f74338
--- /dev/null
+++ b/eclass/kde4-meta-pkg.eclass
@@ -0,0 +1,27 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+# DEPRECATED
+# This eclass is deprecated. Superseded by kde5-meta-pkg.eclass.
+
+# @ECLASS: kde4-meta-pkg.eclass
+# @MAINTAINER:
+# kde@gentoo.org
+# @BLURB: This eclass contains boilerplate for kde 4.X meta packages
+# @DESCRIPTION:
+# This eclass should only be used for defining meta packages for KDE4.
+
+if [[ -z ${_KDE4_META_PKG_ECLASS} ]]; then
+_KDE4_META_PKG_ECLASS=1
+
+inherit kde4-functions
+
+HOMEPAGE="https://www.kde.org/"
+
+LICENSE="metapackage"
+IUSE="aqua"
+
+SLOT=4
+
+fi
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2016-12-17 19:08 Johannes Huber
0 siblings, 0 replies; 33+ messages in thread
From: Johannes Huber @ 2016-12-17 19:08 UTC (permalink / raw
To: gentoo-commits
commit: 3ffebd61d682e34ce36213bdaa25085da1aca842
Author: Johannes Huber <johu <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 17 19:07:34 2016 +0000
Commit: Johannes Huber <johu <AT> gentoo <DOT> org>
CommitDate: Sat Dec 17 19:07:34 2016 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=3ffebd61
kde-functions.eclass: cervisia 3.5 is in cat kde-base
eclass/kde-functions.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/kde-functions.eclass b/eclass/kde-functions.eclass
index d92bbac..39e0058 100644
--- a/eclass/kde-functions.eclass
+++ b/eclass/kde-functions.eclass
@@ -258,7 +258,7 @@ kde-base/kdepim kde-base/libkpimidentities
kde-base/kdepim kde-base/libksieve
kde-base/kdepim kde-base/mimelib
kde-base/kdepim kde-base/networkstatus
-kde-base/kdesdk kde-apps/cervisia
+kde-base/kdesdk kde-base/cervisia
kde-base/kdesdk kde-apps/kapptemplate
kde-base/kdesdk kde-base/kbabel
kde-base/kdesdk kde-base/kbugbuster
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2018-04-06 0:53 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2018-04-06 0:53 UTC (permalink / raw
To: gentoo-commits
commit: 6a6c6d087d85efc0acddae97a0bff1e2c0e1c456
Author: Andreas Sturmlechner <andreas.sturmlechner <AT> gmail <DOT> com>
AuthorDate: Fri Apr 6 00:52:56 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Fri Apr 6 00:52:56 2018 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=6a6c6d08
kde4-{base,functions,meta}.eclass: Import from Gentoo ebuild repository
eclass/kde4-base.eclass | 963 +++++++++++++++++++++++++++++++++++++++++++
eclass/kde4-functions.eclass | 431 +++++++++++++++++++
eclass/kde4-meta.eclass | 631 ++++++++++++++++++++++++++++
3 files changed, 2025 insertions(+)
diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass
new file mode 100644
index 0000000..8abade2
--- /dev/null
+++ b/eclass/kde4-base.eclass
@@ -0,0 +1,963 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @DEAD
+# Removal on 2018-05-03.
+# @ECLASS: kde4-base.eclass
+# @MAINTAINER:
+# kde@gentoo.org
+# @BLURB: This eclass provides functions for kde 4.X ebuilds
+# @DESCRIPTION:
+# The kde4-base.eclass provides support for building KDE4 based ebuilds
+# and KDE4 applications.
+#
+# NOTE: KDE 4 ebuilds currently support EAPI 5. This will be
+# reviewed over time as new EAPI versions are approved.
+
+if [[ -z ${_KDE4_BASE_ECLASS} ]]; then
+_KDE4_BASE_ECLASS=1
+
+# @ECLASS-VARIABLE: KDE_SELINUX_MODULE
+# @DESCRIPTION:
+# If set to "none", do nothing.
+# For any other value, add selinux to IUSE, and depending on that useflag
+# add a dependency on sec-policy/selinux-${KDE_SELINUX_MODULE} to (R)DEPEND
+: ${KDE_SELINUX_MODULE:=none}
+
+# @ECLASS-VARIABLE: VIRTUALDBUS_TEST
+# @DESCRIPTION:
+# If defined, launch and use a private dbus session during src_test.
+
+# @ECLASS-VARIABLE: VIRTUALX_REQUIRED
+# @DESCRIPTION:
+# For proper description see virtualx.eclass manpage.
+# Here we redefine default value to be manual, if your package needs virtualx
+# for tests you should proceed with setting VIRTUALX_REQUIRED=test.
+: ${VIRTUALX_REQUIRED:=manual}
+
+inherit kde4-functions toolchain-funcs flag-o-matic gnome2-utils virtualx versionator eutils multilib xdg-utils
+
+if [[ ${KDE_BUILD_TYPE} = live ]]; then
+ case ${KDE_SCM} in
+ svn) inherit subversion ;;
+ git) inherit git-r3 ;;
+ esac
+fi
+
+# @ECLASS-VARIABLE: CMAKE_REQUIRED
+# @DESCRIPTION:
+# Specify if cmake buildsystem is being used. Possible values are 'always' and 'never'.
+# Please note that if it's set to 'never' you need to explicitly override following phases:
+# src_configure, src_compile, src_test and src_install.
+# Defaults to 'always'.
+: ${CMAKE_REQUIRED:=always}
+if [[ ${CMAKE_REQUIRED} = always ]]; then
+ buildsystem_eclass="cmake-utils"
+ export_fns="src_configure src_compile src_test src_install"
+fi
+
+# @ECLASS-VARIABLE: KDE_MINIMAL
+# @DESCRIPTION:
+# This variable is used when KDE_REQUIRED is set, to specify required KDE minimal
+# version for apps to work. Currently defaults to 4.4
+# One may override this variable to raise version requirements.
+# Note that it is fixed to ${PV} for kde-base packages.
+KDE_MINIMAL="${KDE_MINIMAL:-4.4}"
+
+# Set slot for KDEBASE known packages
+case ${KDEBASE} in
+ kde-base)
+ SLOT=4/$(get_version_component_range 1-2)
+ KDE_MINIMAL="${PV}"
+ ;;
+ kdevelop)
+ if [[ ${KDE_BUILD_TYPE} = live ]]; then
+ # @ECLASS-VARIABLE: KDEVELOP_VERSION
+ # @DESCRIPTION:
+ # Specifies KDevelop version. Default is 4.0.0 for tagged packages and 9999 for live packages.
+ # Applies to KDEBASE=kdevelop only.
+ KDEVELOP_VERSION="${KDEVELOP_VERSION:-4.9999}"
+ # @ECLASS-VARIABLE: KDEVPLATFORM_VERSION
+ # @DESCRIPTION:
+ # Specifies KDevplatform version. Default is 1.0.0 for tagged packages and 9999 for live packages.
+ # Applies to KDEBASE=kdevelop only.
+ KDEVPLATFORM_VERSION="${KDEVPLATFORM_VERSION:-4.9999}"
+ else
+ case ${PN} in
+ kdevelop)
+ KDEVELOP_VERSION=${PV}
+ KDEVPLATFORM_VERSION="$(($(get_major_version)-3)).$(get_after_major_version)"
+ ;;
+ kdevplatform|kdevelop-php*|kdevelop-python)
+ KDEVELOP_VERSION="$(($(get_major_version)+3)).$(get_after_major_version)"
+ KDEVPLATFORM_VERSION=${PV}
+ ;;
+ *)
+ KDEVELOP_VERSION="${KDEVELOP_VERSION:-4.0.0}"
+ KDEVPLATFORM_VERSION="${KDEVPLATFORM_VERSION:-1.0.0}"
+ esac
+ fi
+ SLOT="4"
+ ;;
+esac
+
+inherit ${buildsystem_eclass}
+
+EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare ${export_fns} pkg_preinst pkg_postinst pkg_postrm
+
+unset buildsystem_eclass
+unset export_fns
+
+# @ECLASS-VARIABLE: DECLARATIVE_REQUIRED
+# @DESCRIPTION:
+# Is qtdeclarative required? Possible values are 'always', 'optional' and 'never'.
+# This variable must be set before inheriting any eclasses. Defaults to 'never'.
+DECLARATIVE_REQUIRED="${DECLARATIVE_REQUIRED:-never}"
+
+# @ECLASS-VARIABLE: QT3SUPPORT_REQUIRED
+# @DESCRIPTION:
+# Is qt3support required? Possible values are 'true' or 'false'.
+# This variable must be set before inheriting any eclasses. Defaults to 'false'.
+QT3SUPPORT_REQUIRED="${QT3SUPPORT_REQUIRED:-false}"
+
+# @ECLASS-VARIABLE: QTHELP_REQUIRED
+# @DESCRIPTION:
+# Is qthelp required? Possible values are 'always', 'optional' and 'never'.
+# This variable must be set before inheriting any eclasses. Defaults to 'never'.
+QTHELP_REQUIRED="${QTHELP_REQUIRED:-never}"
+
+# @ECLASS-VARIABLE: OPENGL_REQUIRED
+# @DESCRIPTION:
+# Is qtopengl required? Possible values are 'always', 'optional' and 'never'.
+# This variable must be set before inheriting any eclasses. Defaults to 'never'.
+OPENGL_REQUIRED="${OPENGL_REQUIRED:-never}"
+
+# @ECLASS-VARIABLE: MULTIMEDIA_REQUIRED
+# @DESCRIPTION:
+# Is qtmultimedia required? Possible values are 'always', 'optional' and 'never'.
+# This variable must be set before inheriting any eclasses. Defaults to 'never'.
+MULTIMEDIA_REQUIRED="${MULTIMEDIA_REQUIRED:-never}"
+
+# @ECLASS-VARIABLE: SQL_REQUIRED
+# @DESCRIPTION:
+# Is qtsql required? Possible values are 'always', 'optional' and 'never'.
+# This variable must be set before inheriting any eclasses. Defaults to 'never'.
+SQL_REQUIRED="${SQL_REQUIRED:-never}"
+
+# @ECLASS-VARIABLE: WEBKIT_REQUIRED
+# @DESCRIPTION:
+# Is qtwebkit required? Possible values are 'always', 'optional' and 'never'.
+# This variable must be set before inheriting any eclasses. Defaults to 'never'.
+WEBKIT_REQUIRED="${WEBKIT_REQUIRED:-never}"
+
+# @ECLASS-VARIABLE: CPPUNIT_REQUIRED
+# @DESCRIPTION:
+# Is cppunit required for tests? Possible values are 'always', 'optional' and 'never'.
+# This variable must be set before inheriting any eclasses. Defaults to 'never'.
+CPPUNIT_REQUIRED="${CPPUNIT_REQUIRED:-never}"
+
+# @ECLASS-VARIABLE: KDE_REQUIRED
+# @DESCRIPTION:
+# Is kde required? Possible values are 'always', 'optional' and 'never'.
+# This variable must be set before inheriting any eclasses. Defaults to 'always'
+# If set to 'always' or 'optional', KDE_MINIMAL may be overridden as well.
+# Note that for kde-base packages this variable is fixed to 'always'.
+KDE_REQUIRED="${KDE_REQUIRED:-always}"
+
+# @ECLASS-VARIABLE: KDE_HANDBOOK
+# @DESCRIPTION:
+# Set to enable handbook in application. Possible values are 'always', 'optional'
+# (handbook USE flag) and 'never'.
+# This variable must be set before inheriting any eclasses. Defaults to 'never'.
+# It adds default handbook dirs for kde-base packages to KMEXTRA and in any case it
+# ensures buildtime and runtime dependencies.
+KDE_HANDBOOK="${KDE_HANDBOOK:-never}"
+
+# @ECLASS-VARIABLE: KDE_LINGUAS_LIVE_OVERRIDE
+# @DESCRIPTION:
+# Set this varible if you want your live package to manage its
+# translations. (Mostly all kde ebuilds does not ship documentation
+# and translations in live ebuilds)
+if [[ ${KDE_BUILD_TYPE} == live && -z ${KDE_LINGUAS_LIVE_OVERRIDE} ]]; then
+ # Kdebase actually provides the handbooks even for live stuff
+ [[ ${KDEBASE} == kde-base ]] || KDE_HANDBOOK=never
+ KDE_LINGUAS=""
+fi
+
+# Setup packages inheriting this eclass
+case ${KDEBASE} in
+ kde-base)
+ HOMEPAGE="https://www.kde.org/"
+ LICENSE="GPL-2"
+ if [[ ${KDE_BUILD_TYPE} = live && -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
+ # Disable tests for live ebuilds by default
+ RESTRICT+=" test"
+ fi
+
+ # This code is to prevent portage from searching GENTOO_MIRRORS for
+ # packages that will never be mirrored. (As they only will ever be in
+ # the overlay).
+ case ${PV} in
+ *9999* | 4.?.[6-9]? | 4.??.[6-9]? | ??.?.[6-9]? | ??.??.[6-9]?)
+ RESTRICT+=" mirror"
+ ;;
+ esac
+ ;;
+ kdevelop)
+ HOMEPAGE="https://www.kdevelop.org/"
+ LICENSE="GPL-2"
+ ;;
+esac
+
+# @ECLASS-VARIABLE: QT_MINIMAL
+# @DESCRIPTION:
+# Determine version of qt we enforce as minimal for the package.
+QT_MINIMAL="${QT_MINIMAL:-4.8.5}"
+
+# Declarative dependencies
+qtdeclarativedepend="
+ >=dev-qt/qtdeclarative-${QT_MINIMAL}:4
+"
+case ${DECLARATIVE_REQUIRED} in
+ always)
+ COMMONDEPEND+=" ${qtdeclarativedepend}"
+ ;;
+ optional)
+ IUSE+=" declarative"
+ COMMONDEPEND+=" declarative? ( ${qtdeclarativedepend} )"
+ ;;
+ *) ;;
+esac
+unset qtdeclarativedepend
+
+# Qt3Support dependencies
+qt3supportdepend="
+ >=dev-qt/qt3support-${QT_MINIMAL}:4[accessibility]
+"
+case ${QT3SUPPORT_REQUIRED} in
+ true)
+ COMMONDEPEND+=" ${qt3supportdepend}"
+ [[ -n ${qtcoreuse} ]] && qtcoreuse+=",qt3support" || qtcoreuse="qt3support"
+ [[ -n ${qtsqluse} ]] && qtsqluse+=",qt3support" || qtsqluse="qt3support"
+ [[ -n ${kdelibsuse} ]] && kdelibsuse+=",qt3support(+)" || kdelibsuse="qt3support(+)"
+ ;;
+ *) ;;
+esac
+unset qt3supportdepend
+
+# QtHelp dependencies
+qthelpdepend="
+ >=dev-qt/qthelp-${QT_MINIMAL}:4
+"
+case ${QTHELP_REQUIRED} in
+ always)
+ COMMONDEPEND+=" ${qthelpdepend}"
+ ;;
+ optional)
+ IUSE+=" qthelp"
+ COMMONDEPEND+=" qthelp? ( ${qthelpdepend} )"
+ ;;
+esac
+unset qthelpdepend
+
+# OpenGL dependencies
+qtopengldepend="
+ >=dev-qt/qtopengl-${QT_MINIMAL}:4
+"
+case ${OPENGL_REQUIRED} in
+ always)
+ COMMONDEPEND+=" ${qtopengldepend}"
+ ;;
+ optional)
+ IUSE+=" opengl"
+ COMMONDEPEND+=" opengl? ( ${qtopengldepend} )"
+ ;;
+ *) ;;
+esac
+unset qtopengldepend
+
+# MultiMedia dependencies
+qtmultimediadepend="
+ >=dev-qt/qtmultimedia-${QT_MINIMAL}:4
+"
+case ${MULTIMEDIA_REQUIRED} in
+ always)
+ COMMONDEPEND+=" ${qtmultimediadepend}"
+ ;;
+ optional)
+ IUSE+=" multimedia"
+ COMMONDEPEND+=" multimedia? ( ${qtmultimediadepend} )"
+ ;;
+ *) ;;
+esac
+unset qtmultimediadepend
+
+# Sql dependencies
+[[ -n ${qtsqluse} ]] && qtsqluse="[${qtsqluse}]"
+qtsqldepend="
+ >=dev-qt/qtsql-${QT_MINIMAL}:4${qtsqluse}
+"
+case ${SQL_REQUIRED} in
+ always)
+ COMMONDEPEND+=" ${qtsqldepend}"
+ ;;
+ optional)
+ IUSE+=" sql"
+ COMMONDEPEND+=" sql? ( ${qtsqldepend} )"
+ ;;
+ *) ;;
+esac
+unset qtsqluse
+unset qtsqldepend
+
+# WebKit dependencies
+qtwebkitdepend="
+ >=dev-qt/qtwebkit-${QT_MINIMAL}:4
+"
+case ${WEBKIT_REQUIRED} in
+ always)
+ COMMONDEPEND+=" ${qtwebkitdepend}"
+ [[ -n ${kdelibsuse} ]] && kdelibsuse+=",webkit(+)" || kdelibsuse="webkit(+)"
+ ;;
+ optional)
+ IUSE+=" +webkit"
+ COMMONDEPEND+=" webkit? ( ${qtwebkitdepend} )"
+ [[ -n ${kdelibsuse} ]] && kdelibsuse+=",webkit?" || kdelibsuse="webkit?"
+ ;;
+ *) ;;
+esac
+unset qtwebkitdepend
+
+# CppUnit dependencies
+cppuintdepend="
+ dev-util/cppunit
+"
+case ${CPPUNIT_REQUIRED} in
+ always)
+ DEPEND+=" ${cppuintdepend}"
+ ;;
+ optional)
+ IUSE+=" test"
+ DEPEND+=" test? ( ${cppuintdepend} )"
+ ;;
+ *) ;;
+esac
+unset cppuintdepend
+
+# KDE dependencies
+# Qt accessibility classes are needed in various places, bug 325461
+[[ -n ${qtcoreuse} ]] && qtcoreuse+=",ssl" || qtcoreuse="ssl"
+[[ -n ${qtcoreuse} ]] && qtcoreuse="[${qtcoreuse}]"
+kdecommondepend="
+ dev-lang/perl
+ >=dev-qt/designer-${QT_MINIMAL}:4
+ >=dev-qt/qtcore-${QT_MINIMAL}:4${qtcoreuse}
+ >=dev-qt/qtdbus-${QT_MINIMAL}:4
+ >=dev-qt/qtgui-${QT_MINIMAL}:4[accessibility,dbus(+)]
+ >=dev-qt/qtscript-${QT_MINIMAL}:4
+ >=dev-qt/qtsvg-${QT_MINIMAL}:4
+ >=dev-qt/qttest-${QT_MINIMAL}:4
+"
+unset qtcoreuse
+
+if [[ ${PN} != kdelibs ]]; then
+ [[ -n ${kdelibsuse} ]] && kdelibsuse="[${kdelibsuse}]"
+ kdecommondepend+=" kde-frameworks/kdelibs:4${kdelibsuse}"
+ if [[ ${KDEBASE} = kdevelop ]]; then
+ if [[ ${PN} != kdevplatform ]]; then
+ # @ECLASS-VARIABLE: KDEVPLATFORM_REQUIRED
+ # @DESCRIPTION:
+ # Specifies whether kdevplatform is required. Possible values are 'always' (default) and 'never'.
+ # Applies to KDEBASE=kdevelop only.
+ KDEVPLATFORM_REQUIRED="${KDEVPLATFORM_REQUIRED:-always}"
+ case ${KDEVPLATFORM_REQUIRED} in
+ always)
+ kdecommondepend+="
+ >=dev-util/kdevplatform-${KDEVPLATFORM_VERSION}:4
+ "
+ ;;
+ *) ;;
+ esac
+ fi
+ fi
+fi
+unset kdelibsuse
+
+kdedepend="
+ dev-util/automoc
+ virtual/pkgconfig
+ >=x11-libs/libXtst-1.1.0
+ x11-proto/xf86vidmodeproto
+"
+
+kderdepend=""
+
+# all packages needs oxygen icons for basic iconset
+if [[ ${PN} != oxygen-icons ]]; then
+ kderdepend+=" kde-frameworks/oxygen-icons"
+fi
+
+# add a dependency over kde4-l10n
+if [[ ${KDEBASE} != "kde-base" && -n ${KDE_LINGUAS} ]]; then
+ for _lingua in $(kde4_lingua_to_l10n ${KDE_LINGUAS}); do
+ # if our package has linguas, pull in kde4-l10n with selected lingua enabled,
+ # but only for selected ones.
+ # this can't be done on one line because if user doesn't use any localisation
+ # then he is probably not interested in kde4-l10n at all.
+ kderdepend+="
+ l10n_${_lingua}? ( $(add_kdeapps_dep kde4-l10n "l10n_${_lingua}(+)") )
+ "
+ done
+ unset _lingua
+fi
+
+kdehandbookdepend="
+ app-text/docbook-xml-dtd:4.2
+ app-text/docbook-xsl-stylesheets
+"
+kdehandbookrdepend="
+ kde-frameworks/kdelibs:4[handbook]
+"
+case ${KDE_HANDBOOK} in
+ always)
+ kdedepend+=" ${kdehandbookdepend}"
+ [[ ${PN} != kdelibs ]] && kderdepend+=" ${kdehandbookrdepend}"
+ ;;
+ optional)
+ IUSE+=" +handbook"
+ kdedepend+=" handbook? ( ${kdehandbookdepend} )"
+ [[ ${PN} != kdelibs ]] && kderdepend+=" handbook? ( ${kdehandbookrdepend} )"
+ ;;
+ *) ;;
+esac
+unset kdehandbookdepend kdehandbookrdepend
+
+case ${KDE_SELINUX_MODULE} in
+ none) ;;
+ *)
+ IUSE+=" selinux"
+ kderdepend+=" selinux? ( sec-policy/selinux-${KDE_SELINUX_MODULE} )"
+ ;;
+esac
+
+case ${KDE_REQUIRED} in
+ always)
+ [[ -n ${kdecommondepend} ]] && COMMONDEPEND+=" ${kdecommondepend}"
+ [[ -n ${kdedepend} ]] && DEPEND+=" ${kdedepend}"
+ [[ -n ${kderdepend} ]] && RDEPEND+=" ${kderdepend}"
+ ;;
+ optional)
+ IUSE+=" kde"
+ [[ -n ${kdecommondepend} ]] && COMMONDEPEND+=" kde? ( ${kdecommondepend} )"
+ [[ -n ${kdedepend} ]] && DEPEND+=" kde? ( ${kdedepend} )"
+ [[ -n ${kderdepend} ]] && RDEPEND+=" kde? ( ${kderdepend} )"
+ ;;
+ *) ;;
+esac
+
+unset kdecommondepend kdedepend kderdepend
+
+debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: COMMONDEPEND is ${COMMONDEPEND}"
+debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND (only) is ${DEPEND}"
+debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND (only) is ${RDEPEND}"
+
+# Accumulate dependencies set by this eclass
+DEPEND+=" ${COMMONDEPEND}"
+RDEPEND+=" ${COMMONDEPEND}"
+unset COMMONDEPEND
+
+# Fetch section - If the ebuild's category is not 'kde-base' and if it is not a
+# kdevelop ebuild, the URI should be set in the ebuild itself
+_calculate_src_uri() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local _kmname _kmname_pv
+
+ # we calculate URI only for known KDEBASE modules
+ [[ -n ${KDEBASE} ]] || return
+
+ # calculate tarball module name
+ if [[ -n ${KMNAME} ]]; then
+ _kmname="${KMNAME}"
+ else
+ _kmname=${PN}
+ fi
+ _kmname_pv="${_kmname}-${PV}"
+ case ${KDEBASE} in
+ kde-base)
+ case ${PV} in
+ 4.4.20*)
+ # KDEPIM 4.4 no-akonadi branch, special case
+ # TODO: Remove this part when KDEPIM 4.4 gets out of the tree
+ SRC_URI="https://dev.gentoo.org/~dilfridge/distfiles/${_kmname_pv}.tar.xz" ;;
+ 4.?.[6-9]? | 4.??.[6-9]?)
+ # Unstable KDE SC releases
+ SRC_URI="mirror://kde/unstable/${PV}/src/${_kmname_pv}.tar.xz" ;;
+ 4.11.22)
+ # Part of 15.08.0 actually, sigh. Not stable for next release!
+ SRC_URI="mirror://kde/Attic/applications/15.08.0/src/${_kmname_pv}.tar.xz" ;;
+ 4.14.3)
+ # Last SC release
+ SRC_URI="mirror://kde/stable/${PV}/src/${_kmname_pv}.tar.xz" ;;
+ 4.14.10)
+ # Part of 15.04.3 actually, sigh. Used by last version of KDE PIM 4.
+ SRC_URI="mirror://kde/Attic/applications/15.04.3/src/${_kmname_pv}.tar.xz" ;;
+ 4.14.11*)
+ # KDEPIM 4.14 snapshot with Gentoo patches
+ SRC_URI="https://dev.gentoo.org/~asturm/distfiles/${_kmname_pv}.tar.xz" ;;
+ 16.12.3)
+ SRC_URI="mirror://kde/Attic/applications/16.12.3/src/${_kmname_pv}.tar.xz" ;;
+ ??.?.[6-9]? | ??.??.[4-9]?)
+ # Unstable KDE Applications releases
+ SRC_URI="mirror://kde/unstable/applications/${PV}/src/${_kmname}-${PV}.tar.xz" ;;
+ *)
+ # Stable KDE Applications releases
+ SRC_URI="mirror://kde/stable/applications/${PV}/src/${_kmname}-${PV}.tar.xz"
+ ;;
+ esac
+ ;;
+ kdevelop|kdevelop-php*|kdevplatform)
+ case ${KDEVELOP_VERSION} in
+ 4.[123].[6-9]*) SRC_URI="mirror://kde/unstable/kdevelop/${KDEVELOP_VERSION}/src/${P}.tar.xz" ;;
+ 4.7.3) SRC_URI="mirror://kde/stable/kdevelop/${KDEVELOP_VERSION}/src/${P}.tar.bz2" ;;
+ 4.7.4) SRC_URI="mirror://kde/stable/kdevelop/${KDEVELOP_VERSION}/${P}.tar.xz" ;;
+ *) SRC_URI="mirror://kde/stable/kdevelop/${KDEVELOP_VERSION}/src/${P}.tar.xz" ;;
+ esac
+ ;;
+ esac
+}
+
+_calculate_live_repo() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ SRC_URI=""
+ case ${KDE_SCM} in
+ svn)
+ # Determine branch URL based on live type
+ local branch_prefix
+ case ${PV} in
+ 9999*)
+ # trunk
+ branch_prefix="trunk/KDE"
+ ;;
+ *)
+ # branch
+ branch_prefix="branches/KDE/$(get_kde_version)"
+
+ if [[ ${PV} == ??.??.49.9999 && ${CATEGORY} = kde-apps ]]; then
+ branch_prefix="branches/Applications/$(get_kde_version)"
+ fi
+
+ # @ECLASS-VARIABLE: ESVN_PROJECT_SUFFIX
+ # @DESCRIPTION
+ # Suffix appended to ESVN_PROJECT depending on fetched branch.
+ # Defaults is empty (for -9999 = trunk), and "-${PV}" otherwise.
+ ESVN_PROJECT_SUFFIX="-${PV}"
+ ;;
+ esac
+ # @ECLASS-VARIABLE: ESVN_MIRROR
+ # @DESCRIPTION:
+ # This variable allows easy overriding of default kde mirror service
+ # (anonsvn) with anything else you might want to use.
+ ESVN_MIRROR=${ESVN_MIRROR:=svn://anonsvn.kde.org/home/kde}
+ # Split ebuild, or extragear stuff
+ if [[ -n ${KMNAME} ]]; then
+ ESVN_PROJECT="${KMNAME}${ESVN_PROJECT_SUFFIX}"
+ if [[ -z ${KMNOMODULE} ]] && [[ -z ${KMMODULE} ]]; then
+ KMMODULE="${PN}"
+ fi
+ # Split kde-base/ ebuilds: (they reside in trunk/KDE)
+ case ${KMNAME} in
+ kdebase-*)
+ ESVN_REPO_URI="${ESVN_MIRROR}/${branch_prefix}/kdebase/${KMNAME#kdebase-}"
+ ;;
+ kdelibs-*)
+ ESVN_REPO_URI="${ESVN_MIRROR}/${branch_prefix}/kdelibs/${KMNAME#kdelibs-}"
+ ;;
+ kdereview*)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
+ ;;
+ kdesupport)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
+ ESVN_PROJECT="${PN}${ESVN_PROJECT_SUFFIX}"
+ ;;
+ kde*)
+ ESVN_REPO_URI="${ESVN_MIRROR}/${branch_prefix}/${KMNAME}"
+ ;;
+ extragear*|playground*)
+ # Unpack them in toplevel dir, so that they won't conflict with kde4-meta
+ # build packages from same svn location.
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
+ ESVN_PROJECT="${PN}${ESVN_PROJECT_SUFFIX}"
+ ;;
+ *)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}/${KMMODULE}"
+ ;;
+ esac
+ else
+ # kdelibs, kdepimlibs
+ ESVN_REPO_URI="${ESVN_MIRROR}/${branch_prefix}/${PN}"
+ ESVN_PROJECT="${PN}${ESVN_PROJECT_SUFFIX}"
+ fi
+ # @ECLASS-VARIABLE: ESVN_UP_FREQ
+ # @DESCRIPTION:
+ # This variable is used for specifying the timeout between svn synces
+ # for kde-base modules. Does not affect misc apps.
+ # Default value is 1 hour.
+ [[ ${KDEBASE} = kde-base ]] && ESVN_UP_FREQ=${ESVN_UP_FREQ:-1}
+ ;;
+ git)
+ local _kmname
+ # @ECLASS-VARIABLE: EGIT_MIRROR
+ # @DESCRIPTION:
+ # This variable allows easy overriding of default kde mirror service
+ # (anongit) with anything else you might want to use.
+ EGIT_MIRROR=${EGIT_MIRROR:=https://anongit.kde.org}
+
+ # @ECLASS-VARIABLE: EGIT_REPONAME
+ # @DESCRIPTION:
+ # This variable allows overriding of default repository
+ # name. Specify only if this differ from PN and KMNAME.
+ if [[ -n ${EGIT_REPONAME} ]]; then
+ # the repository and kmname different
+ _kmname=${EGIT_REPONAME}
+ elif [[ -n ${KMNAME} ]]; then
+ _kmname=${KMNAME}
+ else
+ _kmname=${PN}
+ fi
+
+ # default branching
+ [[ ${PV} != 4.9999* && ${PV} != 9999 && ${KDEBASE} == kde-base ]] && \
+ EGIT_BRANCH="KDE/$(get_kde_version)"
+
+ # Applications branching
+ [[ ${PV} == ??.??.49.9999 && ${KDEBASE} == kde-base ]] && \
+ EGIT_BRANCH="Applications/$(get_kde_version)"
+
+ # default repo uri
+ EGIT_REPO_URI+=( "${EGIT_MIRROR}/${_kmname}" )
+
+ debug-print "${FUNCNAME}: Repository: ${EGIT_REPO_URI}"
+ debug-print "${FUNCNAME}: Branch: ${EGIT_BRANCH}"
+ ;;
+ esac
+}
+
+case ${KDE_BUILD_TYPE} in
+ live) _calculate_live_repo ;;
+ *) _calculate_src_uri ;;
+esac
+
+debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
+
+# @ECLASS-VARIABLE: PREFIX
+# @DESCRIPTION:
+# Set the installation PREFIX for non kde-base applications. It defaults to /usr.
+# kde-base packages go into KDE4 installation directory (/usr).
+# No matter the PREFIX, package will be built against KDE installed in /usr.
+
+# @FUNCTION: kde4-base_pkg_setup
+# @DESCRIPTION:
+# Do some basic settings
+kde4-base_pkg_setup() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if has handbook ${IUSE} || has "+handbook" ${IUSE} && [[ "${KDE_HANDBOOK}" != optional ]] ; then
+ eqawarn "Handbook support is enabled via KDE_HANDBOOK=optional in the ebuild."
+ eqawarn "Please do not just set IUSE=handbook, as this leads to dependency errors."
+ fi
+
+ # Don't set KDEHOME during compilation, it will cause access violations
+ unset KDEHOME
+
+ KDEDIR=/usr
+ : ${PREFIX:=/usr}
+ EKDEDIR=${EPREFIX}/usr
+
+ # Point to correct QT plugins path
+ QT_PLUGIN_PATH="${EPREFIX}/usr/$(get_libdir)/kde4/plugins/"
+
+ # Fix XDG collision with sandbox
+ export XDG_CONFIG_HOME="${T}"
+}
+
+# @FUNCTION: kde4-base_src_unpack
+# @DESCRIPTION:
+# This function unpacks the source tarballs for KDE4 applications.
+kde4-base_src_unpack() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ ${KDE_BUILD_TYPE} = live ]]; then
+ case ${KDE_SCM} in
+ svn)
+ subversion_src_unpack
+ ;;
+ git)
+ git-r3_src_unpack
+ ;;
+ esac
+ else
+ unpack ${A}
+ fi
+}
+
+# @FUNCTION: kde4-base_src_prepare
+# @DESCRIPTION:
+# General pre-configure and pre-compile function for KDE4 applications.
+# It also handles translations if KDE_LINGUAS is defined. See KDE_LINGUAS and
+# enable_selected_linguas() and enable_selected_doc_linguas()
+# in kde4-functions.eclass(5) for further details.
+kde4-base_src_prepare() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # enable handbook and linguas only when not using live ebuild
+
+ # Only enable selected languages, used for KDE extragear apps.
+ if [[ -n ${KDE_LINGUAS} ]]; then
+ enable_selected_linguas
+ fi
+
+ # Enable/disable handbooks for kde4-base packages
+ # kde4-l10n inherits kde4-base but is metapackage, so no check for doc
+ # kdelibs inherits kde4-base but handle installing the handbook itself
+ if ! has kde4-meta ${INHERITED} && in_iuse handbook; then
+ if [[ ${KDEBASE} == kde-base ]]; then
+ if [[ ${PN} != kde4-l10n && ${PN} != kdepim-l10n && ${PN} != kdelibs ]] && use !handbook; then
+ # documentation in kde4-functions
+ : ${KDE_DOC_DIRS:=doc}
+ local dir
+ for dir in ${KDE_DOC_DIRS}; do
+ sed -e "\!^[[:space:]]*add_subdirectory[[:space:]]*([[:space:]]*${dir}[[:space:]]*)!s/^/#DONOTCOMPILE /" \
+ -e "\!^[[:space:]]*ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${dir}[[:space:]]*)!s/^/#DONOTCOMPILE /" \
+ -e "\!^[[:space:]]*macro_optional_add_subdirectory[[:space:]]*([[:space:]]*${dir}[[:space:]]*)!s/^/#DONOTCOMPILE /" \
+ -e "\!^[[:space:]]*MACRO_OPTIONAL_ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${dir}[[:space:]]*)!s/^/#DONOTCOMPILE /" \
+ -i CMakeLists.txt || die "failed to comment out handbook"
+ done
+ fi
+ else
+ enable_selected_doc_linguas
+ fi
+ fi
+
+ # SCM bootstrap
+ if [[ ${KDE_BUILD_TYPE} = live ]]; then
+ case ${KDE_SCM} in
+ svn) subversion_src_prepare ;;
+ esac
+ fi
+
+ # Apply patches, cmake-utils does the job already
+ cmake-utils_src_prepare
+
+ # Save library dependencies
+ if [[ -n ${KMSAVELIBS} ]] ; then
+ save_library_dependencies
+ fi
+
+ # Inject library dependencies
+ if [[ -n ${KMLOADLIBS} ]] ; then
+ load_library_dependencies
+ fi
+
+ # Hack for manuals relying on outdated DTD, only outside kde-base/...
+ if [[ -z ${KDEBASE} ]]; then
+ find "${S}" -name "*.docbook" \
+ -exec sed -i -r \
+ -e 's:-//KDE//DTD DocBook XML V4\.1(\..)?-Based Variant V1\.[01]//EN:-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN:g' {} + \
+ || die 'failed to fix DocBook variant version'
+ fi
+}
+
+# @FUNCTION: kde4-base_src_configure
+# @DESCRIPTION:
+# Function for configuring the build of KDE4 applications.
+kde4-base_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # Build tests in src_test only, where we override this value
+ local cmakeargs=(-DKDE4_BUILD_TESTS=OFF)
+
+ if use_if_iuse debug; then
+ # Set "real" debug mode
+ CMAKE_KDE_BUILD_TYPE="Debugfull"
+ else
+ # Handle common release builds
+ append-cppflags -DQT_NO_DEBUG
+ fi
+
+ # Set distribution name
+ [[ ${PN} = kdelibs ]] && cmakeargs+=(-DKDE_DISTRIBUTION_TEXT=Gentoo)
+
+ # Here we set the install prefix
+ tc-is-cross-compiler || cmakeargs+=(-DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX}")
+
+ # Use colors
+ QTEST_COLORED=1
+
+ # Shadow existing installations
+ unset KDEDIRS
+
+ #qmake -query QT_INSTALL_LIBS unavailable when cross-compiling
+ tc-is-cross-compiler && cmakeargs+=(-DQT_LIBRARY_DIR=${ROOT}/usr/$(get_libdir)/qt4)
+ #kde-config -path data unavailable when cross-compiling
+ tc-is-cross-compiler && cmakeargs+=(-DKDE4_DATA_DIR=${ROOT}/usr/share/apps/)
+
+ # sysconf needs to be /etc, not /usr/etc
+ cmakeargs+=(-DSYSCONF_INSTALL_DIR="${EPREFIX}"/etc)
+
+ if [[ $(declare -p mycmakeargs 2>&-) != "declare -a mycmakeargs="* ]]; then
+ if [[ ${mycmakeargs} ]]; then
+ eqawarn "mycmakeargs should always be declared as an array, not a string"
+ fi
+ mycmakeargs=(${mycmakeargs})
+ fi
+
+ mycmakeargs=("${cmakeargs[@]}" "${mycmakeargs[@]}")
+
+ cmake-utils_src_configure
+}
+
+# @FUNCTION: kde4-base_src_compile
+# @DESCRIPTION:
+# General function for compiling KDE4 applications.
+kde4-base_src_compile() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ cmake-utils_src_compile "$@"
+}
+
+# @FUNCTION: kde4-base_src_test
+# @DESCRIPTION:
+# Function for testing KDE4 applications.
+kde4-base_src_test() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local kded4_pid
+
+ _test_runner() {
+ if [[ -n "${VIRTUALDBUS_TEST}" ]]; then
+ export $(dbus-launch)
+ kded4 2>&1 > /dev/null &
+ kded4_pid=$!
+ fi
+
+ cmake-utils_src_test
+ }
+
+ # When run as normal user during ebuild development with the ebuild command, the
+ # kde tests tend to access the session DBUS. This however is not possible in a real
+ # emerge or on the tinderbox.
+ # > make sure it does not happen, so bad tests can be recognized and disabled
+ unset DBUS_SESSION_BUS_ADDRESS DBUS_SESSION_BUS_PID
+
+ # Override this value, set in kde4-base_src_configure()
+ mycmakeargs+=(-DKDE4_BUILD_TESTS=ON)
+ cmake-utils_src_configure
+ kde4-base_src_compile
+
+ if [[ ${VIRTUALX_REQUIRED} == always || ${VIRTUALX_REQUIRED} == test ]]; then
+ # check for sanity if anyone already redefined VIRTUALX_COMMAND from the default
+ if [[ ${VIRTUALX_COMMAND} != emake ]]; then
+ # surprise- we are already INSIDE virtualmake!!!
+ debug-print "QA Notice: This version of kde4-base.eclass includes the virtualx functionality."
+ debug-print " You may NOT set VIRTUALX_COMMAND or call virtualmake from the ebuild."
+ debug-print " Setting VIRTUALX_REQUIRED is completely sufficient. See the"
+ debug-print " kde4-base.eclass docs for details... Applying workaround."
+ _test_runner
+ else
+ virtx _test_runner
+ fi
+ else
+ _test_runner
+ fi
+
+ if [ -n "${kded4_pid}" ] ; then
+ kill ${kded4_pid}
+ fi
+
+ if [ -n "${DBUS_SESSION_BUS_PID}" ] ; then
+ kill ${DBUS_SESSION_BUS_PID}
+ fi
+}
+
+# @FUNCTION: kde4-base_src_install
+# @DESCRIPTION:
+# Function for installing KDE4 applications.
+kde4-base_src_install() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ -n ${KMSAVELIBS} ]] ; then
+ install_library_dependencies
+ fi
+
+ # Install common documentation of KDE4 applications
+ local doc
+ if ! has kde4-meta ${INHERITED}; then
+ for doc in "${S}"/{AUTHORS,CHANGELOG,ChangeLog*,README*,NEWS,TODO,HACKING}; do
+ [[ -f ${doc} && -s ${doc} ]] && dodoc "${doc}"
+ done
+ for doc in "${S}"/*/{AUTHORS,CHANGELOG,ChangeLog*,README*,NEWS,TODO,HACKING}; do
+ [[ -f ${doc} && -s ${doc} ]] && newdoc "${doc}" "$(basename $(dirname ${doc})).$(basename ${doc})"
+ done
+ fi
+
+ cmake-utils_src_install
+
+ # We don't want ${PREFIX}/share/doc/HTML to be compressed,
+ # because then khelpcenter can't find the docs
+ [[ -d ${ED}/${PREFIX}/share/doc/HTML ]] &&
+ docompress -x ${PREFIX}/share/doc/HTML
+}
+
+# @FUNCTION: kde4-base_pkg_preinst
+# @DESCRIPTION:
+# Function storing icon caches
+kde4-base_pkg_preinst() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ gnome2_icon_savelist
+ if [[ ${KDE_BUILD_TYPE} == live && ${KDE_SCM} == svn ]]; then
+ subversion_pkg_preinst
+ fi
+}
+
+# @FUNCTION: kde4-base_pkg_postinst
+# @DESCRIPTION:
+# Function to rebuild the KDE System Configuration Cache after an application has been installed.
+kde4-base_pkg_postinst() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
+ gnome2_icon_cache_update
+ fi
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ buildsycoca
+
+ if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then
+ if [[ ${KDE_BUILD_TYPE} = live ]]; then
+ echo
+ einfo "WARNING! This is an experimental live ebuild of ${CATEGORY}/${PN}"
+ einfo "Use it at your own risk."
+ einfo "Do _NOT_ file bugs at bugs.gentoo.org because of this ebuild!"
+ echo
+ fi
+ fi
+}
+
+# @FUNCTION: kde4-base_pkg_postrm
+# @DESCRIPTION:
+# Function to rebuild the KDE System Configuration Cache after an application has been removed.
+kde4-base_pkg_postrm() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
+ gnome2_icon_cache_update
+ fi
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+ buildsycoca
+}
+
+fi
diff --git a/eclass/kde4-functions.eclass b/eclass/kde4-functions.eclass
new file mode 100644
index 0000000..98f972c
--- /dev/null
+++ b/eclass/kde4-functions.eclass
@@ -0,0 +1,431 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @DEAD
+# Removal on 2018-05-03.
+# @ECLASS: kde4-functions.eclass
+# @MAINTAINER:
+# kde@gentoo.org
+# @BLURB: Common ebuild functions for KDE 4 packages
+# @DESCRIPTION:
+# This eclass contains all functions shared by the different eclasses,
+# for KDE 4 ebuilds.
+
+if [[ -z ${_KDE4_FUNCTIONS_ECLASS} ]]; then
+_KDE4_FUNCTIONS_ECLASS=1
+
+inherit versionator
+
+# @ECLASS-VARIABLE: EAPI
+# @DESCRIPTION:
+# Currently kde4 eclasses support EAPI 5 and 6.
+case ${EAPI} in
+ 5|6) : ;;
+ *) die "EAPI=${EAPI:-0} is not supported" ;;
+esac
+
+# @ECLASS-VARIABLE: KDE_OVERRIDE_MINIMAL
+# @DESCRIPTION:
+# For use only in very few well-defined cases; normally it should be unset.
+# If this variable is set, all calls to add_kdebase_dep return a dependency on
+# at least this version, independent of the version of the package itself.
+# If you know exactly that one specific NEW KDE component builds and runs fine
+# with all the rest of KDE at an OLDER version, you can set this old version here.
+# Warning- may lead to general instability and kill your pet targh.
+
+# @ECLASS-VARIABLE: KDEBASE
+# @DESCRIPTION:
+# This gets set to a non-zero value when a package is considered a kde or
+# kdevelop ebuild.
+if [[ ${CATEGORY} = kde-base || ${CATEGORY} == kde-plasma || ${CATEGORY} = kde-apps || ${CATEGORY} = kde-frameworks ]]; then
+ debug-print "${ECLASS}: KDEBASE ebuild recognized"
+ KDEBASE=kde-base
+elif [[ ${KMNAME-${PN}} = kdevelop ]]; then
+ KDEBASE=kdevelop
+fi
+
+debug-print "${ECLASS}: ${KDEBASE} ebuild recognized"
+
+# determine the build type
+if [[ ${PV} = *9999* ]]; then
+ KDE_BUILD_TYPE="live"
+else
+ KDE_BUILD_TYPE="release"
+fi
+export KDE_BUILD_TYPE
+
+# Set reponame and SCM for modules that have fully migrated to git
+# (hack - it's here because it needs to be before SCM inherits from kde4-base)
+if [[ ${KDE_BUILD_TYPE} == live ]]; then
+ case "${KMNAME}" in
+ kdebase-workspace)
+ EGIT_REPONAME=${EGIT_REPONAME:=kde-workspace}
+ ;;
+ kdebase-runtime)
+ EGIT_REPONAME=${EGIT_REPONAME:=kde-runtime}
+ ;;
+ esac
+fi
+
+# @ECLASS-VARIABLE: KDE_SCM
+# @DESCRIPTION:
+# If this is a live package which scm does it use
+# Everything else uses git by default
+KDE_SCM="${KDE_SCM:-git}"
+case ${KDE_SCM} in
+ svn|git) ;;
+ *) die "KDE_SCM: ${KDE_SCM} is not supported" ;;
+esac
+
+# @FUNCTION: kde4_lingua_to_l10n
+# @USAGE: <lingua>...
+# @INTERNAL
+# @DESCRIPTION:
+# Output l10n flag name(s) (without prefix(es)) appropriate for given KDE
+# locale(s).
+kde4_lingua_to_l10n() {
+ local l
+ for l; do
+ case ${l} in
+ ca@valencia) echo ca-valencia;;
+ sr@ijekavian) echo sr-ijekavsk;;
+ sr@ijekavianlatin) echo sr-Latn-ijekavsk;;
+ sr@latin|sr@Latn) echo sr-Latn;;
+ uz@cyrillic) echo uz-Cyrl;;
+ *@*) die "${FUNCNAME}: Unhandled KDE_LINGUAS: ${l}";;
+ *) echo "${l/_/-}";;
+ esac
+ done
+}
+
+# @ECLASS-VARIABLE: KDE_LINGUAS
+# @DESCRIPTION:
+# This is a whitespace-separated list of translations this ebuild supports.
+# These translations are automatically added to IUSE. Therefore ebuilds must set
+# this variable before inheriting any eclasses. To enable only selected
+# translations, ebuilds must call enable_selected_linguas(). kde4-{base,meta}.eclass does
+# this for you.
+#
+# Example: KDE_LINGUAS="de en_GB nl"
+if [[ ${KDE_BUILD_TYPE} != live || -n ${KDE_LINGUAS_LIVE_OVERRIDE} ]]; then
+ for _lingua in $(kde4_lingua_to_l10n ${KDE_LINGUAS}); do
+ IUSE="${IUSE} l10n_${_lingua}"
+ done
+fi
+
+# @FUNCTION: buildsycoca
+# @DESCRIPTION:
+# Function to rebuild the KDE System Configuration Cache.
+# All KDE ebuilds should run this in pkg_postinst and pkg_postrm.
+buildsycoca() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # We no longer need to run kbuildsycoca4, as kded does that automatically, as needed
+
+ # fix permission for some directories
+ for x in usr/share/{config,kde4}; do
+ DIRS=${EROOT}usr
+ [[ -d "${EROOT}${x}" ]] || break # nothing to do if directory does not exist
+ # fixes Bug 318237
+ if use userland_BSD ; then
+ [[ $(stat -f %p "${EROOT}${x}") != 40755 ]]
+ local stat_rtn="$?"
+ else
+ [[ $(stat --format=%a "${EROOT}${x}") != 755 ]]
+ local stat_rtn=$?
+ fi
+ if [[ $stat_rtn != 1 ]] ; then
+ ewarn "QA Notice:"
+ ewarn "Package ${PN} is breaking ${EROOT}${x} permissions."
+ ewarn "Please report this issue to gentoo bugzilla."
+ einfo "Permissions will get adjusted automatically now."
+ find "${EROOT}${x}" -type d -print0 | xargs -0 chmod 755
+ fi
+ done
+}
+
+# @FUNCTION: comment_all_add_subdirectory
+# @USAGE: [list of directory names]
+# @DESCRIPTION:
+# Recursively comment all add_subdirectory instructions in listed directories,
+# except those in cmake/.
+comment_all_add_subdirectory() {
+ find "$@" -name CMakeLists.txt -print0 | grep -vFzZ "./cmake" | \
+ xargs -0 sed -i \
+ -e '/^[[:space:]]*add_subdirectory/s/^/#DONOTCOMPILE /' \
+ -e '/^[[:space:]]*ADD_SUBDIRECTORY/s/^/#DONOTCOMPILE /' \
+ -e '/^[[:space:]]*macro_optional_add_subdirectory/s/^/#DONOTCOMPILE /' \
+ -e '/^[[:space:]]*MACRO_OPTIONAL_ADD_SUBDIRECTORY/s/^/#DONOTCOMPILE /' \
+ || die "${LINENO}: Initial sed died"
+}
+
+# @FUNCTION: enable_selected_linguas
+# @DESCRIPTION:
+# Enable translations based on L10N settings and translations supported by
+# the package (see KDE_LINGUAS). By default, translations are found in "${S}"/po
+# but this default can be overridden by defining KDE_LINGUAS_DIR.
+enable_selected_linguas() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local x
+
+ # @ECLASS-VARIABLE: KDE_LINGUAS_DIR
+ # @DESCRIPTION:
+ # Specified folder where application translations are located.
+ # Can be defined as array of folders where translations are located.
+ # Note that space separated list of dirs is not supported.
+ # Default value is set to "po".
+ if [[ "$(declare -p KDE_LINGUAS_DIR 2>/dev/null 2>&1)" == "declare -a"* ]]; then
+ debug-print "$FUNCNAME: we have these subfolders defined: ${KDE_LINGUAS_DIR}"
+ for x in ${KDE_LINGUAS_DIR[@]}; do
+ _enable_selected_linguas_dir ${x}
+ done
+ else
+ KDE_LINGUAS_DIR=${KDE_LINGUAS_DIR:="po"}
+ _enable_selected_linguas_dir ${KDE_LINGUAS_DIR}
+ fi
+}
+
+# @FUNCTION: enable_selected_doc_linguas
+# @DESCRIPTION:
+# Enable only selected L10N enabled doc folders.
+enable_selected_doc_linguas() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # @ECLASS-VARIABLE: KDE_DOC_DIRS
+ # @DESCRIPTION:
+ # Variable specifying whitespace separated patterns for documentation locations.
+ # Default is "doc/%lingua"
+ KDE_DOC_DIRS=${KDE_DOC_DIRS:='doc/%lingua'}
+ local linguas
+ for pattern in ${KDE_DOC_DIRS}; do
+
+ local handbookdir=`dirname ${pattern}`
+ local translationdir=`basename ${pattern}`
+ # Do filename pattern supplied, treat as directory
+ [[ ${handbookdir} = '.' ]] && handbookdir=${translationdir} && translationdir=
+ [[ -d ${handbookdir} ]] || die 'wrong doc dir specified'
+
+ if ! use handbook; then
+ # Disable whole directory
+ sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \
+ -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \
+ -i CMakeLists.txt || die 'failed to comment out all handbooks'
+ else
+ # Disable subdirectories recursively
+ comment_all_add_subdirectory "${handbookdir}"
+
+ # In certain packages, the default handbook is en_US instead of the usual en. Since there is no en_US 'translation',
+ # it makes no sense to add to KDE_LINGUAS which causes this type of handbook to not be installed.
+ if [[ -d "${handbookdir}/en_US" && ! -d "${handbookdir}/en" ]]; then
+ mv "${handbookdir}/en_US" "${handbookdir}/en" || die
+ sed -e "s/en_US/en/" -i "${handbookdir}/CMakeLists.txt"
+ fi
+
+ # Add requested translations
+ local lingua
+ for lingua in en ${KDE_LINGUAS}; do
+ if [[ ${lingua} = en ]] || use "l10n_$(kde4_lingua_to_l10n "${lingua}")"; then
+ if [[ -d ${handbookdir}/${translationdir//%lingua/${lingua}} ]]; then
+ sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${translationdir//%lingua/${lingua}}/s/^#DONOTCOMPILE //" \
+ -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${translationdir//%lingua/${lingua}}/s/^#DONOTCOMPILE //" \
+ -i "${handbookdir}"/CMakeLists.txt && ! has ${lingua} ${linguas} && linguas="${linguas} ${lingua}"
+ fi
+ fi
+ done
+ fi
+
+ done
+ [[ -n "${linguas}" ]] && einfo "Enabling handbook translations:${linguas}"
+}
+
+# Functions handling KMLOADLIBS and KMSAVELIBS
+
+# @FUNCTION: save_library_dependencies
+# @DESCRIPTION:
+# Add exporting CMake dependencies for current package
+save_library_dependencies() {
+ local depsfile="${T}/${PN}"
+
+ ebegin "Saving library dependencies in ${depsfile##*/}"
+ echo "EXPORT_LIBRARY_DEPENDENCIES(\"${depsfile}\")" >> "${S}/CMakeLists.txt" || \
+ die "Failed to save the library dependencies."
+ eend $?
+}
+
+# @FUNCTION: install_library_dependencies
+# @DESCRIPTION:
+# Install generated CMake library dependencies to /var/lib/kde
+install_library_dependencies() {
+ local depsfile="${T}/${PN}"
+
+ ebegin "Installing library dependencies as ${depsfile##*/}"
+ insinto /var/lib/kde
+ doins "${depsfile}" || die "Failed to install library dependencies."
+ eend $?
+}
+
+# @FUNCTION: load_library_dependencies
+# @DESCRIPTION:
+# Inject specified library dependencies in current package
+load_library_dependencies() {
+ local pn i depsfile
+ ebegin "Injecting library dependencies from '${KMLOADLIBS}'"
+
+ i=0
+ for pn in ${KMLOADLIBS} ; do
+ ((i++))
+ depsfile="${EPREFIX}/var/lib/kde/${pn}"
+ [[ -r ${depsfile} ]] || depsfile="${EPREFIX}/var/lib/kde/${pn}:$(get_kde_version)"
+ [[ -r ${depsfile} ]] || die "Depsfile '${depsfile}' not accessible. You probably need to reinstall ${pn}."
+ sed -i -e "${i}iINCLUDE(\"${depsfile}\")" "${S}/CMakeLists.txt" || \
+ die "Failed to include library dependencies for ${pn}"
+ done
+ eend $?
+}
+
+# @FUNCTION: add_kdeapps_dep
+# @DESCRIPTION:
+# Create proper dependency for kde-apps/ dependencies.
+# This takes 1 to 3 arguments. The first being the package name, the optional
+# second is additional USE flags to append, and the optional third is the
+# version to use instead of the automatic version (use sparingly).
+# The output of this should be added directly to DEPEND/RDEPEND, and may be
+# wrapped in a USE conditional (but not an || conditional without an extra set
+# of parentheses).
+add_kdeapps_dep() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local ver
+
+ if [[ -n ${2} ]] ; then
+ local use="[${2}]"
+ fi
+
+ if [[ -n ${3} ]]; then
+ ver=${3}
+ elif [[ -n ${KDE_OVERRIDE_MINIMAL} ]]; then
+ ver=${KDE_OVERRIDE_MINIMAL}
+ elif [[ ${KDEBASE} != kde-base ]]; then
+ ver=${KDE_MINIMAL}
+ # if building kde-apps, live master or stable-live branch,
+ # use the final SC version since there are no further general releases.
+ # except when it is kdepim split packages, which rely on same-version deps
+ elif [[ ${CATEGORY} == kde-apps || ${PV} == *9999 ]] && [[ ${KMNAME} != "kdepim" ]]; then
+ ver=4.14.3
+ else
+ ver=${PV}
+ fi
+
+ [[ -z ${1} ]] && die "Missing parameter"
+
+ echo " >=kde-apps/${1}-${ver}:4${use}"
+}
+
+# @FUNCTION: add_kdebase_dep
+# @DESCRIPTION:
+# Create proper dependency for kde-base/ dependencies.
+# This takes 1 to 3 arguments. The first being the package name, the optional
+# second is additional USE flags to append, and the optional third is the
+# version to use instead of the automatic version (use sparingly).
+# The output of this should be added directly to DEPEND/RDEPEND, and may be
+# wrapped in a USE conditional (but not an || conditional without an extra set
+# of parentheses).
+add_kdebase_dep() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local ver
+
+ if [[ -n ${2} ]] ; then
+ local use="[${2}]"
+ fi
+
+ if [[ -n ${3} ]]; then
+ ver=${3}
+ elif [[ -n ${KDE_OVERRIDE_MINIMAL} ]]; then
+ ver=${KDE_OVERRIDE_MINIMAL}
+ elif [[ ${KDEBASE} != kde-base ]]; then
+ ver=${KDE_MINIMAL}
+ # if building live master or kde-apps, use the final SC version
+ # since there are no further general releases.
+ elif [[ ${CATEGORY} == kde-apps || ${PV} == 9999 ]]; then
+ ver=4.14.3
+ # if building a live version branch (eg. 4.11.49.9999) use the major version
+ elif [[ ${PV} == *.9999 ]]; then
+ ver=$(get_kde_version)
+ else
+ ver=${PV}
+ fi
+
+ [[ -z ${1} ]] && die "Missing parameter"
+
+ echo " >=kde-base/${1}-${ver}:4${use}"
+}
+
+# local function to enable specified translations for specified directory
+# used from kde4-functions_enable_selected_linguas function
+_enable_selected_linguas_dir() {
+ local lingua linguas sr_mess wp
+ local dir=${1}
+
+ [[ -d ${dir} ]] || die "linguas dir \"${dir}\" does not exist"
+ comment_all_add_subdirectory "${dir}"
+ pushd "${dir}" > /dev/null || die
+
+ # fix all various crazy sr@Latn variations
+ # this part is only ease for ebuilds, so there wont be any die when this
+ # fail at any point
+ sr_mess="sr@latn sr@latin sr@Latin"
+ for wp in ${sr_mess}; do
+ [[ -e ${wp}.po ]] && mv "${wp}.po" "sr@Latn.po"
+ if [[ -d ${wp} ]]; then
+ # move dir and fix cmakelists
+ mv "${wp}" "sr@Latn"
+ sed -i \
+ -e "s:${wp}:sr@Latn:g" \
+ CMakeLists.txt
+ fi
+ done
+
+ for lingua in ${KDE_LINGUAS}; do
+ if [[ -e ${lingua}.po ]]; then
+ mv "${lingua}.po" "${lingua}.po.old"
+ fi
+ done
+
+ for lingua in ${KDE_LINGUAS}; do
+ if use "l10n_$(kde4_lingua_to_l10n ${lingua})" ; then
+ if [[ -d ${lingua} ]]; then
+ linguas="${linguas} ${lingua}"
+ sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
+ -e "/ADD_SUBDIRECTORY([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \
+ -i CMakeLists.txt || die "Sed to uncomment linguas_${lingua} failed."
+ fi
+ if [[ -e ${lingua}.po.old ]]; then
+ linguas="${linguas} ${lingua}"
+ mv "${lingua}.po.old" "${lingua}.po"
+ fi
+ fi
+ done
+ [[ -n ${linguas} ]] && echo ">>> Enabling languages: ${linguas}"
+
+ popd > /dev/null || die
+}
+
+# @FUNCTION: get_kde_version
+# @DESCRIPTION:
+# Translates an ebuild version into a major.minor KDE SC
+# release version. If no version is specified, ${PV} is used.
+get_kde_version() {
+ local ver=${1:-${PV}}
+ local major=$(get_major_version ${ver})
+ local minor=$(get_version_component_range 2 ${ver})
+ local micro=$(get_version_component_range 3 ${ver})
+ if [[ ${ver} == 9999 ]]; then
+ echo live
+ else
+ (( micro < 50 )) && echo ${major}.${minor} || echo ${major}.$((minor + 1))
+ fi
+}
+
+fi
diff --git a/eclass/kde4-meta.eclass b/eclass/kde4-meta.eclass
new file mode 100644
index 0000000..88d9ef8
--- /dev/null
+++ b/eclass/kde4-meta.eclass
@@ -0,0 +1,631 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+#
+# @DEAD
+# Removal on 2018-03-06.
+# @ECLASS: kde4-meta.eclass
+# @MAINTAINER:
+# kde@gentoo.org
+# @BLURB: Eclass for writing "split" KDE packages.
+# @DESCRIPTION:
+# This eclass provides all necessary functions for writing split KDE ebuilds.
+#
+# You must define KMNAME to use this eclass, and do so before inheriting it. All other variables are optional.
+# Do not include the same item in more than one of KMMODULE, KMMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY.
+
+if [[ -z ${_KDE4_META_ECLASS} ]]; then
+_KDE4_META_ECLASS=1
+
+[[ -z ${KMNAME} ]] && die "kde4-meta.eclass inherited but KMNAME not defined - broken ebuild"
+
+inherit kde4-base
+
+KDEMETA_EXPF="pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm"
+EXPORT_FUNCTIONS ${KDEMETA_EXPF}
+
+# Add dependencies that all packages in a certain module share.
+case ${KMNAME} in
+ kdepim|kdepim-runtime)
+ case ${PN} in
+ akregator|kaddressbook|kjots|kmail|knode|knotes|korganizer|ktimetracker)
+ IUSE+=" +kontact"
+ RDEPEND+=" kontact? ( $(add_kdeapps_dep kontact '' ${PV}) )"
+ ;;
+ esac
+ ;;
+esac
+
+DEPEND+=" ${COMMONDEPEND}"
+RDEPEND+=" ${COMMONDEPEND}"
+unset COMMONDEPEND
+
+debug-print "line ${LINENO} ${ECLASS}: DEPEND ${DEPEND} - after metapackage-specific dependencies"
+debug-print "line ${LINENO} ${ECLASS}: RDEPEND ${RDEPEND} - after metapackage-specific dependencies"
+
+# Useful to build kde4-meta style stuff from extragear/playground (plasmoids etc)
+case ${KDE_BUILD_TYPE} in
+ live)
+ if [[ ${KDE_SCM} == svn ]]; then
+ case ${KMNAME} in
+ extragear*|playground*)
+ ESVN_REPO_URI="${ESVN_MIRROR}/trunk/${KMNAME}"
+ ESVN_PROJECT="${KMNAME}${ESVN_PROJECT_SUFFIX}"
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+# @ECLASS-VARIABLE: KMNAME
+# @DESCRIPTION:
+# Name of the parent-module (e.g. kdebase, kdepim, ...). You _must_ set it
+# _before_ inheriting this eclass, (unlike the other parameters), since it's
+# used to set $SRC_URI.
+
+# @ECLASS-VARIABLE: KMMODULE
+# @DESCRIPTION:
+# Specify exactly one subdirectory of $KMNAME here. Defaults to $PN.
+# The subdirectory listed here is treated exactly like items in $KMEXTRA.
+#
+# Example: The ebuild name of "kdebase/l10n" is kde-base/kdebase-l10n, because
+# just 'l10n' would be too confusing. Hence it sets KMMODULE="l10n".
+
+# @ECLASS-VARIABLE: KMNOMODULE
+# @DESCRIPTION:
+# If set to "true", $KMMODULE doesn't have to be defined.
+#
+# Example usage: If you're installing subdirectories of a package, like plugins,
+# you mark the top subdirectory (containing the package) as $KMEXTRACTONLY, and
+# set KMNOMODULE="true".
+if [[ -z ${KMMODULE} ]] && [[ ${KMNOMODULE} != true ]]; then
+ KMMODULE=${PN}
+fi
+
+# @ECLASS-VARIABLE: KMEXTRA
+# @DESCRIPTION:
+# All subdirectories listed here will be extracted, compiled & installed.
+# $KMMODULE is always added to $KMEXTRA.
+# If KDE_HANDBOOK is 'always' or 'optional' and handbook USE-flag is set, and if this
+# directory exists, then "doc/$KMMODULE" is added to $KMEXTRA. If there's additional
+# documentation in different subdirectories, it should be added to KMEXTRA manually..
+
+# @ECLASS-VARIABLE: KMCOMPILEONLY
+# @DESCRIPTION:
+# All subdirectories listed here will be extracted & compiled, but not installed.
+
+# TODO: better formulation may be needed
+# @ECLASS-VARIABLE: KMEXTRACTONLY
+# @DESCRIPTION:
+# All subdirectories listed here will be extracted, but neither compiled nor installed.
+# This can be used to avoid compilation in a subdirectory of a directory in $KMMODULE or $KMEXTRA
+
+# @ECLASS-VARIABLE: KMTARPARAMS
+# @DESCRIPTION:
+# Specify extra parameters to pass to tar, in kde4-meta_src_extract.
+# '-xpf -j' are passed to tar by default.
+
+# @FUNCTION: kde4-meta_pkg_setup
+# @DESCRIPTION:
+# Currently calls its equivalent in kde4-base.eclass(5) and checks the gcc version.
+# Use this one in split ebuilds.
+kde4-meta_pkg_setup() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ kde4-base_pkg_setup
+}
+
+# @FUNCTION: kde4-meta_src_unpack
+# @DESCRIPTION:
+# This function unpacks the source for split ebuilds.
+# Further more is processed in kde4-meta_src_extract
+kde4-meta_src_unpack() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ ${KDE_BUILD_TYPE} = live ]]; then
+ case "${KDE_SCM}" in
+ svn)
+ S="${WORKDIR}/${P}"
+ mkdir -p "${S}"
+ ESVN_RESTRICT="export" subversion_src_unpack
+ subversion_wc_info
+ subversion_bootstrap
+ ;;
+ git)
+ git-r3_src_unpack
+ ;;
+ esac
+ fi
+ kde4-meta_src_extract
+}
+
+# @FUNCTION: kde4-meta_src_extract
+# @DESCRIPTION:
+# A function to extract the source for a split KDE ebuild.
+# Also see KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY and
+# KMTARPARAMS.
+kde4-meta_src_extract() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ ${KDE_BUILD_TYPE} = live ]]; then
+ # Export working copy to ${S}
+ einfo "Exporting parts of working copy to ${S}"
+ kde4-meta_create_extractlists
+
+ case ${KDE_SCM} in
+ svn)
+ local rsync_options subdir targetdir wc_path escm
+
+ rsync_options="--group --links --owner --perms --quiet --exclude=.svn/ --exclude=.git/"
+ wc_path="${ESVN_WC_PATH}"
+ escm="{ESVN}"
+
+ # Copy ${KMNAME} non-recursively (toplevel files)
+ rsync ${rsync_options} "${wc_path}"/* "${S}" \
+ || die "${escm}: can't export toplevel files to '${S}'."
+ # Copy cmake directory
+ if [[ -d "${wc_path}/cmake" ]]; then
+ rsync --recursive ${rsync_options} "${wc_path}/cmake" "${S}" \
+ || die "${escm}: can't export cmake files to '${S}'."
+ fi
+ # Copy all subdirectories
+ for subdir in $(_list_needed_subdirectories); do
+ targetdir=""
+ if [[ $subdir = doc/* && ! -e "$wc_path/$subdir" ]]; then
+ continue
+ fi
+
+ [[ ${subdir%/} = */* ]] && targetdir=${subdir%/} && targetdir=${targetdir%/*} && mkdir -p "${S}/${targetdir}"
+ rsync --recursive ${rsync_options} "${wc_path}/${subdir%/}" "${S}/${targetdir}" \
+ || die "${escm}: can't export subdirectory '${subdir}' to '${S}/${targetdir}'."
+ done
+ ;;
+ esac
+ else
+ local abort tarball tarfile f extractlist postfix
+
+ if [[ ${PV} =~ 4.4.11 ]]; then
+ postfix="bz2"
+ KMTARPARAMS+=" --bzip2"
+ else
+ postfix="xz"
+ KMTARPARAMS+=" --xz"
+ fi
+
+ tarball="${KMNAME}-${PV}.tar.${postfix}"
+
+ # Full path to source tarball
+ tarfile="${DISTDIR}/${tarball}"
+
+ # Detect real toplevel dir from tarball name - it will be used upon extraction
+ # and in _list_needed_subdirectories
+ topdir="${tarball%.tar.*}/"
+
+ ebegin "Unpacking parts of ${tarball} to ${WORKDIR}"
+
+ kde4-meta_create_extractlists
+
+ for f in cmake/ CMakeLists.txt ConfigureChecks.cmake config.h.cmake
+ do
+ extractlist+=" ${topdir}${f}"
+ done
+ extractlist+=" $(_list_needed_subdirectories)"
+
+ pushd "${WORKDIR}" > /dev/null || die
+
+ # @ECLASS-VARIABLE: KDE4_STRICTER
+ # @DESCRIPTION:
+ # Print out all issues found executing tar / kmextract files
+ # Set on if you want to find issues in kde-base ebuild unpack sequences
+ [[ -n ${KDE4_STRICTER} ]] && echo 'tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist}'
+ tar -xpf "${tarfile}" ${KMTARPARAMS} ${extractlist} 2> /dev/null || echo "tar extract command failed at least partially - continuing anyway"
+
+ # Default $S is based on $P; rename the extracted directory to match $S if necessary
+ if [[ ${KMNAME} != ${PN} ]]; then
+ mv ${topdir} ${P} || die "Died while moving \"${topdir}\" to \"${P}\""
+ fi
+
+ popd > /dev/null || die
+
+ eend $?
+
+ if [[ -n ${KDE4_STRICTER} ]]; then
+ for f in $(_list_needed_subdirectories fatal); do
+ if [[ ! -e ${S}/${f#*/} ]]; then
+ eerror "'${f#*/}' is missing"
+ abort=true
+ fi
+ done
+ [[ -n ${abort} ]] && die "There were missing files."
+ fi
+
+ # We don't need it anymore
+ unset topdir
+ fi
+}
+
+# @FUNCTION: kde4-meta_create_extractlists
+# @DESCRIPTION:
+# Create lists of files and subdirectories to extract.
+# Also see descriptions of KMMODULE, KMNOMODULE, KMEXTRA, KMCOMPILEONLY,
+# KMEXTRACTONLY and KMTARPARAMS.
+kde4-meta_create_extractlists() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # Add default handbook locations
+ # FIXME - legacy code - remove when 4.4.5 is gone or preferrably port 4.4.5.
+ if [[ $(get_kde_version) < 4.5 ]] && use_if_iuse handbook && [[ -z ${KMNOMODULE} ]]; then
+ # We use the basename of $KMMODULE because $KMMODULE can contain
+ # the path to the module subdirectory.
+ KMEXTRA_NONFATAL+="
+ doc/${KMMODULE##*/}"
+ fi
+
+ # Add default handbook locations
+ if [[ -z ${KMNOMODULE} ]] && ( [[ ${KDE_HANDBOOK} == always ]] || ( [[ ${KDE_HANDBOOK} == optional ]] && use handbook ) ); then
+ KMEXTRA_NONFATAL+=" doc/${KMMODULE##*/}"
+ fi
+
+ # Add some CMake-files to KMEXTRACTONLY.
+ # Note that this actually doesn't include KMEXTRA handling.
+ # In those cases you should care to add the relevant files to KMEXTRACTONLY
+ case ${KMNAME} in
+ kde-baseapps)
+ KMEXTRACTONLY+="
+ CTestConfig.cmake
+ config-apps.h.cmake
+ ConfigureChecks.cmake"
+ ;;
+ kde-runtime)
+ KMEXTRACTONLY+="
+ cmake/modules/
+ CTestConfig.cmake
+ config-runtime.h.cmake"
+ ;;
+ kde-workspace)
+ KMEXTRACTONLY+="
+ cmake/modules/
+ config-unix.h.cmake
+ ConfigureChecks.cmake
+ config-workspace.h.cmake
+ config-X11.h.cmake
+ startkde.cmake
+ KDE4WorkspaceConfig.cmake.in"
+ ;;
+ kdepim)
+ if [[ ${PN} != libkdepim ]]; then
+ KMEXTRACTONLY+="
+ libkdepim/"
+ fi
+ KMEXTRACTONLY+="
+ config-enterprise.h.cmake
+ kleopatra/ConfigureChecks.cmake
+ CTestCustom.cmake
+ kdepim-version.h.cmake
+ kdepim-version.h"
+ if use_if_iuse kontact; then
+ KMEXTRA+="
+ kontact/plugins/${PLUGINNAME:-${PN}}/"
+ fi
+ ;;
+ esac
+
+ debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME}: KMEXTRACTONLY ${KMEXTRACTONLY}"
+}
+
+_list_needed_subdirectories() {
+ local i j kmextra kmextra_expanded kmmodule_expanded kmcompileonly_expanded extractlist
+
+ # We expand KMEXTRA by adding CMakeLists.txt files
+ kmextra="${KMEXTRA}"
+ [[ ${1} != fatal ]] && kmextra+=" ${KMEXTRA_NONFATAL}"
+ for i in ${kmextra}; do
+ kmextra_expanded+=" ${i}"
+ j=$(dirname ${i})
+ while [[ ${j} != "." ]]; do
+ kmextra_expanded+=" ${j}/CMakeLists.txt";
+ j=$(dirname ${j})
+ done
+ done
+
+ # Expand KMMODULE
+ if [[ -n ${KMMODULE} ]]; then
+ kmmodule_expanded="${KMMODULE}"
+ j=$(dirname ${KMMODULE})
+ while [[ ${j} != "." ]]; do
+ kmmodule_expanded+=" ${j}/CMakeLists.txt";
+ j=$(dirname ${j})
+ done
+ fi
+
+ # Expand KMCOMPILEONLY
+ for i in ${KMCOMPILEONLY}; do
+ kmcompileonly_expanded+=" ${i}"
+ j=$(dirname ${i})
+ while [[ ${j} != "." ]]; do
+ kmcompileonly_expanded+=" ${j}/CMakeLists.txt";
+ j=$(dirname ${j})
+ done
+ done
+
+ debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmextra_expanded: ${kmextra_expanded}"
+ debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmmodule_expanded: ${kmmodule_expanded}"
+ debug-print "line ${LINENO} ${ECLASS} ${FUNCNAME} - kmcompileonly_expanded: ${kmcompileonly_expanded}"
+
+ # Create final list of stuff to extract
+ # We append topdir only when specified (usually for tarballs)
+ for i in ${kmmodule_expanded} ${kmextra_expanded} ${kmcompileonly_expanded} \
+ ${KMEXTRACTONLY}
+ do
+ extractlist+=" ${topdir}${i}"
+ done
+
+ echo ${extractlist}
+}
+
+# @FUNCTION: kde4-meta_src_prepare
+# @DESCRIPTION:
+# Meta-package build system configuration handling - commenting out targets, etc..
+kde4-meta_src_prepare() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ kde4-meta_change_cmakelists
+ kde4-base_src_prepare
+}
+
+# @FUNCTION: _change_cmakelists_parent_dirs
+# @DESCRIPTION:
+# Adjust CMakeLists.txt to shadow subdirectories
+# that are not required for the build.
+_change_cmakelists_parent_dirs() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ local _olddir _dir
+ _dir="${S}"/${1}
+ until [[ ${_dir} == ${S} ]]; do
+ _olddir=$(basename "${_dir}")
+ _dir=$(dirname "${_dir}")
+ debug-print "${LINENO}: processing ${_dir} CMakeLists.txt searching for ${_olddir}"
+ if [[ -f ${_dir}/CMakeLists.txt ]]; then
+ sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \
+ -e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${_olddir}[[:space:]]*)/s/#DONOTCOMPILE //g" \
+ -i ${_dir}/CMakeLists.txt || die "${LINENO}: died in ${FUNCNAME} while processing ${_dir}"
+ fi
+ done
+}
+
+# @FUNCTION: kde4-meta_change_cmakelists
+# @DESCRIPTION:
+# Adjust CMakeLists.txt to comply to our splitting.
+kde4-meta_change_cmakelists() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ pushd "${S}" > /dev/null || die
+
+ comment_all_add_subdirectory ./
+
+ # Restore "add_subdirectory( cmake )" in ${S}/CMakeLists.txt
+ if [[ -f CMakeLists.txt ]]; then
+ sed -e '/add_subdirectory[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \
+ -e '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*cmake[[:space:]]*)/s/^#DONOTCOMPILE //' \
+ -i CMakeLists.txt || die "${LINENO}: cmake sed died"
+ fi
+
+ # Restore "add_subdirectory( ${ ..." (this is done in kdesdk)
+ if [[ -f CMakeLists.txt ]]; then
+ sed -e '/add_subdirectory[[:space:]]*([[:space:]]*\${/s/^#DONOTCOMPILE //' \
+ -e '/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*\${/s/^#DONOTCOMPILE //' \
+ -i CMakeLists.txt || die "${LINENO}: cmake sed died"
+ fi
+
+ if [[ -z ${KMNOMODULE} ]]; then
+ # Restore "add_subdirectory" in $KMMODULE subdirectories
+ find "${S}"/${KMMODULE} -name CMakeLists.txt -print0 | \
+ xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
+ die "${LINENO}: died in KMMODULE section"
+ _change_cmakelists_parent_dirs ${KMMODULE}
+ fi
+
+ local i
+
+ # KMEXTRACTONLY section - Some ebuilds need to comment out some subdirs in KMMODULE and they use KMEXTRACTONLY
+ for i in ${KMEXTRACTONLY}; do
+ if [[ -d ${i} && -f ${i}/../CMakeLists.txt ]]; then
+ sed -e "/([[:space:]]*$(basename $i)[[:space:]]*)/s/^/#DONOTCOMPILE /" \
+ -i ${i}/../CMakeLists.txt || \
+ die "${LINENO}: sed died while working in the KMEXTRACTONLY section while processing ${i}"
+ fi
+ done
+
+ # KMCOMPILEONLY
+ for i in ${KMCOMPILEONLY}; do
+ debug-print "${LINENO}: KMCOMPILEONLY, processing ${i}"
+ # Uncomment "add_subdirectory" instructions inside $KMCOMPILEONLY, then comment "install" instructions.
+ find "${S}"/${i} -name CMakeLists.txt -print0 | \
+ xargs -0 sed -i \
+ -e 's/^#DONOTCOMPILE //g' \
+ -e '/install(.*)/I{s/^/#DONOTINSTALL /;}' \
+ -e '/^install(/,/)/I{s/^/#DONOTINSTALL /;}' \
+ -e '/kde4_install_icons(.*)/I{s/^/#DONOTINSTALL /;}' || \
+ die "${LINENO}: sed died in the KMCOMPILEONLY section while processing ${i}"
+ _change_cmakelists_parent_dirs ${i}
+ done
+
+ # KMEXTRA section
+ for i in ${KMEXTRA}; do
+ debug-print "${LINENO}: KMEXTRA section, processing ${i}"
+ find "${S}"/${i} -name CMakeLists.txt -print0 | \
+ xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
+ die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}"
+ _change_cmakelists_parent_dirs ${i}
+ done
+ # KMEXTRA_NONFATAL section
+ for i in ${KMEXTRA_NONFATAL}; do
+ if [[ -d "${S}"/${i} ]]; then
+ find "${S}"/${i} -name CMakeLists.txt -print0 | \
+ xargs -0 sed -i -e 's/^#DONOTCOMPILE //g' || \
+ die "${LINENO}: sed died uncommenting add_subdirectory instructions in KMEXTRA section while processing ${i}"
+ _change_cmakelists_parent_dirs ${i}
+ fi
+ done
+
+ case ${KMNAME} in
+ kde-workspace)
+ # COLLISION PROTECT section
+ # Install the startkde script just once, as a part of kde-plasma/kdebase-startkde,
+ # not as a part of every package.
+ if [[ ${PN} != kdebase-startkde && -f CMakeLists.txt ]]; then
+ # The startkde script moved to kdebase-workspace for KDE4 versions > 3.93.0.
+ sed -e '/startkde/s/^/#DONOTINSTALL /' \
+ -i CMakeLists.txt || die "${LINENO}: sed died in the kdebase-startkde collision prevention section"
+ fi
+ # Remove workspace target prefix in order to get direct linking to workspace libs
+ sed -e '/set(KDE4WORKSPACE_TARGET_PREFIX/s/^/#OVERRIDE /' \
+ -i CMakeLists.txt || die "${LINENO}: sed died in KDE4WORKSPACE_TARGET_PREFIX removal section"
+ # Strip EXPORT feature section from workspace for KDE4 versions > 4.1.82
+ if [[ ${PN} != libkworkspace ]]; then
+ sed -e '/install(FILES ${CMAKE_CURRENT_BINARY_DIR}\/KDE4WorkspaceConfig.cmake/,/^[[:space:]]*FILE KDE4WorkspaceLibraryTargets.cmake )[[:space:]]*^/d' \
+ -i CMakeLists.txt || die "${LINENO}: sed died in kde-workspace strip config install and fix EXPORT section"
+ fi
+ # <KDE/4.11
+ if [[ ${PN} != plasma-workspace ]]; then
+ sed -e '/KActivities/s/REQUIRED//' \
+ -i CMakeLists.txt || die "${LINENO}: sed died in kde-workspace dep reduction section"
+ fi
+ sed -e '/QImageBlitz/s/REQUIRED//' \
+ -i CMakeLists.txt || die "${LINENO}: sed died in kde-workspace dep reduction section 2"
+
+ # >=KDE/4.11
+ sed -e 's/TYPE REQUIRED/TYPE OPTIONAL/' -e 's/XCB REQUIRED/XCB/' -e 's/X11 REQUIRED/X11/' \
+ -e 's/message(FATAL_ERROR/message(/' -i CMakeLists.txt \
+ || die "${LINENO}: sed died in kde-workspace dep reduction section"
+ if [[ "${PN}" != "kwin" ]]; then
+ sed -i -e "/^ macro_log_feature(OPENGL_OR_ES_FOUND/s/TRUE/FALSE/" \
+ "${S}"/CMakeLists.txt || die "${LINENO}: sed died removing kde-workspace opengl dependency"
+ fi
+ ;;
+ kde-runtime)
+ sed -e 's/TYPE REQUIRED/TYPE OPTIONAL/' -e '/LibGcrypt/s/REQUIRED//' -i CMakeLists.txt \
+ || die "${LINENO}: sed died in kde-runtime dep reduction section"
+
+ # COLLISION PROTECT section
+ # Only install the kde4 script as part of kde-base/kdebase-data
+ if [[ ${PN} != kdebase-data && -f CMakeLists.txt ]]; then
+ sed -e '/^install(PROGRAMS[[:space:]]*[^[:space:]]*\/kde4[[:space:]]/s/^/#DONOTINSTALL /' \
+ -i CMakeLists.txt || die "Sed to exclude bin/kde4 failed"
+ fi
+ ;;
+ kdenetwork)
+ # Disable hardcoded kdepimlibs check
+ sed -e 's/find_package(KdepimLibs REQUIRED)/macro_optional_find_package(KdepimLibs)/' \
+ -i CMakeLists.txt || die "failed to disable hardcoded checks"
+ ;;
+ kdepim)
+ # Disable hardcoded checks
+ sed -r -e 's/TYPE REQUIRED/TYPE OPTIONAL/' -e '/find_package\(KdepimLibs/s/REQUIRED//' \
+ -e '/find_package\((KdepimLibs|Boost|QGpgme|Akonadi|ZLIB|Strigi|SharedDesktopOntologies|Soprano|Nepomuk)/{/macro_optional_/!s/find/macro_optional_&/}' \
+ -e '/macro_log_feature\((Boost|QGPGME|Akonadi|ZLIB|STRIGI|SHAREDDESKTOPONTOLOGIES|Soprano|Nepomuk)_FOUND/s/ TRUE / FALSE /' \
+ -e 's/if[[:space:]]*([[:space:]]*BUILD_.*)[[:space:]]*/if(1) # &/' \
+ -e 's/if[[:space:]]*([[:space:]]*[[:alnum:]]*_FOUND[[:space:]]*)[[:space:]]*$/if(1) # &/' \
+ -i CMakeLists.txt || die "failed to disable hardcoded checks"
+ # Disable broken or redundant build logic
+ if use_if_iuse kontact || [[ ${PN} = kontact ]]; then
+ sed -e 's/if[[:space:]]*([[:space:]]*BUILD_.*)[[:space:]]*$/if(1) # &/' \
+ -e 's/if[[:space:]]*([[:space:]]*[[:alnum:]]*_FOUND[[:space:]]*)[[:space:]]*$/if(1) # &/' \
+ -i kontact/plugins/CMakeLists.txt || die 'failed to override build logic'
+ fi
+ case ${PV} in
+ 4.4*)
+ case ${PN} in
+ kalarm|kmailcvt|kontact|korganizer|korn)
+ sed -n -e '/qt4_generate_dbus_interface(.*org\.kde\.kmail\.\(kmail\|mailcomposer\)\.xml/p' \
+ -e '/add_custom_target(kmail_xml /,/)/p' \
+ -i kmail/CMakeLists.txt || die "uncommenting xml failed"
+ _change_cmakelists_parent_dirs kmail
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+
+ popd > /dev/null || die
+}
+
+# @FUNCTION: kde4-meta_src_configure
+# @DESCRIPTION:
+# Currently just calls its equivalent in kde4-base.eclass(5). Use this one in split
+# ebuilds.
+kde4-meta_src_configure() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ kde4-base_src_configure
+}
+
+# @FUNCTION: kde4-meta_src_compile
+# @DESCRIPTION:
+# General function for compiling split KDE4 applications.
+# Overrides kde4-base_src_compile.
+kde4-meta_src_compile() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ kde4-base_src_compile "$@"
+}
+
+# @FUNCTION: kde4-meta_src_test
+# @DESCRIPTION:
+# Currently just calls its equivalent in kde4-base.eclass(5) if
+# I_KNOW_WHAT_I_AM_DOING is set. Use this in split ebuilds.
+kde4-meta_src_test() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ if [[ $I_KNOW_WHAT_I_AM_DOING ]]; then
+ kde4-base_src_test
+ else
+ einfo "Tests disabled"
+ fi
+}
+
+# @FUNCTION: kde4-meta_src_install
+# @DESCRIPTION:
+# Function for installing KDE4 split applications.
+kde4-meta_src_install() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ # Search ${S}/${KMMODULE} and install common documentation files found
+ local doc
+ for doc in "${S}/${KMMODULE}"/{AUTHORS,CHANGELOG,ChangeLog*,README*,NEWS,TODO,HACKING}; do
+ [[ -f "${doc}" ]] && [[ -s "${doc}" ]] && dodoc "${doc}"
+ done
+
+ kde4-base_src_install
+}
+
+# @FUNCTION: kde4-meta_pkg_preinst
+# @DESCRIPTION:
+# Invoke its equivalent in kde4-base.eclass.
+kde4-meta_pkg_preinst() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ kde4-base_pkg_preinst
+}
+
+# @FUNCTION: kde4-meta_pkg_postinst
+# @DESCRIPTION:
+# Invoke kbuildsycoca4.
+kde4-meta_pkg_postinst() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ kde4-base_pkg_postinst
+}
+
+# @FUNCTION: kde4-meta_pkg_postrm
+# @DESCRIPTION:
+# Currently just calls its equivalent in kde4-base.eclass(5). Use this in split
+# ebuilds.
+kde4-meta_pkg_postrm() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ kde4-base_pkg_postrm
+}
+
+fi
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2018-04-10 13:32 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2018-04-10 13:32 UTC (permalink / raw
To: gentoo-commits
commit: aa002ff2b1d20df6e834840ba118c73af5f6db07
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 10 13:31:58 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Apr 10 13:31:58 2018 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=aa002ff2
kde4*eclass: Drop maintainers to kde-sunset
eclass/kde4-base.eclass | 2 +-
eclass/kde4-functions.eclass | 2 +-
eclass/kde4-meta.eclass | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass
index 8abade2..a10dd0e 100644
--- a/eclass/kde4-base.eclass
+++ b/eclass/kde4-base.eclass
@@ -5,7 +5,7 @@
# Removal on 2018-05-03.
# @ECLASS: kde4-base.eclass
# @MAINTAINER:
-# kde@gentoo.org
+# kde-sunset overlay maintainers
# @BLURB: This eclass provides functions for kde 4.X ebuilds
# @DESCRIPTION:
# The kde4-base.eclass provides support for building KDE4 based ebuilds
diff --git a/eclass/kde4-functions.eclass b/eclass/kde4-functions.eclass
index 98f972c..35ff15d 100644
--- a/eclass/kde4-functions.eclass
+++ b/eclass/kde4-functions.eclass
@@ -5,7 +5,7 @@
# Removal on 2018-05-03.
# @ECLASS: kde4-functions.eclass
# @MAINTAINER:
-# kde@gentoo.org
+# kde-sunset overlay maintainers
# @BLURB: Common ebuild functions for KDE 4 packages
# @DESCRIPTION:
# This eclass contains all functions shared by the different eclasses,
diff --git a/eclass/kde4-meta.eclass b/eclass/kde4-meta.eclass
index 88d9ef8..7b67a63 100644
--- a/eclass/kde4-meta.eclass
+++ b/eclass/kde4-meta.eclass
@@ -5,7 +5,7 @@
# Removal on 2018-03-06.
# @ECLASS: kde4-meta.eclass
# @MAINTAINER:
-# kde@gentoo.org
+# kde-sunset overlay maintainers
# @BLURB: Eclass for writing "split" KDE packages.
# @DESCRIPTION:
# This eclass provides all necessary functions for writing split KDE ebuilds.
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2018-05-03 12:30 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2018-05-03 12:30 UTC (permalink / raw
To: gentoo-commits
commit: c84b751be40952ca568887c2cdab41153b436a6e
Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 27 06:14:19 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu May 3 12:28:05 2018 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=c84b751b
kde4-base.eclass: Transition deps to x11-base/xorg-proto
eclass/kde4-base.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass
index a10dd0e..5a9a49c 100644
--- a/eclass/kde4-base.eclass
+++ b/eclass/kde4-base.eclass
@@ -387,7 +387,7 @@ kdedepend="
dev-util/automoc
virtual/pkgconfig
>=x11-libs/libXtst-1.1.0
- x11-proto/xf86vidmodeproto
+ x11-base/xorg-proto
"
kderdepend=""
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2018-05-31 18:30 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2018-05-31 18:30 UTC (permalink / raw
To: gentoo-commits
commit: 064e397e494f0c7e96e2af79ae0da8a5604f5b1d
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu May 31 17:57:44 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu May 31 18:29:54 2018 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=064e397e
kde4-meta-pkg.eclass: Drop obsolete USE=aqua
eclass/kde4-meta-pkg.eclass | 1 -
1 file changed, 1 deletion(-)
diff --git a/eclass/kde4-meta-pkg.eclass b/eclass/kde4-meta-pkg.eclass
index 7f74338..c403137 100644
--- a/eclass/kde4-meta-pkg.eclass
+++ b/eclass/kde4-meta-pkg.eclass
@@ -20,7 +20,6 @@ inherit kde4-functions
HOMEPAGE="https://www.kde.org/"
LICENSE="metapackage"
-IUSE="aqua"
SLOT=4
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2018-05-31 18:30 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2018-05-31 18:30 UTC (permalink / raw
To: gentoo-commits
commit: 22c71e550e6e12a20663047f8a80ac3bdf7ef3d5
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu May 31 17:57:09 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu May 31 18:29:54 2018 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=22c71e55
kde4-functions-extra.eclass: Drop invalid aqua conditional
| 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
--git a/eclass/kde4-functions-extra.eclass b/eclass/kde4-functions-extra.eclass
index 168bf43..a6ad847 100644
--- a/eclass/kde4-functions-extra.eclass
+++ b/eclass/kde4-functions-extra.eclass
@@ -31,7 +31,11 @@ add_kdeplasma_dep() {
debug-print-function ${FUNCNAME} "$@"
local ver
+ local use=${2}
+ if [[ -n ${use} ]] ; then
+ use="[${use}]"
+ fi
if [[ -n ${3} ]]; then
ver=${3}
elif [[ -n ${KDE_OVERRIDE_MINIMAL} ]]; then
@@ -49,9 +53,7 @@ add_kdeplasma_dep() {
[[ -z ${1} ]] && die "Missing parameter"
- #FIXME
- # Drop aqua= from kf5 packages
- echo " >=kde-plasma/${1}-${ver}:4[aqua=${2:+,${2}}]"
+ echo " >=kde-plasma/${1}-${ver}:4${use}"
}
# @FUNCTION: add_kdeframeworks_dep
@@ -67,7 +69,11 @@ add_kdeframeworks_dep() {
debug-print-function ${FUNCNAME} "$@"
local ver
+ local use=${2}
+ if [[ -n ${use} ]] ; then
+ use="[${use}]"
+ fi
if [[ -n ${3} ]]; then
ver=${3}
elif [[ -n ${KDE_OVERRIDE_MINIMAL} ]]; then
@@ -85,9 +91,7 @@ add_kdeframeworks_dep() {
[[ -z ${1} ]] && die "Missing parameter"
- #FIXME
- # Drop aqua= from kf5 packages
- echo " >=kde-frameworks/${1}-${ver}:4[aqua=${2:+,${2}}]"
+ echo " >=kde-frameworks/${1}-${ver}:4${use}"
}
fi
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2018-05-31 20:31 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2018-05-31 20:31 UTC (permalink / raw
To: gentoo-commits
commit: e95bc6041cf9940cfecef2ffe5ed28dcd988a12c
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu May 31 20:31:11 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu May 31 20:31:11 2018 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=e95bc604
qt4*eclass: Import from Gentoo ebuild repository
eclass/qt4-build-multilib.eclass | 847 +++++++++++++++++++++++++++++++++++++++
eclass/qt4-r2.eclass | 139 +++++++
2 files changed, 986 insertions(+)
diff --git a/eclass/qt4-build-multilib.eclass b/eclass/qt4-build-multilib.eclass
new file mode 100644
index 0000000..7666936
--- /dev/null
+++ b/eclass/qt4-build-multilib.eclass
@@ -0,0 +1,847 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: qt4-build-multilib.eclass
+# @MAINTAINER:
+# qt@gentoo.org
+# @AUTHOR:
+# Davide Pesavento <pesa@gentoo.org>
+# @BLURB: Eclass for Qt4 split ebuilds with multilib support.
+# @DESCRIPTION:
+# This eclass contains various functions that are used when building Qt4.
+# Requires EAPI 5.
+
+case ${EAPI} in
+ 5) : ;;
+ *) die "qt4-build-multilib.eclass: unsupported EAPI=${EAPI:-0}" ;;
+esac
+
+inherit eutils flag-o-matic multilib multilib-minimal toolchain-funcs
+
+HOMEPAGE="https://www.qt.io/"
+LICENSE="|| ( LGPL-2.1 LGPL-3 GPL-3 ) FDL-1.3"
+SLOT="4"
+
+case ${PV} in
+ 4.?.9999)
+ # git stable branch
+ QT4_BUILD_TYPE="live"
+ EGIT_BRANCH=${PV%.9999}
+ ;;
+ *)
+ # official stable release
+ QT4_BUILD_TYPE="release"
+ MY_P=qt-everywhere-opensource-src-${PV/_/-}
+ SRC_URI="http://download.qt.io/official_releases/qt/${PV%.*}/${PV}/${MY_P}.tar.gz"
+ S=${WORKDIR}/${MY_P}
+ ;;
+esac
+
+EGIT_REPO_URI=(
+ "git://code.qt.io/qt/qt.git"
+ "https://code.qt.io/git/qt/qt.git"
+ "https://github.com/qtproject/qt.git"
+)
+[[ ${QT4_BUILD_TYPE} == live ]] && inherit git-r3
+
+if [[ ${PN} != qttranslations ]]; then
+ IUSE="aqua debug pch"
+ [[ ${PN} != qtxmlpatterns ]] && IUSE+=" +exceptions"
+fi
+
+DEPEND="
+ dev-lang/perl
+ virtual/pkgconfig[${MULTILIB_USEDEP}]
+"
+RDEPEND="
+ dev-qt/qtchooser
+"
+
+
+# src_{configure,compile,test,install} are inherited from multilib-minimal
+EXPORT_FUNCTIONS src_unpack src_prepare pkg_postinst pkg_postrm
+
+multilib_src_configure() { qt4_multilib_src_configure; }
+multilib_src_compile() { qt4_multilib_src_compile; }
+multilib_src_test() { qt4_multilib_src_test; }
+multilib_src_install() { qt4_multilib_src_install; }
+multilib_src_install_all() { qt4_multilib_src_install_all; }
+
+
+# @ECLASS-VARIABLE: PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array variable containing all the patches to be applied. This variable
+# is expected to be defined in the global scope of ebuilds. Make sure to
+# specify the full path. This variable is used in src_prepare phase.
+#
+# Example:
+# @CODE
+# PATCHES=(
+# "${FILESDIR}/mypatch.patch"
+# "${FILESDIR}/mypatch2.patch"
+# )
+# @CODE
+
+# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Space-separated list of directories that will be configured,
+# compiled, and installed. All paths must be relative to ${S}.
+
+# @ECLASS-VARIABLE: QCONFIG_ADD
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# List of options that must be added to QT_CONFIG in qconfig.pri
+
+# @ECLASS-VARIABLE: QCONFIG_REMOVE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# List of options that must be removed from QT_CONFIG in qconfig.pri
+
+# @ECLASS-VARIABLE: QCONFIG_DEFINE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# List of macros that must be defined in QtCore/qconfig.h
+
+
+###### Phase functions ######
+
+# @FUNCTION: qt4-build-multilib_src_unpack
+# @DESCRIPTION:
+# Unpacks the sources.
+qt4-build-multilib_src_unpack() {
+ if tc-is-gcc; then
+ if [[ $(gcc-major-version) -lt 4 ]] || \
+ [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ]]; then
+ ewarn
+ ewarn "Using a GCC version lower than 4.4 is not supported"
+ ewarn
+ fi
+ fi
+
+ if [[ ${PN} == qtwebkit ]]; then
+ eshopts_push -s extglob
+ if is-flagq '-g?(gdb)?([1-9])'; then
+ ewarn
+ ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)."
+ ewarn "You may experience really long compilation times and/or increased memory usage."
+ ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug."
+ ewarn "For more info check out https://bugs.gentoo.org/307861"
+ ewarn
+ fi
+ eshopts_pop
+ fi
+
+ case ${QT4_BUILD_TYPE} in
+ live) git-r3_src_unpack ;;
+ release) default ;;
+ esac
+}
+
+# @FUNCTION: qt4-build-multilib_src_prepare
+# @DESCRIPTION:
+# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix
+# the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in make.conf.
+qt4-build-multilib_src_prepare() {
+ if [[ ${PN} != qtcore ]]; then
+ # avoid unnecessary qmake recompilations
+ sed -i -e 's/^if true;/if false;/' configure \
+ || die "sed failed (skip qmake bootstrap)"
+ fi
+
+ # skip X11 tests in non-gui packages to avoid spurious dependencies
+ if has ${PN} qtbearer qtcore qtdbus qtscript qtsql qttest qttranslations qtxmlpatterns; then
+ sed -i -e '/^if.*PLATFORM_X11.*CFG_GUI/,/^fi$/d' configure \
+ || die "sed failed (skip X11 tests)"
+ fi
+
+ # Qt4 is not safe to build with C++14 (the new gcc-6 default).
+ # Upstream has addressed this for Qt5, but while we continue to
+ # support Qt4, we need to ensure everything is built in C++98 mode.
+ # See bugs 582522, 582618, 583662, 583744.
+ append-cxxflags -std=gnu++98
+
+ if [[ ${PN} == qtcore ]]; then
+ # Bug 373061
+ # qmake bus errors with -O2 or -O3 but -O1 works
+ if [[ ${CHOST} == *86*-apple-darwin* ]]; then
+ replace-flags -O[23] -O1
+ fi
+
+ # Bug 503500
+ # undefined reference with -Os and --as-needed
+ if use x86 || use_if_iuse abi_x86_32; then
+ replace-flags -Os -O2
+ fi
+ fi
+
+ if [[ ${PN} == qtdeclarative ]]; then
+ # Bug 551560
+ # gcc-4.8 ICE with -Os, fixed in 4.9
+ if use x86 && tc-is-gcc && [[ $(gcc-version) == 4.8 ]]; then
+ replace-flags -Os -O2
+ fi
+ fi
+
+ if [[ ${PN} == qtwebkit ]]; then
+ # Bug 550780
+ # various ICEs with graphite-related flags, gcc-5 works
+ if [[ $(gcc-major-version) -lt 5 ]]; then
+ filter-flags -fgraphite-identity -floop-strip-mine
+ fi
+ fi
+
+ # Bug 261632
+ if use ppc64; then
+ append-flags -mminimal-toc
+ fi
+
+ # Teach configure about gcc-6 and later
+ sed -i -e 's:5\*|:[5-9]*|:' \
+ configure || die "sed gcc version failed"
+
+ # Read also AR from the environment
+ sed -i -e 's/^SYSTEM_VARIABLES="/&AR /' \
+ configure || die "sed SYSTEM_VARIABLES failed"
+
+ # Reset QMAKE_*FLAGS_{RELEASE,DEBUG} variables,
+ # or they will override the user's flags (via .qmake.cache)
+ sed -i -e '/^SYSTEM_VARIABLES=/ i \
+ QMakeVar set QMAKE_CFLAGS_RELEASE\
+ QMakeVar set QMAKE_CFLAGS_DEBUG\
+ QMakeVar set QMAKE_CXXFLAGS_RELEASE\
+ QMakeVar set QMAKE_CXXFLAGS_DEBUG\
+ QMakeVar set QMAKE_LFLAGS_RELEASE\
+ QMakeVar set QMAKE_LFLAGS_DEBUG\n' \
+ configure || die "sed QMAKE_*FLAGS_{RELEASE,DEBUG} failed"
+
+ # Drop -nocache from qmake invocation in all configure tests, to ensure that the
+ # correct toolchain and build flags are picked up from config.tests/.qmake.cache
+ find config.tests/unix -name '*.test' -type f -execdir \
+ sed -i -e '/bin\/qmake/s/-nocache//' '{}' + || die "sed -nocache failed"
+
+ # compile.test needs additional patching so that it doesn't create another cache file
+ # inside the test subdir, which would incorrectly override config.tests/.qmake.cache
+ sed -i -e '/echo.*QT_BUILD_TREE.*\.qmake\.cache/d' \
+ -e '/bin\/qmake/s/ "$SRCDIR/ "QT_BUILD_TREE=$OUTDIR"&/' \
+ config.tests/unix/compile.test || die "sed compile.test failed"
+
+ # Delete references to the obsolete /usr/X11R6 directory
+ # On prefix, this also prevents looking at non-prefix stuff
+ sed -i -re '/^QMAKE_(LIB|INC)DIR(_X11|_OPENGL|)\s+/ s/=.*/=/' \
+ mkspecs/common/linux.conf \
+ mkspecs/$(qt4_get_mkspec)/qmake.conf \
+ || die "sed QMAKE_(LIB|INC)DIR failed"
+
+ if use_if_iuse aqua; then
+ sed -i \
+ -e '/^CONFIG/s:app_bundle::' \
+ -e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \
+ mkspecs/$(qt4_get_mkspec)/qmake.conf \
+ || die "sed failed (aqua)"
+
+ # we are crazy and build cocoa + qt3support
+ if { ! in_iuse qt3support || use qt3support; } && [[ ${CHOST##*-darwin} -ge 9 ]]; then
+ sed -i -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \
+ configure || die "sed failed (cocoa + qt3support)"
+ fi
+ fi
+
+ if [[ ${CHOST} == *-darwin* ]]; then
+ # Set FLAGS and remove -arch, since our gcc-apple is multilib crippled (by design)
+ sed -i \
+ -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
+ -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
+ -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=-headerpad_max_install_names ${LDFLAGS}:" \
+ -e "s:-arch\s\w*::g" \
+ mkspecs/common/g++-macx.conf \
+ || die "sed g++-macx.conf failed"
+
+ # Fix configure's -arch settings that appear in qmake/Makefile and also
+ # fix arch handling (automagically duplicates our -arch arg and breaks
+ # pch). Additionally disable Xarch support.
+ sed -i \
+ -e "s:-arch i386::" \
+ -e "s:-arch ppc::" \
+ -e "s:-arch x86_64::" \
+ -e "s:-arch ppc64::" \
+ -e "s:-arch \$i::" \
+ -e "/if \[ ! -z \"\$NATIVE_64_ARCH\" \]; then/,/fi/ d" \
+ -e "s:CFG_MAC_XARCH=yes:CFG_MAC_XARCH=no:g" \
+ -e "s:-Xarch_x86_64::g" \
+ -e "s:-Xarch_ppc64::g" \
+ configure mkspecs/common/gcc-base-macx.conf mkspecs/common/g++-macx.conf \
+ || die "sed -arch/-Xarch failed"
+
+ # On Snow Leopard don't fall back to 10.5 deployment target.
+ if [[ ${CHOST} == *-apple-darwin10 ]]; then
+ sed -i \
+ -e "s:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET.*:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.6:g" \
+ -e "s:-mmacosx-version-min=10.[0-9]:-mmacosx-version-min=10.6:g" \
+ configure mkspecs/common/g++-macx.conf \
+ || die "sed deployment target failed"
+ fi
+ fi
+
+ if [[ ${CHOST} == *-solaris* ]]; then
+ sed -i -e '/^QMAKE_LFLAGS_THREAD/a QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,' \
+ mkspecs/$(qt4_get_mkspec)/qmake.conf || die
+ fi
+
+ # apply patches
+ [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
+ epatch_user
+}
+
+qt4_multilib_src_configure() {
+ qt4_prepare_env
+
+ qt4_symlink_tools_to_build_dir
+
+ # toolchain setup ('local -x' because of bug 532510)
+ local -x \
+ AR="$(tc-getAR) cqs" \
+ CC=$(tc-getCC) \
+ CXX=$(tc-getCXX) \
+ LD=$(tc-getCXX) \
+ MAKEFLAGS=${MAKEOPTS} \
+ OBJCOPY=$(tc-getOBJCOPY) \
+ OBJDUMP=$(tc-getOBJDUMP) \
+ STRIP=$(tc-getSTRIP)
+
+ # convert tc-arch to the values supported by Qt
+ local arch=$(tc-arch)
+ case ${arch} in
+ amd64|x64-*) arch=x86_64 ;;
+ arm64|hppa) arch=generic ;;
+ ppc*-macos) arch=ppc ;;
+ ppc*) arch=powerpc ;;
+ sparc*) arch=sparc ;;
+ x86-macos) arch=x86 ;;
+ x86*) arch=i386 ;;
+ esac
+
+ # configure arguments
+ local conf=(
+ # installation paths
+ -prefix "${QT4_PREFIX}"
+ -bindir "${QT4_BINDIR}"
+ -libdir "${QT4_LIBDIR}"
+ -docdir "${QT4_DOCDIR}"
+ -headerdir "${QT4_HEADERDIR}"
+ -plugindir "${QT4_PLUGINDIR}"
+ -importdir "${QT4_IMPORTDIR}"
+ -datadir "${QT4_DATADIR}"
+ -translationdir "${QT4_TRANSLATIONDIR}"
+ -sysconfdir "${QT4_SYSCONFDIR}"
+ -examplesdir "${QT4_EXAMPLESDIR}"
+ -demosdir "${QT4_DEMOSDIR}"
+
+ # debug/release
+ $(use_if_iuse debug && echo -debug || echo -release)
+ -no-separate-debug-info
+
+ # licensing stuff
+ -opensource -confirm-license
+
+ # build shared libraries
+ -shared
+
+ # skip recursive processing of .pro files at the end of configure
+ # (we run qmake by ourselves), thus saving quite a bit of time
+ -dont-process
+
+ # always enable large file support
+ -largefile
+
+ # exceptions USE flag
+ $(in_iuse exceptions && qt_use exceptions || echo -exceptions)
+
+ # build STL support
+ -stl
+
+ # architecture/platform (mkspec)
+ -arch ${arch}
+ -platform $(qt4_get_mkspec)
+
+ # instruction set support
+ $(is-flagq -mno-mmx && echo -no-mmx)
+ $(is-flagq -mno-3dnow && echo -no-3dnow)
+ $(is-flagq -mno-sse && echo -no-sse)
+ $(is-flagq -mno-sse2 && echo -no-sse2)
+ $(is-flagq -mno-sse3 && echo -no-sse3)
+ $(is-flagq -mno-ssse3 && echo -no-ssse3)
+ $(is-flagq -mno-sse4.1 && echo -no-sse4.1)
+ $(is-flagq -mno-sse4.2 && echo -no-sse4.2)
+ $(is-flagq -mno-avx && echo -no-avx)
+ $(is-flagq -mfpu=* && ! is-flagq -mfpu=*neon* && echo -no-neon)
+
+ # bug 367045
+ $([[ ${CHOST} == *86*-apple-darwin* ]] && echo -no-ssse3)
+
+ # prefer system libraries
+ -system-zlib
+
+ # exclude examples and demos from default build
+ -nomake examples
+ -nomake demos
+
+ # disable rpath on non-prefix (bugs 380415 and 417169)
+ $(usex prefix '' -no-rpath)
+
+ # print verbose information about each configure test
+ -verbose
+
+ # precompiled headers don't work on hardened, where the flag is masked
+ $(in_iuse pch && qt_use pch || echo -no-pch)
+
+ # enable linker optimizations to reduce relocations, except on Solaris
+ # where this flag seems to introduce major breakage to applications,
+ # mostly to be seen as a core dump with the message:
+ # "QPixmap: Must construct a QApplication before a QPaintDevice"
+ $([[ ${CHOST} != *-solaris* ]] && echo -reduce-relocations)
+ )
+
+ if use_if_iuse aqua; then
+ if [[ ${CHOST##*-darwin} -ge 9 ]]; then
+ conf+=(
+ # on (snow) leopard use the new (frameworked) cocoa code
+ -cocoa -framework
+ # add hint for the framework location
+ -F"${QT4_LIBDIR}"
+ )
+ else
+ conf+=(-no-framework)
+ fi
+ fi
+
+ conf+=(
+ # module-specific options
+ "${myconf[@]}"
+ )
+
+ einfo "Configuring with: ${conf[@]}"
+ "${S}"/configure "${conf[@]}" || die "configure failed"
+
+ # configure is stupid and assigns QMAKE_LFLAGS twice,
+ # thus the previous -rpath-link flag gets overwritten
+ # and some packages (e.g. qthelp) fail to link
+ sed -i -e '/^QMAKE_LFLAGS =/ s:$: $$QMAKE_LFLAGS:' \
+ .qmake.cache || die "sed .qmake.cache failed"
+
+ qt4_qmake
+ qt4_foreach_target_subdir qt4_qmake
+}
+
+qt4_multilib_src_compile() {
+ qt4_prepare_env
+
+ qt4_foreach_target_subdir emake
+}
+
+qt4_multilib_src_test() {
+ qt4_prepare_env
+
+ qt4_foreach_target_subdir emake -j1 check
+}
+
+qt4_multilib_src_install() {
+ qt4_prepare_env
+
+ qt4_foreach_target_subdir emake INSTALL_ROOT="${D}" install
+
+ if [[ ${PN} == qtcore ]]; then
+ set -- emake INSTALL_ROOT="${D}" install_{mkspecs,qmake}
+ einfo "Running $*"
+ "$@"
+
+ # install env.d file
+ cat > "${T}/44qt4-${CHOST}" <<-_EOF_
+ LDPATH="${QT4_LIBDIR}"
+ _EOF_
+ doenvd "${T}/44qt4-${CHOST}"
+
+ # install qtchooser configuration file
+ cat > "${T}/qt4-${CHOST}.conf" <<-_EOF_
+ ${QT4_BINDIR}
+ ${QT4_LIBDIR}
+ _EOF_
+
+ (
+ insinto /etc/xdg/qtchooser
+ doins "${T}/qt4-${CHOST}.conf"
+ )
+
+ if multilib_is_native_abi; then
+ # convenience symlinks
+ dosym qt4-"${CHOST}".conf /etc/xdg/qtchooser/4.conf
+ dosym qt4-"${CHOST}".conf /etc/xdg/qtchooser/qt4.conf
+ fi
+ fi
+
+ # move pkgconfig directory to the correct location
+ if [[ -d ${D}${QT4_LIBDIR}/pkgconfig ]]; then
+ mv "${D}${QT4_LIBDIR}"/pkgconfig "${ED}usr/$(get_libdir)" || die
+ fi
+
+ qt4_install_module_qconfigs
+ qt4_symlink_framework_headers
+}
+
+qt4_multilib_src_install_all() {
+ if [[ ${PN} == qtcore ]]; then
+ # include gentoo-qconfig.h at the beginning of Qt{,Core}/qconfig.h
+ if use aqua && [[ ${CHOST#*-darwin} -ge 9 ]]; then
+ sed -i -e '1i #include <QtCore/Gentoo/gentoo-qconfig.h>\n' \
+ "${D}${QT4_LIBDIR}"/QtCore.framework/Headers/qconfig.h \
+ || die "sed failed (qconfig.h)"
+ dosym "${QT4_HEADERDIR#${EPREFIX}}"/Gentoo \
+ "${QT4_LIBDIR#${EPREFIX}}"/QtCore.framework/Headers/Gentoo
+ else
+ sed -i -e '1i #include <Gentoo/gentoo-qconfig.h>\n' \
+ "${D}${QT4_HEADERDIR}"/Qt{,Core}/qconfig.h \
+ || die "sed failed (qconfig.h)"
+ fi
+
+ dodir "${QT4_DATADIR#${EPREFIX}}"/mkspecs/gentoo
+ mv "${D}${QT4_DATADIR}"/mkspecs/{qconfig.pri,gentoo/} || die
+ fi
+
+ # install private headers of a few modules
+ if has ${PN} qtcore qtdeclarative qtgui qtscript; then
+ local moduledir=${PN#qt}
+ local modulename=Qt$(tr 'a-z' 'A-Z' <<< ${moduledir:0:1})${moduledir:1}
+ [[ ${moduledir} == core ]] && moduledir=corelib
+
+ einfo "Installing private headers into ${QT4_HEADERDIR}/${modulename}/private"
+ insinto "${QT4_HEADERDIR#${EPREFIX}}"/${modulename}/private
+ find "${S}"/src/${moduledir} -type f -name '*_p.h' -exec doins '{}' + || die
+ fi
+
+ prune_libtool_files
+}
+
+# @FUNCTION: qt4-build-multilib_pkg_postinst
+# @DESCRIPTION:
+# Regenerate configuration after installation or upgrade/downgrade.
+qt4-build-multilib_pkg_postinst() {
+ qt4_regenerate_global_qconfigs
+}
+
+# @FUNCTION: qt4-build-multilib_pkg_postrm
+# @DESCRIPTION:
+# Regenerate configuration when a module is completely removed.
+qt4-build-multilib_pkg_postrm() {
+ qt4_regenerate_global_qconfigs
+}
+
+
+###### Public helpers ######
+
+# @FUNCTION: qt_use
+# @USAGE: <flag> [feature] [enableval]
+# @DESCRIPTION:
+# <flag> is the name of a flag in IUSE.
+#
+# Outputs "-${enableval}-${feature}" if <flag> is enabled, "-no-${feature}"
+# otherwise. If [feature] is not specified, <flag> is used in its place.
+# If [enableval] is not specified, the "-${enableval}" prefix is omitted.
+qt_use() {
+ [[ $# -ge 1 ]] || die "${FUNCNAME}() requires at least one argument"
+
+ usex "$1" "${3:+-$3}-${2:-$1}" "-no-${2:-$1}"
+}
+
+# @FUNCTION: qt_native_use
+# @USAGE: <flag> [feature] [enableval]
+# @DESCRIPTION:
+# <flag> is the name of a flag in IUSE.
+#
+# Outputs "-${enableval}-${feature}" if <flag> is enabled and we are currently
+# building for the native ABI, "-no-${feature}" otherwise. If [feature] is not
+# specified, <flag> is used in its place. If [enableval] is not specified,
+# the "-${enableval}" prefix is omitted.
+qt_native_use() {
+ [[ $# -ge 1 ]] || die "${FUNCNAME}() requires at least one argument"
+
+ multilib_is_native_abi && qt_use "$@" || echo "-no-${2:-$1}"
+}
+
+
+###### Internal functions ######
+
+# @FUNCTION: qt4_prepare_env
+# @INTERNAL
+# @DESCRIPTION:
+# Prepares the environment for building Qt.
+qt4_prepare_env() {
+ # setup installation directories
+ # note: keep paths in sync with qmake-utils.eclass
+ QT4_PREFIX=${EPREFIX}/usr
+ QT4_HEADERDIR=${QT4_PREFIX}/include/qt4
+ QT4_LIBDIR=${QT4_PREFIX}/$(get_libdir)/qt4
+ QT4_BINDIR=${QT4_LIBDIR}/bin
+ QT4_PLUGINDIR=${QT4_LIBDIR}/plugins
+ QT4_IMPORTDIR=${QT4_LIBDIR}/imports
+ QT4_DATADIR=${QT4_PREFIX}/share/qt4
+ QT4_DOCDIR=${QT4_PREFIX}/share/doc/qt-${PV}
+ QT4_TRANSLATIONDIR=${QT4_DATADIR}/translations
+ QT4_EXAMPLESDIR=${QT4_DATADIR}/examples
+ QT4_DEMOSDIR=${QT4_DATADIR}/demos
+ QT4_SYSCONFDIR=${EPREFIX}/etc/qt4
+
+ # are these still needed?
+ QMAKE_LIBDIR_QT=${QT4_LIBDIR}
+ export XDG_CONFIG_HOME="${T}"
+
+ # can confuse qmake if set (bug 583352)
+ unset QMAKESPEC
+}
+
+# @FUNCTION: qt4_foreach_target_subdir
+# @INTERNAL
+# @DESCRIPTION:
+# Executes the given command inside each directory listed in QT4_TARGET_DIRECTORIES.
+qt4_foreach_target_subdir() {
+ local ret=0 subdir=
+ for subdir in ${QT4_TARGET_DIRECTORIES}; do
+ mkdir -p "${subdir}" || die
+ pushd "${subdir}" >/dev/null || die
+
+ einfo "Running $* ${subdir:+in ${subdir}}"
+ "$@"
+ ((ret+=$?))
+
+ popd >/dev/null || die
+ done
+
+ return ${ret}
+}
+
+# @FUNCTION: qt4_symlink_tools_to_build_dir
+# @INTERNAL
+# @DESCRIPTION:
+# Symlinks qtcore tools to BUILD_DIR,
+# so that they can be used when building other modules.
+qt4_symlink_tools_to_build_dir() {
+ local tool= tools=()
+ if [[ ${PN} != qtcore ]]; then
+ tools+=(qmake moc rcc uic)
+ fi
+
+ mkdir -p "${BUILD_DIR}"/bin || die
+ pushd "${BUILD_DIR}"/bin >/dev/null || die
+
+ for tool in "${tools[@]}"; do
+ [[ -e ${QT4_BINDIR}/${tool} ]] || continue
+ ln -s "${QT4_BINDIR}/${tool}" . || die "failed to symlink ${tool}"
+ done
+
+ popd >/dev/null || die
+}
+
+# @FUNCTION: qt4_qmake
+# @INTERNAL
+# @DESCRIPTION:
+# Helper function that runs qmake in the current target subdir.
+# Intended to be called by qt4_foreach_target_subdir().
+qt4_qmake() {
+ local projectdir=${PWD/#${BUILD_DIR}/${S}}
+
+ "${BUILD_DIR}"/bin/qmake \
+ "${projectdir}" \
+ CONFIG+=nostrip \
+ LIBS+=-L"${QT4_LIBDIR}" \
+ "${myqmakeargs[@]}" \
+ || die "qmake failed (${projectdir#${S}/})"
+}
+
+# @FUNCTION: qt4_install_module_qconfigs
+# @INTERNAL
+# @DESCRIPTION:
+# Creates and installs gentoo-specific ${PN}-qconfig.{h,pri} files.
+qt4_install_module_qconfigs() {
+ local x
+ if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then
+ for x in QCONFIG_ADD QCONFIG_REMOVE; do
+ [[ -n ${!x} ]] && echo ${x}=${!x} >> "${BUILD_DIR}"/${PN}-qconfig.pri
+ done
+ insinto ${QT4_DATADIR#${EPREFIX}}/mkspecs/gentoo
+ doins "${BUILD_DIR}"/${PN}-qconfig.pri
+ fi
+
+ if [[ -n ${QCONFIG_DEFINE} ]]; then
+ for x in ${QCONFIG_DEFINE}; do
+ echo "#define ${x}" >> "${BUILD_DIR}"/gentoo-${PN}-qconfig.h
+ done
+ insinto ${QT4_HEADERDIR#${EPREFIX}}/Gentoo
+ doins "${BUILD_DIR}"/gentoo-${PN}-qconfig.h
+ fi
+}
+
+# @FUNCTION: qt4_regenerate_global_qconfigs
+# @INTERNAL
+# @DESCRIPTION:
+# Generates Gentoo-specific qconfig.{h,pri} according to the build configuration.
+# Don't call die here because dying in pkg_post{inst,rm} only makes things worse.
+qt4_regenerate_global_qconfigs() {
+ if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${PN} == qtcore ]]; then
+ local x qconfig_add qconfig_remove qconfig_new
+ for x in "${ROOT}${QT4_DATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
+ [[ -f ${x} ]] || continue
+ qconfig_add+=" $(sed -n 's/^QCONFIG_ADD=//p' "${x}")"
+ qconfig_remove+=" $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")"
+ done
+
+ if [[ -e "${ROOT}${QT4_DATADIR}"/mkspecs/gentoo/qconfig.pri ]]; then
+ # start with the qconfig.pri that qtcore installed
+ if ! cp "${ROOT}${QT4_DATADIR}"/mkspecs/gentoo/qconfig.pri \
+ "${ROOT}${QT4_DATADIR}"/mkspecs/qconfig.pri; then
+ eerror "cp qconfig failed."
+ return 1
+ fi
+
+ # generate list of QT_CONFIG entries from the existing list
+ # including qconfig_add and excluding qconfig_remove
+ for x in $(sed -n 's/^QT_CONFIG +=//p' \
+ "${ROOT}${QT4_DATADIR}"/mkspecs/qconfig.pri) ${qconfig_add}; do
+ has ${x} ${qconfig_remove} || qconfig_new+=" ${x}"
+ done
+
+ # replace the existing QT_CONFIG list with qconfig_new
+ if ! sed -i -e "s/QT_CONFIG +=.*/QT_CONFIG += ${qconfig_new}/" \
+ "${ROOT}${QT4_DATADIR}"/mkspecs/qconfig.pri; then
+ eerror "Sed for QT_CONFIG failed"
+ return 1
+ fi
+
+ # create Gentoo/qconfig.h
+ if [[ ! -e ${ROOT}${QT4_HEADERDIR}/Gentoo ]]; then
+ if ! mkdir -p "${ROOT}${QT4_HEADERDIR}"/Gentoo; then
+ eerror "mkdir ${QT4_HEADERDIR}/Gentoo failed"
+ return 1
+ fi
+ fi
+ : > "${ROOT}${QT4_HEADERDIR}"/Gentoo/gentoo-qconfig.h
+ for x in "${ROOT}${QT4_HEADERDIR}"/Gentoo/gentoo-*-qconfig.h; do
+ [[ -f ${x} ]] || continue
+ cat "${x}" >> "${ROOT}${QT4_HEADERDIR}"/Gentoo/gentoo-qconfig.h
+ done
+ else
+ rm -f "${ROOT}${QT4_DATADIR}"/mkspecs/qconfig.pri
+ rm -f "${ROOT}${QT4_HEADERDIR}"/Gentoo/gentoo-qconfig.h
+ rmdir "${ROOT}${QT4_DATADIR}"/mkspecs \
+ "${ROOT}${QT4_DATADIR}" \
+ "${ROOT}${QT4_HEADERDIR}"/Gentoo \
+ "${ROOT}${QT4_HEADERDIR}" 2>/dev/null
+ fi
+ fi
+}
+
+# @FUNCTION: qt4_symlink_framework_headers
+# @DESCRIPTION:
+# On OS X we need to add some symlinks when frameworks are being
+# used, to avoid complications with some more or less stupid packages.
+qt4_symlink_framework_headers() {
+ if use_if_iuse aqua && [[ ${CHOST##*-darwin} -ge 9 ]]; then
+ local frw dest f h rdir
+ # Some packages tend to include <Qt/...>
+ dodir "${QT4_HEADERDIR#${EPREFIX}}"/Qt
+
+ # Fake normal headers when frameworks are installed... eases life later
+ # on, make sure we use relative links though, as some ebuilds assume
+ # these dirs exist in src_install to add additional files
+ f=${QT4_HEADERDIR}
+ h=${QT4_LIBDIR}
+ while [[ -n ${f} && ${f%%/*} == ${h%%/*} ]] ; do
+ f=${f#*/}
+ h=${h#*/}
+ done
+ rdir=${h}
+ f="../"
+ while [[ ${h} == */* ]] ; do
+ f="${f}../"
+ h=${h#*/}
+ done
+ rdir="${f}${rdir}"
+
+ for frw in "${D}${QT4_LIBDIR}"/*.framework; do
+ [[ -e "${frw}"/Headers ]] || continue
+ f=$(basename ${frw})
+ dest="${QT4_HEADERDIR#${EPREFIX}}"/${f%.framework}
+ dosym "${rdir}"/${f}/Headers "${dest}"
+
+ # Link normal headers as well.
+ for hdr in "${D}${QT4_LIBDIR}/${f}"/Headers/*; do
+ h=$(basename ${hdr})
+ dosym "../${rdir}"/${f}/Headers/${h} \
+ "${QT4_HEADERDIR#${EPREFIX}}"/Qt/${h}
+ done
+ done
+ fi
+}
+
+# @FUNCTION: qt4_get_mkspec
+# @INTERNAL
+# @DESCRIPTION:
+# Returns the right mkspec for the current CHOST/CXX combination.
+qt4_get_mkspec() {
+ local spec=
+
+ case ${CHOST} in
+ *-linux*)
+ spec=linux ;;
+ *-darwin*)
+ use_if_iuse aqua &&
+ spec=macx || # mac with carbon/cocoa
+ spec=darwin ;; # darwin/mac with X11
+ *-freebsd*|*-dragonfly*)
+ spec=freebsd ;;
+ *-netbsd*)
+ spec=netbsd ;;
+ *-openbsd*)
+ spec=openbsd ;;
+ *-aix*)
+ spec=aix ;;
+ hppa*-hpux*)
+ spec=hpux ;;
+ ia64*-hpux*)
+ spec=hpuxi ;;
+ *-solaris*)
+ spec=solaris ;;
+ *)
+ die "qt4-build-multilib.eclass: unsupported CHOST '${CHOST}'" ;;
+ esac
+
+ case $(tc-getCXX) in
+ *g++*)
+ spec+=-g++ ;;
+ *clang*)
+ if [[ -d ${S}/mkspecs/unsupported/${spec}-clang ]]; then
+ spec=unsupported/${spec}-clang
+ else
+ ewarn "${spec}-clang mkspec does not exist, falling back to ${spec}-g++"
+ spec+=-g++
+ fi ;;
+ *icpc*)
+ if [[ -d ${S}/mkspecs/${spec}-icc ]]; then
+ spec+=-icc
+ else
+ ewarn "${spec}-icc mkspec does not exist, falling back to ${spec}-g++"
+ spec+=-g++
+ fi ;;
+ *)
+ die "qt4-build-multilib.eclass: unsupported compiler '$(tc-getCXX)'" ;;
+ esac
+
+ # Add -64 for 64-bit prefix profiles
+ if use amd64-linux || use ppc64-linux ||
+ use x64-macos ||
+ use sparc64-solaris || use x64-solaris
+ then
+ [[ -d ${S}/mkspecs/${spec}-64 ]] && spec+=-64
+ fi
+
+ echo ${spec}
+}
diff --git a/eclass/qt4-r2.eclass b/eclass/qt4-r2.eclass
new file mode 100644
index 0000000..d8a7252
--- /dev/null
+++ b/eclass/qt4-r2.eclass
@@ -0,0 +1,139 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: qt4-r2.eclass
+# @MAINTAINER:
+# qt@gentoo.org
+# @BLURB: Eclass for Qt4-based packages, second edition.
+# @DESCRIPTION:
+# This eclass contains various functions that may be useful when
+# dealing with packages using Qt4 libraries. Supports only EAPIs
+# 2, 3, 4, and 5. Use qmake-utils.eclass in EAPI 6 and later.
+
+case ${EAPI} in
+ 2|3|4|5) : ;;
+ 6) die "qt4-r2.eclass is banned in EAPI 6 and later" ;;
+ *) die "qt4-r2.eclass: unsupported EAPI=${EAPI:-0}" ;;
+esac
+
+inherit base eutils qmake-utils
+
+export XDG_CONFIG_HOME="${T}"
+
+# @ECLASS-VARIABLE: DOCS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array containing documents passed to dodoc command.
+# Paths can be absolute or relative to ${S}.
+#
+# Example: DOCS=( ChangeLog README "${WORKDIR}/doc_folder/" )
+
+# @ECLASS-VARIABLE: HTML_DOCS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array containing documents passed to dohtml command.
+# Paths can be absolute or relative to ${S}.
+#
+# Example: HTML_DOCS=( "doc/document.html" "${WORKDIR}/html_folder/" )
+
+# @ECLASS-VARIABLE: LANGS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# In case your Qt4 application provides various translations, use this variable
+# to specify them in order to populate "linguas_*" IUSE automatically. Make sure
+# that you set this variable before inheriting qt4-r2 eclass.
+#
+# Example: LANGS="de el it ja"
+for x in ${LANGS}; do
+ IUSE+=" linguas_${x}"
+done
+
+# @ECLASS-VARIABLE: LANGSLONG
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Same as LANGS, but this variable is for LINGUAS that must be in long format.
+# Remember to set this variable before inheriting qt4-r2 eclass.
+# Look at ${PORTDIR}/profiles/desc/linguas.desc for details.
+#
+# Example: LANGSLONG="en_GB ru_RU"
+for x in ${LANGSLONG}; do
+ IUSE+=" linguas_${x%_*}"
+done
+unset x
+
+# @ECLASS-VARIABLE: PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array variable containing all the patches to be applied. This variable
+# is expected to be defined in the global scope of ebuilds. Make sure to
+# specify the full path. This variable is used in src_prepare phase.
+#
+# Example:
+# @CODE
+# PATCHES=(
+# "${FILESDIR}/mypatch.patch"
+# "${FILESDIR}/mypatch2.patch"
+# )
+# @CODE
+
+# @FUNCTION: qt4-r2_src_unpack
+# @DESCRIPTION:
+# Default src_unpack function for packages that depend on qt4. If you have to
+# override src_unpack in your ebuild (probably you don't need to), call
+# qt4-r2_src_unpack in it.
+qt4-r2_src_unpack() {
+ debug-print-function $FUNCNAME "$@"
+
+ base_src_unpack "$@"
+}
+
+# @FUNCTION: qt4-r2_src_prepare
+# @DESCRIPTION:
+# Default src_prepare function for packages that depend on qt4. If you have to
+# override src_prepare in your ebuild, you should call qt4-r2_src_prepare in it,
+# otherwise autopatcher will not work!
+qt4-r2_src_prepare() {
+ debug-print-function $FUNCNAME "$@"
+
+ base_src_prepare "$@"
+}
+
+# @FUNCTION: qt4-r2_src_configure
+# @DESCRIPTION:
+# Default src_configure function for packages that depend on qt4. If you have to
+# override src_configure in your ebuild, call qt4-r2_src_configure in it.
+qt4-r2_src_configure() {
+ debug-print-function $FUNCNAME "$@"
+
+ local project_file=$(qmake-utils_find_pro_file)
+
+ if [[ -n ${project_file} ]]; then
+ eqmake4 "${project_file}"
+ else
+ base_src_configure "$@"
+ fi
+}
+
+# @FUNCTION: qt4-r2_src_compile
+# @DESCRIPTION:
+# Default src_compile function for packages that depend on qt4. If you have to
+# override src_compile in your ebuild (probably you don't need to), call
+# qt4-r2_src_compile in it.
+qt4-r2_src_compile() {
+ debug-print-function $FUNCNAME "$@"
+
+ base_src_compile "$@"
+}
+
+# @FUNCTION: qt4-r2_src_install
+# @DESCRIPTION:
+# Default src_install function for qt4-based packages. Installs compiled code,
+# and documentation (via DOCS and HTML_DOCS variables).
+qt4-r2_src_install() {
+ debug-print-function $FUNCNAME "$@"
+
+ base_src_install INSTALL_ROOT="${D}" "$@"
+ einstalldocs
+}
+
+EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2018-06-20 12:08 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2018-06-20 12:08 UTC (permalink / raw
To: gentoo-commits
commit: 78cf8a9e18791e95796c5c2c87106644fdc9953e
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 20 11:35:32 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Jun 20 11:35:32 2018 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=78cf8a9e
kde.eclass: Transition deps to x11-base/xorg-proto
eclass/kde.eclass | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/eclass/kde.eclass b/eclass/kde.eclass
index 2019a28..c0c636c 100644
--- a/eclass/kde.eclass
+++ b/eclass/kde.eclass
@@ -67,8 +67,7 @@ DEPEND="sys-devel/make
if [[ ${CATEGORY} != "kde-base" ]] || [[ ${CATEGORY} == "kde-base" && ${PV##*.} -lt 10 ]] ; then
DEPEND="${DEPEND}
x11-libs/libXt
- x11-proto/xf86vidmodeproto
- xinerama? ( x11-proto/xineramaproto )"
+ x11-base/xorg-proto"
RDEPEND="xinerama? ( x11-libs/libXinerama )"
IUSE="${IUSE} xinerama"
else
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2018-06-30 8:45 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2018-06-30 8:45 UTC (permalink / raw
To: gentoo-commits
commit: b0c6bf7aaef17b9f7e5d2359cd0cc831b34f38a4
Author: Andreas Sturmlechner <andreas.sturmlechner <AT> gmail <DOT> com>
AuthorDate: Sat Jun 30 08:23:04 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Jun 30 08:45:02 2018 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=b0c6bf7a
kde4-base.eclass: Remove kdelibs conditionals, no longer inherits kde4-base
eclass/kde4-base.eclass | 46 ++++++++++++++++++++--------------------------
1 file changed, 20 insertions(+), 26 deletions(-)
diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass
index 5a9a49c..d8e922e 100644
--- a/eclass/kde4-base.eclass
+++ b/eclass/kde4-base.eclass
@@ -360,25 +360,23 @@ kdecommondepend="
"
unset qtcoreuse
-if [[ ${PN} != kdelibs ]]; then
- [[ -n ${kdelibsuse} ]] && kdelibsuse="[${kdelibsuse}]"
- kdecommondepend+=" kde-frameworks/kdelibs:4${kdelibsuse}"
- if [[ ${KDEBASE} = kdevelop ]]; then
- if [[ ${PN} != kdevplatform ]]; then
- # @ECLASS-VARIABLE: KDEVPLATFORM_REQUIRED
- # @DESCRIPTION:
- # Specifies whether kdevplatform is required. Possible values are 'always' (default) and 'never'.
- # Applies to KDEBASE=kdevelop only.
- KDEVPLATFORM_REQUIRED="${KDEVPLATFORM_REQUIRED:-always}"
- case ${KDEVPLATFORM_REQUIRED} in
- always)
- kdecommondepend+="
- >=dev-util/kdevplatform-${KDEVPLATFORM_VERSION}:4
- "
- ;;
- *) ;;
- esac
- fi
+[[ -n ${kdelibsuse} ]] && kdelibsuse="[${kdelibsuse}]"
+kdecommondepend+=" kde-frameworks/kdelibs:4${kdelibsuse}"
+if [[ ${KDEBASE} = kdevelop ]]; then
+ if [[ ${PN} != kdevplatform ]]; then
+ # @ECLASS-VARIABLE: KDEVPLATFORM_REQUIRED
+ # @DESCRIPTION:
+ # Specifies whether kdevplatform is required. Possible values are 'always' (default) and 'never'.
+ # Applies to KDEBASE=kdevelop only.
+ KDEVPLATFORM_REQUIRED="${KDEVPLATFORM_REQUIRED:-always}"
+ case ${KDEVPLATFORM_REQUIRED} in
+ always)
+ kdecommondepend+="
+ >=dev-util/kdevplatform-${KDEVPLATFORM_VERSION}:4
+ "
+ ;;
+ *) ;;
+ esac
fi
fi
unset kdelibsuse
@@ -421,12 +419,12 @@ kdehandbookrdepend="
case ${KDE_HANDBOOK} in
always)
kdedepend+=" ${kdehandbookdepend}"
- [[ ${PN} != kdelibs ]] && kderdepend+=" ${kdehandbookrdepend}"
+ kderdepend+=" ${kdehandbookrdepend}"
;;
optional)
IUSE+=" +handbook"
kdedepend+=" handbook? ( ${kdehandbookdepend} )"
- [[ ${PN} != kdelibs ]] && kderdepend+=" handbook? ( ${kdehandbookrdepend} )"
+ kderdepend+=" handbook? ( ${kdehandbookrdepend} )"
;;
*) ;;
esac
@@ -720,10 +718,9 @@ kde4-base_src_prepare() {
# Enable/disable handbooks for kde4-base packages
# kde4-l10n inherits kde4-base but is metapackage, so no check for doc
- # kdelibs inherits kde4-base but handle installing the handbook itself
if ! has kde4-meta ${INHERITED} && in_iuse handbook; then
if [[ ${KDEBASE} == kde-base ]]; then
- if [[ ${PN} != kde4-l10n && ${PN} != kdepim-l10n && ${PN} != kdelibs ]] && use !handbook; then
+ if [[ ${PN} != kde4-l10n && ${PN} != kdepim-l10n ]] && use !handbook; then
# documentation in kde4-functions
: ${KDE_DOC_DIRS:=doc}
local dir
@@ -786,9 +783,6 @@ kde4-base_src_configure() {
append-cppflags -DQT_NO_DEBUG
fi
- # Set distribution name
- [[ ${PN} = kdelibs ]] && cmakeargs+=(-DKDE_DISTRIBUTION_TEXT=Gentoo)
-
# Here we set the install prefix
tc-is-cross-compiler || cmakeargs+=(-DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX}")
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2018-06-30 8:45 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2018-06-30 8:45 UTC (permalink / raw
To: gentoo-commits
commit: a5d29b4cb629ce203481511a7c134dc8f46629dd
Author: Andreas Sturmlechner <andreas.sturmlechner <AT> gmail <DOT> com>
AuthorDate: Sat Jun 30 08:29:24 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Jun 30 08:45:02 2018 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=a5d29b4c
qmake-utils.eclass: Import from Gentoo ebuild repository
eclass/qmake-utils.eclass | 327 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 327 insertions(+)
diff --git a/eclass/qmake-utils.eclass b/eclass/qmake-utils.eclass
new file mode 100644
index 0000000..0ebd732
--- /dev/null
+++ b/eclass/qmake-utils.eclass
@@ -0,0 +1,327 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: qmake-utils.eclass
+# @AUTHOR:
+# Davide Pesavento <pesa@gentoo.org>
+# @BLURB: Common functions for qmake-based packages.
+# @DESCRIPTION:
+# Utility eclass providing wrapper functions for Qt4 and Qt5 qmake.
+#
+# This eclass does not set any metadata variables nor export any phase
+# functions. It can be inherited safely.
+
+if [[ -z ${_QMAKE_UTILS_ECLASS} ]]; then
+_QMAKE_UTILS_ECLASS=1
+
+[[ ${EAPI:-0} == [012345] ]] && inherit eutils multilib
+inherit estack toolchain-funcs
+
+# @FUNCTION: qt4_get_bindir
+# @DESCRIPTION:
+# Echoes the directory where Qt4 binaries are installed.
+# EPREFIX is already prepended to the returned path.
+qt4_get_bindir() {
+ [[ ${EAPI:-0} == [0123456] ]] || die "${FUNCNAME[1]} is banned in EAPI 7 and later"
+ has "${EAPI:-0}" 0 1 2 && use !prefix && EPREFIX=
+
+ local qtbindir=${EPREFIX}$(qt4_get_libdir)/bin
+ if [[ -d ${qtbindir} ]]; then
+ echo ${qtbindir}
+ else
+ echo ${EPREFIX}/usr/bin
+ fi
+}
+
+# @FUNCTION: qt4_get_headerdir
+# @DESCRIPTION:
+# Echoes the directory where Qt4 headers are installed.
+qt4_get_headerdir() {
+ [[ ${EAPI:-0} == [0123456] ]] || die "${FUNCNAME[1]} is banned in EAPI 7 and later"
+ echo /usr/include/qt4
+}
+
+# @FUNCTION: qt4_get_libdir
+# @DESCRIPTION:
+# Echoes the directory where Qt4 libraries are installed.
+qt4_get_libdir() {
+ [[ ${EAPI:-0} == [0123456] ]] || die "${FUNCNAME[1]} is banned in EAPI 7 and later"
+ echo /usr/$(get_libdir)/qt4
+}
+
+# @FUNCTION: qt4_get_mkspecsdir
+# @DESCRIPTION:
+# Echoes the directory where Qt4 mkspecs are installed.
+qt4_get_mkspecsdir() {
+ [[ ${EAPI:-0} == [0123456] ]] || die "${FUNCNAME[1]} is banned in EAPI 7 and later"
+ echo /usr/share/qt4/mkspecs
+}
+
+# @FUNCTION: qt4_get_plugindir
+# @DESCRIPTION:
+# Echoes the directory where Qt4 plugins are installed.
+qt4_get_plugindir() {
+ [[ ${EAPI:-0} == [0123456] ]] || die "${FUNCNAME[1]} is banned in EAPI 7 and later"
+ echo $(qt4_get_libdir)/plugins
+}
+
+# @FUNCTION: qt5_get_bindir
+# @DESCRIPTION:
+# Echoes the directory where Qt5 binaries are installed.
+# EPREFIX is already prepended to the returned path.
+qt5_get_bindir() {
+ has "${EAPI:-0}" 0 1 2 && use !prefix && EPREFIX=
+
+ echo ${EPREFIX}$(qt5_get_libdir)/qt5/bin
+}
+
+# @FUNCTION: qt5_get_headerdir
+# @DESCRIPTION:
+# Echoes the directory where Qt5 headers are installed.
+qt5_get_headerdir() {
+ echo /usr/include/qt5
+}
+
+# @FUNCTION: qt5_get_libdir
+# @DESCRIPTION:
+# Echoes the directory where Qt5 libraries are installed.
+qt5_get_libdir() {
+ echo /usr/$(get_libdir)
+}
+
+# @FUNCTION: qt5_get_mkspecsdir
+# @DESCRIPTION:
+# Echoes the directory where Qt5 mkspecs are installed.
+qt5_get_mkspecsdir() {
+ echo $(qt5_get_libdir)/qt5/mkspecs
+}
+
+# @FUNCTION: qt5_get_plugindir
+# @DESCRIPTION:
+# Echoes the directory where Qt5 plugins are installed.
+qt5_get_plugindir() {
+ echo $(qt5_get_libdir)/qt5/plugins
+}
+
+# @FUNCTION: qmake-utils_find_pro_file
+# @RETURN: zero or one qmake .pro file names
+# @INTERNAL
+# @DESCRIPTION:
+# Outputs a project file name that can be passed to eqmake.
+# 0 *.pro files found --> outputs null string;
+# 1 *.pro file found --> outputs its name;
+# 2 or more *.pro files found --> if "${PN}.pro" or
+# "$(basename ${S}).pro" are there, outputs one of them.
+qmake-utils_find_pro_file() {
+ local dir_name=$(basename "${S}")
+
+ # set nullglob to avoid expanding *.pro to the literal
+ # string "*.pro" when there are no matching files
+ eshopts_push -s nullglob
+ local pro_files=(*.pro)
+ eshopts_pop
+
+ case ${#pro_files[@]} in
+ 0)
+ : ;;
+ 1)
+ echo "${pro_files}"
+ ;;
+ *)
+ for pro_file in "${pro_files[@]}"; do
+ if [[ ${pro_file%.pro} == ${dir_name} || ${pro_file%.pro} == ${PN} ]]; then
+ echo "${pro_file}"
+ break
+ fi
+ done
+ ;;
+ esac
+}
+
+# @VARIABLE: EQMAKE4_EXCLUDE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# List of files to be excluded from eqmake4 CONFIG processing.
+# Paths are relative to the current working directory (usually ${S}).
+#
+# Example: EQMAKE4_EXCLUDE="ignore/me.pro foo/*"
+
+# @FUNCTION: eqmake4
+# @USAGE: [project_file] [parameters to qmake]
+# @DESCRIPTION:
+# Wrapper for Qt4's qmake. If project_file is not specified, eqmake4 looks
+# for one in the current directory (non-recursively). If multiple project
+# files are found, then ${PN}.pro is used, if it exists, otherwise eqmake4
+# will not be able to continue.
+#
+# All other arguments are appended unmodified to qmake command line.
+#
+# For recursive build systems, i.e. those based on the subdirs template,
+# you should run eqmake4 on the top-level project file only, unless you
+# have a valid reason to do otherwise. During the building, qmake will
+# be automatically re-invoked with the right arguments on every directory
+# specified inside the top-level project file.
+eqmake4() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ ${EAPI:-0} == [0123456] ]] || die "${FUNCNAME[1]} is banned in EAPI 7 and later"
+ has "${EAPI:-0}" 0 1 2 && use !prefix && EPREFIX=
+
+ ebegin "Running qmake"
+
+ local qmake_args=("$@")
+
+ # Check if the project file name was passed as first argument. If not, look for candidates.
+ local regexp='.*\.pro'
+ if ! [[ ${1} =~ ${regexp} ]]; then
+ local project_file=$(qmake-utils_find_pro_file)
+ if [[ -z ${project_file} ]]; then
+ echo
+ eerror "No project files found in '${PWD}'"
+ eerror "This shouldn't happen - please send a bug report to https://bugs.gentoo.org/"
+ echo
+ die "eqmake4 failed"
+ fi
+ qmake_args+=("${project_file}")
+ fi
+
+ # Make sure the CONFIG variable is correctly set for both release and debug builds.
+ local config_add=release
+ local config_remove=debug
+ if in_iuse debug && use debug; then
+ config_add=debug
+ config_remove=release
+ fi
+
+ local awkscript='BEGIN {
+ printf "### eqmake4 was here ###\n" > file;
+ printf "CONFIG -= debug_and_release %s\n", remove >> file;
+ printf "CONFIG += %s\n\n", add >> file;
+ fixed=0;
+ }
+ /^[[:blank:]]*CONFIG[[:blank:]]*[\+\*]?=/ {
+ if (gsub("\\<((" remove ")|(debug_and_release))\\>", "") > 0) {
+ fixed=1;
+ }
+ }
+ /^[[:blank:]]*CONFIG[[:blank:]]*-=/ {
+ if (gsub("\\<" add "\\>", "") > 0) {
+ fixed=1;
+ }
+ }
+ {
+ print >> file;
+ }
+ END {
+ print fixed;
+ }'
+
+ [[ -n ${EQMAKE4_EXCLUDE} ]] && eshopts_push -o noglob
+
+ local file
+ while read file; do
+ local excl
+ for excl in ${EQMAKE4_EXCLUDE}; do
+ [[ ${file} == ${excl} ]] && continue 2
+ done
+ grep -q '^### eqmake4 was here ###$' "${file}" && continue
+
+ local retval=$({
+ rm -f "${file}" || echo FAIL
+ awk -v file="${file}" \
+ -v add=${config_add} \
+ -v remove=${config_remove} \
+ -- "${awkscript}" || echo FAIL
+ } < "${file}")
+
+ if [[ ${retval} == 1 ]]; then
+ einfo " - fixed CONFIG in ${file}"
+ elif [[ ${retval} != 0 ]]; then
+ eerror " - error while processing ${file}"
+ die "eqmake4 failed to process ${file}"
+ fi
+ done < <(find . -type f -name '*.pr[io]' -printf '%P\n' 2>/dev/null)
+
+ [[ -n ${EQMAKE4_EXCLUDE} ]] && eshopts_pop
+
+ "$(qt4_get_bindir)"/qmake \
+ -makefile \
+ QMAKE_AR="$(tc-getAR) cqs" \
+ QMAKE_CC="$(tc-getCC)" \
+ QMAKE_CXX="$(tc-getCXX)" \
+ QMAKE_LINK="$(tc-getCXX)" \
+ QMAKE_LINK_C="$(tc-getCC)" \
+ QMAKE_OBJCOPY="$(tc-getOBJCOPY)" \
+ QMAKE_RANLIB= \
+ QMAKE_STRIP= \
+ QMAKE_CFLAGS="${CFLAGS}" \
+ QMAKE_CFLAGS_RELEASE= \
+ QMAKE_CFLAGS_DEBUG= \
+ QMAKE_CXXFLAGS="${CXXFLAGS}" \
+ QMAKE_CXXFLAGS_RELEASE= \
+ QMAKE_CXXFLAGS_DEBUG= \
+ QMAKE_LFLAGS="${LDFLAGS}" \
+ QMAKE_LFLAGS_RELEASE= \
+ QMAKE_LFLAGS_DEBUG= \
+ QMAKE_LIBDIR_QT="${EPREFIX}$(qt4_get_libdir)" \
+ QMAKE_LIBDIR_X11="${EPREFIX}/usr/$(get_libdir)" \
+ QMAKE_LIBDIR_OPENGL="${EPREFIX}/usr/$(get_libdir)" \
+ "${qmake_args[@]}"
+
+ if ! eend $? ; then
+ echo
+ eerror "Running qmake has failed! (see above for details)"
+ eerror "This shouldn't happen - please send a bug report to https://bugs.gentoo.org/"
+ echo
+ die "eqmake4 failed"
+ fi
+}
+
+# @FUNCTION: eqmake5
+# @USAGE: [arguments for qmake]
+# @DESCRIPTION:
+# Wrapper for Qt5's qmake. All arguments are passed to qmake.
+#
+# For recursive build systems, i.e. those based on the subdirs template,
+# you should run eqmake5 on the top-level project file only, unless you
+# have a valid reason to do otherwise. During the building, qmake will
+# be automatically re-invoked with the right arguments on every directory
+# specified inside the top-level project file.
+eqmake5() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ ebegin "Running qmake"
+
+ "$(qt5_get_bindir)"/qmake \
+ -makefile \
+ QMAKE_AR="$(tc-getAR) cqs" \
+ QMAKE_CC="$(tc-getCC)" \
+ QMAKE_LINK_C="$(tc-getCC)" \
+ QMAKE_LINK_C_SHLIB="$(tc-getCC)" \
+ QMAKE_CXX="$(tc-getCXX)" \
+ QMAKE_LINK="$(tc-getCXX)" \
+ QMAKE_LINK_SHLIB="$(tc-getCXX)" \
+ QMAKE_OBJCOPY="$(tc-getOBJCOPY)" \
+ QMAKE_RANLIB= \
+ QMAKE_STRIP= \
+ QMAKE_CFLAGS="${CFLAGS}" \
+ QMAKE_CFLAGS_RELEASE= \
+ QMAKE_CFLAGS_DEBUG= \
+ QMAKE_CXXFLAGS="${CXXFLAGS}" \
+ QMAKE_CXXFLAGS_RELEASE= \
+ QMAKE_CXXFLAGS_DEBUG= \
+ QMAKE_LFLAGS="${LDFLAGS}" \
+ QMAKE_LFLAGS_RELEASE= \
+ QMAKE_LFLAGS_DEBUG= \
+ "$@"
+
+ if ! eend $? ; then
+ echo
+ eerror "Running qmake has failed! (see above for details)"
+ eerror "This shouldn't happen - please send a bug report to https://bugs.gentoo.org/"
+ echo
+ die "eqmake5 failed"
+ fi
+}
+
+fi
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2018-09-12 20:41 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2018-09-12 20:41 UTC (permalink / raw
To: gentoo-commits
commit: ffedd275d6bf9b9a3c9ff18c564d9f15b9b4b89e
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 12 20:40:11 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Sep 12 20:40:11 2018 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=ffedd275
Import distutils.eclass, python.eclass from Gentoo ebuild repo
eclass/distutils.eclass | 599 +++++++++
eclass/python.eclass | 3167 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 3766 insertions(+)
diff --git a/eclass/distutils.eclass b/eclass/distutils.eclass
new file mode 100644
index 0000000..9e0b0b5
--- /dev/null
+++ b/eclass/distutils.eclass
@@ -0,0 +1,599 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @DEAD
+# Removal on 2017-03-18.
+
+# @ECLASS: distutils.eclass
+# @MAINTAINER:
+# kde-sunset overlay maintainers
+# @BLURB: Eclass for packages with build systems using Distutils
+# @DESCRIPTION:
+# The distutils eclass defines phase functions for packages with build systems using Distutils.
+#
+# This eclass is DEPRECATED. Please use distutils-r1 instead.
+
+if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
+ inherit python
+fi
+
+inherit multilib
+
+case "${EAPI:-0}" in
+ 6)
+ die "${ECLASS}.eclass is banned in EAPI ${EAPI}"
+ ;;
+ 0|1)
+ EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
+ ;;
+ *)
+ EXPORT_FUNCTIONS src_prepare src_compile src_install pkg_postinst pkg_postrm
+ ;;
+esac
+
+if [[ -z "$(declare -p PYTHON_DEPEND 2> /dev/null)" ]]; then
+ DEPEND="dev-lang/python"
+ RDEPEND="${DEPEND}"
+fi
+
+ if has "${EAPI:-0}" 0 1 && [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
+ ewarn
+ ewarn "\"${EBUILD}\":"
+ ewarn "Deprecation Warning: Usage of distutils.eclass in packages supporting installation"
+ ewarn "for multiple Python ABIs in EAPI <=1 is deprecated."
+ ewarn "The ebuild should to be fixed. Please report a bug, if it has not been already reported."
+ ewarn
+ elif has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
+ ewarn
+ ewarn "\"${EBUILD}\":"
+ ewarn "Deprecation Warning: Usage of distutils.eclass in packages not supporting installation"
+ ewarn "for multiple Python ABIs in EAPI <=2 is deprecated."
+ ewarn "The ebuild should to be fixed. Please report a bug, if it has not been already reported."
+ ewarn
+ fi
+
+# 'python' variable is deprecated. Use PYTHON() instead.
+if has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
+ python="python"
+else
+ python="die"
+fi
+
+# @ECLASS-VARIABLE: DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES
+# @DESCRIPTION:
+# Set this to use separate source directories for each enabled version of Python.
+
+# @ECLASS-VARIABLE: DISTUTILS_SETUP_FILES
+# @DESCRIPTION:
+# Array of paths to setup files.
+# Syntax:
+# [current_working_directory|]path_to_setup_file
+
+# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS
+# @DESCRIPTION:
+# Array of global options passed to setup files.
+# Syntax in EAPI <4:
+# global_option
+# Syntax in EAPI >=4:
+# Python_ABI_pattern global_option
+
+# @ECLASS-VARIABLE: DISTUTILS_SRC_TEST
+# @DESCRIPTION:
+# Type of test command used by distutils_src_test().
+# IUSE and DEPEND are automatically adjusted, unless DISTUTILS_DISABLE_TEST_DEPENDENCY is set.
+# Valid values:
+# setup.py
+# nosetests
+# py.test
+# trial [arguments]
+
+# @ECLASS-VARIABLE: DISTUTILS_DISABLE_TEST_DEPENDENCY
+# @DESCRIPTION:
+# Disable modification of IUSE and DEPEND caused by setting of DISTUTILS_SRC_TEST.
+
+if [[ -n "${DISTUTILS_SRC_TEST}" && ! "${DISTUTILS_SRC_TEST}" =~ ^(setup\.py|nosetests|py\.test|trial(\ .*)?)$ ]]; then
+ die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
+fi
+
+if [[ -z "${DISTUTILS_DISABLE_TEST_DEPENDENCY}" ]]; then
+ if [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
+ IUSE="test"
+ DEPEND+="${DEPEND:+ }test? ( dev-python/nose )"
+ elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
+ IUSE="test"
+ DEPEND+="${DEPEND:+ }test? ( dev-python/pytest )"
+ # trial requires an argument, which is usually equal to "${PN}".
+ elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
+ IUSE="test"
+ DEPEND+="${DEPEND:+ }test? ( dev-python/twisted-core )"
+ fi
+fi
+
+if [[ -n "${DISTUTILS_SRC_TEST}" ]]; then
+ EXPORT_FUNCTIONS src_test
+fi
+
+# Scheduled for deletion on 2011-06-01.
+if [[ -n "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" ]]; then
+ eerror "Use PYTHON_NONVERSIONED_EXECUTABLES=(\".*\") instead of DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable."
+ die "DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable is banned"
+fi
+
+# @ECLASS-VARIABLE: DOCS
+# @DESCRIPTION:
+# Additional documentation files installed by distutils_src_install().
+
+_distutils_get_build_dir() {
+ if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
+ echo "build-${PYTHON_ABI}"
+ else
+ echo "build"
+ fi
+}
+
+_distutils_get_PYTHONPATH() {
+ if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
+ ls -d build-${PYTHON_ABI}/lib* 2> /dev/null
+ else
+ ls -d build/lib* 2> /dev/null
+ fi
+}
+
+_distutils_hook() {
+ if [[ "$#" -ne 1 ]]; then
+ die "${FUNCNAME}() requires 1 argument"
+ fi
+ if [[ "$(type -t "distutils_src_${EBUILD_PHASE}_$1_hook")" == "function" ]]; then
+ "distutils_src_${EBUILD_PHASE}_$1_hook"
+ fi
+}
+
+_distutils_prepare_global_options() {
+ local element option pattern
+
+ if [[ -n "$(declare -p DISTUTILS_GLOBAL_OPTIONS 2> /dev/null)" && "$(declare -p DISTUTILS_GLOBAL_OPTIONS)" != "declare -a DISTUTILS_GLOBAL_OPTIONS="* ]]; then
+ die "DISTUTILS_GLOBAL_OPTIONS should be indexed array"
+ fi
+
+ if has "${EAPI:-0}" 0 1 2 3; then
+ _DISTUTILS_GLOBAL_OPTIONS=("${DISTUTILS_GLOBAL_OPTIONS[@]}")
+ else
+ _DISTUTILS_GLOBAL_OPTIONS=()
+
+ for element in "${DISTUTILS_GLOBAL_OPTIONS[@]}"; do
+ if [[ ! "${element}" =~ ^[^[:space:]]+\ . ]]; then
+ die "Element '${element}' of DISTUTILS_GLOBAL_OPTIONS array has invalid syntax"
+ fi
+ pattern="${element%% *}"
+ option="${element#* }"
+ if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
+ _DISTUTILS_GLOBAL_OPTIONS+=("${option}")
+ fi
+ done
+ fi
+}
+
+_distutils_prepare_current_working_directory() {
+ if [[ "$1" == *"|"*"|"* ]]; then
+ die "Element '$1' of DISTUTILS_SETUP_FILES array has invalid syntax"
+ fi
+
+ if [[ "$1" == *"|"* ]]; then
+ echo "${_BOLD}[${1%|*}]${_NORMAL}"
+ pushd "${1%|*}" > /dev/null || die "Entering directory '${1%|*}' failed"
+ fi
+}
+
+_distutils_restore_current_working_directory() {
+ if [[ "$1" == *"|"* ]]; then
+ popd > /dev/null || die "Leaving directory '${1%|*}' failed"
+ fi
+}
+
+# @FUNCTION: distutils_src_unpack
+# @DESCRIPTION:
+# The distutils src_unpack function. This function is exported.
+distutils_src_unpack() {
+ if ! has "${EAPI:-0}" 0 1; then
+ die "${FUNCNAME}() cannot be used in this EAPI"
+ fi
+
+ if [[ "${EBUILD_PHASE}" != "unpack" ]]; then
+ die "${FUNCNAME}() can be used only in src_unpack() phase"
+ fi
+
+ unpack ${A}
+ cd "${S}"
+
+ distutils_src_prepare
+}
+
+# @FUNCTION: distutils_src_prepare
+# @DESCRIPTION:
+# The distutils src_prepare function. This function is exported.
+distutils_src_prepare() {
+ if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then
+ die "${FUNCNAME}() can be used only in src_prepare() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+
+ local distribute_setup_existence="0" ez_setup_existence="0"
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ # Delete ez_setup files to prevent packages from installing Setuptools on their own.
+ [[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence="1"
+ rm -fr ez_setup*
+ if [[ "${ez_setup_existence}" == "1" ]]; then
+ echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py
+ fi
+
+ # Delete distribute_setup files to prevent packages from installing Distribute on their own.
+ [[ -d distribute_setup || -f distribute_setup.py ]] && distribute_setup_existence="1"
+ rm -fr distribute_setup*
+ if [[ "${distribute_setup_existence}" == "1" ]]; then
+ echo "def use_setuptools(*args, **kwargs): pass" > distribute_setup.py
+ fi
+
+ if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
+ python_copy_sources
+ fi
+}
+
+# @FUNCTION: distutils_src_compile
+# @DESCRIPTION:
+# The distutils src_compile function. This function is exported.
+# In ebuilds of packages supporting installation for multiple versions of Python, this function
+# calls distutils_src_compile_pre_hook() and distutils_src_compile_post_hook(), if they are defined.
+distutils_src_compile() {
+ if [[ "${EBUILD_PHASE}" != "compile" ]]; then
+ die "${FUNCNAME}() can be used only in src_compile() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_set_color_variables
+
+ local setup_file
+
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ distutils_building() {
+ _distutils_hook pre
+
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL}
+ "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@" || return "$?"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+
+ _distutils_hook post
+ }
+ python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@"
+ unset -f distutils_building
+ else
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"${_NORMAL}
+ "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+ fi
+}
+
+_distutils_src_test_hook() {
+ if [[ "$#" -ne 1 ]]; then
+ die "${FUNCNAME}() requires 1 arguments"
+ fi
+
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ return
+ fi
+
+ if [[ "$(type -t "distutils_src_test_pre_hook")" == "function" ]]; then
+ eval "python_execute_$1_pre_hook() {
+ distutils_src_test_pre_hook
+ }"
+ fi
+
+ if [[ "$(type -t "distutils_src_test_post_hook")" == "function" ]]; then
+ eval "python_execute_$1_post_hook() {
+ distutils_src_test_post_hook
+ }"
+ fi
+}
+
+# @FUNCTION: distutils_src_test
+# @DESCRIPTION:
+# The distutils src_test function. This function is exported, when DISTUTILS_SRC_TEST variable is set.
+# In ebuilds of packages supporting installation for multiple versions of Python, this function
+# calls distutils_src_test_pre_hook() and distutils_src_test_post_hook(), if they are defined.
+distutils_src_test() {
+ if [[ "${EBUILD_PHASE}" != "test" ]]; then
+ die "${FUNCNAME}() can be used only in src_test() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_set_color_variables
+
+ local arguments setup_file
+
+ if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ distutils_testing() {
+ _distutils_hook pre
+
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@"${_NORMAL}
+ PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@" || return "$?"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+
+ _distutils_hook post
+ }
+ python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@"
+ unset -f distutils_testing
+ else
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL}
+ PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+ fi
+ elif [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
+ _distutils_src_test_hook nosetests
+
+ python_execute_nosetests -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
+ elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
+ _distutils_src_test_hook py.test
+
+ python_execute_py.test -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
+ # trial requires an argument, which is usually equal to "${PN}".
+ elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
+ if [[ "${DISTUTILS_SRC_TEST}" == "trial "* ]]; then
+ arguments="${DISTUTILS_SRC_TEST#trial }"
+ else
+ arguments="${PN}"
+ fi
+
+ _distutils_src_test_hook trial
+
+ python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- ${arguments} "$@"
+ else
+ die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
+ fi
+}
+
+# @FUNCTION: distutils_src_install
+# @DESCRIPTION:
+# The distutils src_install function. This function is exported.
+# In ebuilds of packages supporting installation for multiple versions of Python, this function
+# calls distutils_src_install_pre_hook() and distutils_src_install_post_hook(), if they are defined.
+# It also installs some standard documentation files (AUTHORS, Change*, CHANGELOG, CONTRIBUTORS,
+# KNOWN_BUGS, MAINTAINERS, NEWS, README*, TODO).
+distutils_src_install() {
+ if [[ "${EBUILD_PHASE}" != "install" ]]; then
+ die "${FUNCNAME}() can be used only in src_install() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_initialize_prefix_variables
+ _python_set_color_variables
+
+ local default_docs doc line nspkg_pth_file nspkg_pth_files=() setup_file
+
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ distutils_installation() {
+ _distutils_hook pre
+
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --no-compile --root="${T}/images/${PYTHON_ABI}" "$@"${_NORMAL}
+ "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --no-compile --root="${T}/images/${PYTHON_ABI}" "$@" || return "$?"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+
+ _distutils_hook post
+ }
+ python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_installation "$@"
+ unset -f distutils_installation
+
+ python_merge_intermediate_installation_images "${T}/images"
+ else
+ # Mark the package to be rebuilt after a Python upgrade.
+ python_need_rebuild
+
+ _distutils_prepare_global_options
+
+ for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
+ _distutils_prepare_current_working_directory "${setup_file}"
+
+ echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"${_NORMAL}
+ "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
+
+ _distutils_restore_current_working_directory "${setup_file}"
+ done
+ fi
+
+ while read -d $'\0' -r nspkg_pth_file; do
+ nspkg_pth_files+=("${nspkg_pth_file}")
+ done < <(find "${ED}" -name "*-nspkg.pth" -type f -print0)
+
+ if [[ "${#nspkg_pth_files[@]}" -gt 0 ]]; then
+ einfo
+ einfo "Python namespaces:"
+ for nspkg_pth_file in "${nspkg_pth_files[@]}"; do
+ einfo " '${nspkg_pth_file#${ED%/}}':"
+ while read -r line; do
+ einfo " $(echo "${line}" | sed -e "s/.*types\.ModuleType('\([^']\+\)').*/\1/")"
+ done < "${nspkg_pth_file}"
+ #if ! has "${EAPI:-0}" 0 1 2 3; then
+ # rm -f "${nspkg_pth_file}" || die "Deletion of '${nspkg_pth_file}' failed"
+ #fi
+ done
+ einfo
+ fi
+
+ if [[ -e "${ED}usr/local" ]]; then
+ die "Illegal installation into /usr/local"
+ fi
+
+ default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS NEWS README* TODO"
+
+ for doc in ${default_docs}; do
+ [[ -s "${doc}" ]] && dodoc "${doc}"
+ done
+
+ if has "${EAPI:-0}" 0 1 2 3; then
+ if [[ -n "${DOCS}" ]]; then
+ dodoc ${DOCS} || die "dodoc failed"
+ fi
+ else
+ if [[ -n "${DOCS}" ]]; then
+ dodoc -r ${DOCS} || die "dodoc failed"
+ fi
+ fi
+
+ DISTUTILS_SRC_INSTALL_EXECUTED="1"
+}
+
+# @FUNCTION: distutils_pkg_postinst
+# @DESCRIPTION:
+# The distutils pkg_postinst function. This function is exported.
+# When PYTHON_MODNAME variable is set, then this function calls python_mod_optimize() with modules
+# specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_optimize() with module, whose
+# name is equal to name of current package, if this module exists.
+distutils_pkg_postinst() {
+ if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
+ die "${FUNCNAME}() can be used only in pkg_postinst() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_initialize_prefix_variables
+
+ if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then
+ die "${FUNCNAME}() called illegally"
+ fi
+
+ local pylibdir pymod
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
+ for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
+ if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
+ PYTHON_MODNAME="${PN}"
+ fi
+ done
+ fi
+
+ if [[ -n "${PYTHON_MODNAME}" ]]; then
+ if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
+ python_mod_optimize ${PYTHON_MODNAME}
+ else
+ for pymod in ${PYTHON_MODNAME}; do
+ python_mod_optimize "$(python_get_sitedir)/${pymod}"
+ done
+ fi
+ fi
+}
+
+# @FUNCTION: distutils_pkg_postrm
+# @DESCRIPTION:
+# The distutils pkg_postrm function. This function is exported.
+# When PYTHON_MODNAME variable is set, then this function calls python_mod_cleanup() with modules
+# specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_cleanup() with module, whose
+# name is equal to name of current package, if this module exists.
+distutils_pkg_postrm() {
+ if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
+ die "${FUNCNAME}() can be used only in pkg_postrm() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_initialize_prefix_variables
+
+ if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then
+ die "${FUNCNAME}() called illegally"
+ fi
+
+ local pylibdir pymod
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
+ for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
+ if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
+ PYTHON_MODNAME="${PN}"
+ fi
+ done
+ fi
+
+ if [[ -n "${PYTHON_MODNAME}" ]]; then
+ if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
+ python_mod_cleanup ${PYTHON_MODNAME}
+ else
+ for pymod in ${PYTHON_MODNAME}; do
+ for pylibdir in "${EROOT}"usr/$(get_libdir)/python*; do
+ if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then
+ python_mod_cleanup "${pylibdir#${EROOT%/}}/site-packages/${pymod}"
+ fi
+ done
+ done
+ fi
+ fi
+}
+
+# @FUNCTION: distutils_get_intermediate_installation_image
+# @DESCRIPTION:
+# Print path to intermediate installation image.
+#
+# This function can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook().
+distutils_get_intermediate_installation_image() {
+ if [[ "${EBUILD_PHASE}" != "install" ]]; then
+ die "${FUNCNAME}() can be used only in src_install() phase"
+ fi
+
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+
+ _python_check_python_pkg_setup_execution
+
+ if [[ ! "${FUNCNAME[1]}" =~ ^distutils_src_install_(pre|post)_hook$ ]]; then
+ die "${FUNCNAME}() can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook()"
+ fi
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ echo "${T}/images/${PYTHON_ABI}"
+}
diff --git a/eclass/python.eclass b/eclass/python.eclass
new file mode 100644
index 0000000..718c040
--- /dev/null
+++ b/eclass/python.eclass
@@ -0,0 +1,3167 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# @DEAD
+# Removal on 2017-03-21.
+
+# @ECLASS: python.eclass
+# @MAINTAINER:
+# kde-sunset overlay maintainers
+# @BLURB: Eclass for Python packages
+# @DESCRIPTION:
+# The python eclass contains miscellaneous, useful functions for Python packages.
+#
+# This eclass is DEPRECATED. Please use python-r1, python-single-r1
+# or python-any-r1 instead.
+
+if [[ ${EAPI} == 6 ]]; then
+ die "${ECLASS}.eclass is banned in EAPI ${EAPI}"
+fi
+
+if [[ ${_PYTHON_UTILS_R1} ]]; then
+ die 'python.eclass can not be used with python-r1 suite eclasses.'
+fi
+
+# Must call inherit before EXPORT_FUNCTIONS to avoid QA warning.
+if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
+ inherit multilib
+fi
+
+# Export pkg_setup every time to avoid issues with eclass inheritance order.
+if ! has "${EAPI:-0}" 0 1 2 3 || { has "${EAPI:-0}" 2 3 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; }; then
+ EXPORT_FUNCTIONS pkg_setup
+fi
+
+# Avoid processing this eclass more than once.
+if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
+_PYTHON_ECLASS_INHERITED="1"
+
+if ! has "${EAPI:-0}" 0 1 2 3 4 5; then
+ die "API of python.eclass in EAPI=\"${EAPI}\" not established"
+fi
+
+# Please do not add any new versions of Python here! Instead, please
+# focus on converting packages to use the new eclasses.
+
+_CPYTHON2_GLOBALLY_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7)
+_CPYTHON3_GLOBALLY_SUPPORTED_ABIS=(3.1 3.2 3.3)
+_JYTHON_GLOBALLY_SUPPORTED_ABIS=(2.5-jython 2.7-jython)
+_PYPY_GLOBALLY_SUPPORTED_ABIS=(2.7-pypy-1.7 2.7-pypy-1.8 2.7-pypy-1.9 2.7-pypy-2.0)
+_PYTHON_GLOBALLY_SUPPORTED_ABIS=(${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]} ${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]} ${_JYTHON_GLOBALLY_SUPPORTED_ABIS[@]} ${_PYPY_GLOBALLY_SUPPORTED_ABIS[@]})
+
+# ================================================================================================
+# ===================================== HANDLING OF METADATA =====================================
+# ================================================================================================
+
+_PYTHON_ABI_PATTERN_REGEX="([[:alnum:]]|\.|-|\*|\[|\])+"
+
+_python_check_python_abi_matching() {
+ local pattern patterns patterns_list="0" PYTHON_ABI
+
+ while (($#)); do
+ case "$1" in
+ --patterns-list)
+ patterns_list="1"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "$#" -ne 2 ]]; then
+ die "${FUNCNAME}() requires 2 arguments"
+ fi
+
+ PYTHON_ABI="$1"
+
+ if [[ "${patterns_list}" == "0" ]]; then
+ pattern="$2"
+
+ if [[ "${pattern}" == *"-cpython" ]]; then
+ [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ && "${PYTHON_ABI}" == ${pattern%-cpython} ]]
+ elif [[ "${pattern}" == *"-jython" ]]; then
+ [[ "${PYTHON_ABI}" == ${pattern} ]]
+ elif [[ "${pattern}" == *"-pypy-"* ]]; then
+ [[ "${PYTHON_ABI}" == ${pattern} ]]
+ else
+ if [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
+ [[ "${PYTHON_ABI}" == ${pattern} ]]
+ elif [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
+ [[ "${PYTHON_ABI%-jython}" == ${pattern} ]]
+ elif [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-pypy-[[:digit:]]+\.[[:digit:]]+$ ]]; then
+ [[ "${PYTHON_ABI%-pypy-*}" == ${pattern} ]]
+ else
+ die "${FUNCNAME}(): Unrecognized Python ABI '${PYTHON_ABI}'"
+ fi
+ fi
+ else
+ patterns="${2// /$'\n'}"
+
+ while read pattern; do
+ if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
+ return 0
+ fi
+ done <<< "${patterns}"
+
+ return 1
+ fi
+}
+
+_python_implementation() {
+ if [[ "${CATEGORY}/${PN}" == "dev-lang/python" ]]; then
+ return 0
+ elif [[ "${CATEGORY}/${PN}" == "dev-java/jython" ]]; then
+ return 0
+ elif [[ "${CATEGORY}/${PN}" == "virtual/pypy" ]]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+_python_package_supporting_installation_for_multiple_python_abis() {
+ [[ -n "${SUPPORT_PYTHON_ABIS}" ]]
+}
+
+# @ECLASS-VARIABLE: PYTHON_DEPEND
+# @DESCRIPTION:
+# Specification of dependency on dev-lang/python.
+# Syntax:
+# PYTHON_DEPEND: [[!]USE_flag? ]<version_components_group>[ version_components_group]
+# version_components_group: <major_version[:[minimal_version][:maximal_version]]>
+# major_version: <2|3|*>
+# minimal_version: <minimal_major_version.minimal_minor_version>
+# maximal_version: <maximal_major_version.maximal_minor_version>
+
+_python_parse_PYTHON_DEPEND() {
+ local major_version maximal_version minimal_version python_all="0" python_maximal_version python_minimal_version python_versions=() python2="0" python2_maximal_version python2_minimal_version python3="0" python3_maximal_version python3_minimal_version USE_flag= version_components_group version_components_group_regex version_components_groups
+
+ version_components_group_regex="(2|3|\*)(:([[:digit:]]+\.[[:digit:]]+)?(:([[:digit:]]+\.[[:digit:]]+)?)?)?"
+ version_components_groups="${PYTHON_DEPEND}"
+
+ if [[ "${version_components_groups}" =~ ^((\!)?[[:alnum:]_-]+\?\ )?${version_components_group_regex}(\ ${version_components_group_regex})?$ ]]; then
+ if [[ "${version_components_groups}" =~ ^(\!)?[[:alnum:]_-]+\? ]]; then
+ USE_flag="${version_components_groups%\? *}"
+ version_components_groups="${version_components_groups#* }"
+ fi
+ if [[ "${version_components_groups}" =~ ("*".*" "|" *"|^2.*\ (2|\*)|^3.*\ (3|\*)) ]]; then
+ die "Invalid syntax of PYTHON_DEPEND: Incorrectly specified groups of versions"
+ fi
+
+ version_components_groups="${version_components_groups// /$'\n'}"
+ while read version_components_group; do
+ major_version="${version_components_group:0:1}"
+ minimal_version="${version_components_group:2}"
+ minimal_version="${minimal_version%:*}"
+ maximal_version="${version_components_group:$((3 + ${#minimal_version}))}"
+
+ if [[ "${major_version}" =~ ^(2|3)$ ]]; then
+ if [[ -n "${minimal_version}" && "${major_version}" != "${minimal_version:0:1}" ]]; then
+ die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' not in specified group of versions"
+ fi
+ if [[ -n "${maximal_version}" && "${major_version}" != "${maximal_version:0:1}" ]]; then
+ die "Invalid syntax of PYTHON_DEPEND: Maximal version '${maximal_version}' not in specified group of versions"
+ fi
+ fi
+
+ if [[ "${major_version}" == "2" ]]; then
+ python2="1"
+ python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}")
+ python2_minimal_version="${minimal_version}"
+ python2_maximal_version="${maximal_version}"
+ elif [[ "${major_version}" == "3" ]]; then
+ python3="1"
+ python_versions=("${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
+ python3_minimal_version="${minimal_version}"
+ python3_maximal_version="${maximal_version}"
+ else
+ python_all="1"
+ python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
+ python_minimal_version="${minimal_version}"
+ python_maximal_version="${maximal_version}"
+ fi
+
+ if [[ -n "${minimal_version}" ]] && ! has "${minimal_version}" "${python_versions[@]}"; then
+ die "Invalid syntax of PYTHON_DEPEND: Unrecognized minimal version '${minimal_version}'"
+ fi
+ if [[ -n "${maximal_version}" ]] && ! has "${maximal_version}" "${python_versions[@]}"; then
+ die "Invalid syntax of PYTHON_DEPEND: Unrecognized maximal version '${maximal_version}'"
+ fi
+
+ if [[ -n "${minimal_version}" && -n "${maximal_version}" && "${minimal_version}" > "${maximal_version}" ]]; then
+ die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' greater than maximal version '${maximal_version}'"
+ fi
+ done <<< "${version_components_groups}"
+
+ _PYTHON_ATOMS=()
+
+ _append_accepted_versions_range() {
+ local accepted_version="0" i
+ for ((i = "${#python_versions[@]}"; i >= 0; i--)); do
+ if [[ "${python_versions[${i}]}" == "${python_maximal_version}" ]]; then
+ accepted_version="1"
+ fi
+ if [[ "${accepted_version}" == "1" ]]; then
+ _PYTHON_ATOMS+=("=dev-lang/python-${python_versions[${i}]}*")
+ fi
+ if [[ "${python_versions[${i}]}" == "${python_minimal_version}" ]]; then
+ accepted_version="0"
+ fi
+ done
+ }
+
+ if [[ "${python_all}" == "1" ]]; then
+ if [[ -z "${python_minimal_version}" && -z "${python_maximal_version}" ]]; then
+ _PYTHON_ATOMS+=("dev-lang/python")
+ else
+ python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
+ python_minimal_version="${python_minimal_version:-${python_versions[0]}}"
+ python_maximal_version="${python_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
+ _append_accepted_versions_range
+ fi
+ else
+ if [[ "${python3}" == "1" ]]; then
+ if [[ -z "${python3_minimal_version}" && -z "${python3_maximal_version}" ]]; then
+ _PYTHON_ATOMS+=("=dev-lang/python-3*")
+ else
+ python_versions=("${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
+ python_minimal_version="${python3_minimal_version:-${python_versions[0]}}"
+ python_maximal_version="${python3_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
+ _append_accepted_versions_range
+ fi
+ fi
+ if [[ "${python2}" == "1" ]]; then
+ if [[ -z "${python2_minimal_version}" && -z "${python2_maximal_version}" ]]; then
+ _PYTHON_ATOMS+=("=dev-lang/python-2*")
+ else
+ python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}")
+ python_minimal_version="${python2_minimal_version:-${python_versions[0]}}"
+ python_maximal_version="${python2_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
+ _append_accepted_versions_range
+ fi
+ fi
+ fi
+
+ unset -f _append_accepted_versions_range
+
+ if [[ "${#_PYTHON_ATOMS[@]}" -gt 1 ]]; then
+ DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}"
+ RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}"
+ else
+ DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}"
+ RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}"
+ fi
+ else
+ die "Invalid syntax of PYTHON_DEPEND"
+ fi
+}
+
+if _python_implementation; then
+ DEPEND=">=app-eselect/eselect-python-20091230"
+ RDEPEND="${DEPEND}"
+ PDEPEND="app-admin/python-updater"
+fi
+
+if [[ -n "${PYTHON_DEPEND}" ]]; then
+ _python_parse_PYTHON_DEPEND
+else
+ _PYTHON_ATOMS=("dev-lang/python")
+fi
+unset -f _python_parse_PYTHON_DEPEND
+
+if [[ -n "${NEED_PYTHON}" ]]; then
+ eerror "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
+ die "NEED_PYTHON variable is banned"
+fi
+
+# @ECLASS-VARIABLE: PYTHON_USE_WITH
+# @DESCRIPTION:
+# Set this to a space separated list of USE flags the Python slot in use must be built with.
+
+# @ECLASS-VARIABLE: PYTHON_USE_WITH_OR
+# @DESCRIPTION:
+# Set this to a space separated list of USE flags of which one must be turned on for the slot in use.
+
+# @ECLASS-VARIABLE: PYTHON_USE_WITH_OPT
+# @DESCRIPTION:
+# Set this to a name of a USE flag if you need to make either PYTHON_USE_WITH or
+# PYTHON_USE_WITH_OR atoms conditional under a USE flag.
+
+if ! has "${EAPI:-0}" 0 1 && [[ -n ${PYTHON_USE_WITH} || -n ${PYTHON_USE_WITH_OR} ]]; then
+ _PYTHON_USE_WITH_ATOMS_ARRAY=()
+ if [[ -n "${PYTHON_USE_WITH}" ]]; then
+ for _PYTHON_ATOM in "${_PYTHON_ATOMS[@]}"; do
+ _PYTHON_USE_WITH_ATOMS_ARRAY+=("${_PYTHON_ATOM}[${PYTHON_USE_WITH// /,}]")
+ done
+ elif [[ -n "${PYTHON_USE_WITH_OR}" ]]; then
+ for _USE_flag in ${PYTHON_USE_WITH_OR}; do
+ for _PYTHON_ATOM in "${_PYTHON_ATOMS[@]}"; do
+ _PYTHON_USE_WITH_ATOMS_ARRAY+=("${_PYTHON_ATOM}[${_USE_flag}]")
+ done
+ done
+ unset _USE_flag
+ fi
+ if [[ "${#_PYTHON_USE_WITH_ATOMS_ARRAY[@]}" -gt 1 ]]; then
+ _PYTHON_USE_WITH_ATOMS="|| ( ${_PYTHON_USE_WITH_ATOMS_ARRAY[@]} )"
+ else
+ _PYTHON_USE_WITH_ATOMS="${_PYTHON_USE_WITH_ATOMS_ARRAY[@]}"
+ fi
+ if [[ -n "${PYTHON_USE_WITH_OPT}" ]]; then
+ _PYTHON_USE_WITH_ATOMS="${PYTHON_USE_WITH_OPT}? ( ${_PYTHON_USE_WITH_ATOMS} )"
+ fi
+ DEPEND+="${DEPEND:+ }${_PYTHON_USE_WITH_ATOMS}"
+ RDEPEND+="${RDEPEND:+ }${_PYTHON_USE_WITH_ATOMS}"
+ unset _PYTHON_ATOM _PYTHON_USE_WITH_ATOMS _PYTHON_USE_WITH_ATOMS_ARRAY
+fi
+
+unset _PYTHON_ATOMS
+
+# ================================================================================================
+# =================================== MISCELLANEOUS FUNCTIONS ====================================
+# ================================================================================================
+
+_python_abi-specific_local_scope() {
+ [[ " ${FUNCNAME[@]:2} " =~ " "(_python_final_sanity_checks|python_execute_function|python_mod_optimize|python_mod_cleanup)" " ]]
+}
+
+_python_initialize_prefix_variables() {
+ if has "${EAPI:-0}" 0 1 2; then
+ if [[ -n "${ROOT}" && -z "${EROOT}" ]]; then
+ EROOT="${ROOT%/}${EPREFIX}/"
+ fi
+ if [[ -n "${D}" && -z "${ED}" ]]; then
+ ED="${D%/}${EPREFIX}/"
+ fi
+ fi
+}
+
+unset PYTHON_SANITY_CHECKS_EXECUTED PYTHON_SKIP_SANITY_CHECKS
+
+_python_initial_sanity_checks() {
+ :
+}
+
+_python_final_sanity_checks() {
+ if ! _python_implementation && [[ "$(declare -p PYTHON_SANITY_CHECKS_EXECUTED 2> /dev/null)" != "declare -- PYTHON_SANITY_CHECKS_EXECUTED="* || " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " && -z "${PYTHON_SKIP_SANITY_CHECKS}" ]]; then
+ local PYTHON_ABI="${PYTHON_ABI}"
+ for PYTHON_ABI in ${PYTHON_ABIS-${PYTHON_ABI}}; do
+ # Ensure that appropriate version of Python is installed.
+ if ! has_version "$(python_get_implementational_package)"; then
+ die "$(python_get_implementational_package) is not installed"
+ fi
+
+ # Ensure that EPYTHON variable is respected.
+ if [[ "$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")" != "${PYTHON_ABI}" ]]; then
+ eerror "Path to 'python': '$(type -p python)'"
+ eerror "ABI: '${ABI}'"
+ eerror "DEFAULT_ABI: '${DEFAULT_ABI}'"
+ eerror "EPYTHON: '$(PYTHON)'"
+ eerror "PYTHON_ABI: '${PYTHON_ABI}'"
+ eerror "Locally active version of Python: '$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")'"
+ die "'python' does not respect EPYTHON variable"
+ fi
+ done
+ fi
+ PYTHON_SANITY_CHECKS_EXECUTED="1"
+}
+
+# @ECLASS-VARIABLE: PYTHON_COLORS
+# @DESCRIPTION:
+# User-configurable colored output.
+PYTHON_COLORS="${PYTHON_COLORS:-0}"
+
+_python_set_color_variables() {
+ if [[ "${PYTHON_COLORS}" != "0" && "${NOCOLOR:-false}" =~ ^(false|no)$ ]]; then
+ _BOLD=$'\e[1m'
+ _RED=$'\e[1;31m'
+ _GREEN=$'\e[1;32m'
+ _BLUE=$'\e[1;34m'
+ _CYAN=$'\e[1;36m'
+ _NORMAL=$'\e[0m'
+ else
+ _BOLD=
+ _RED=
+ _GREEN=
+ _BLUE=
+ _CYAN=
+ _NORMAL=
+ fi
+}
+
+_python_check_python_pkg_setup_execution() {
+ [[ " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " ]] && return
+
+ if ! has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_PKG_SETUP_EXECUTED}" ]]; then
+ die "python_pkg_setup() not called"
+ fi
+}
+
+# @FUNCTION: python_pkg_setup
+# @DESCRIPTION:
+# Perform sanity checks and initialize environment.
+#
+# This function is exported in EAPI 2 and 3 when PYTHON_USE_WITH or PYTHON_USE_WITH_OR variable
+# is set and always in EAPI >=4. Calling of this function is mandatory in EAPI >=4.
+python_pkg_setup() {
+ if [[ "${EBUILD_PHASE}" != "setup" ]]; then
+ die "${FUNCNAME}() can be used only in pkg_setup() phase"
+ fi
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ export JYTHON_SYSTEM_CACHEDIR="1"
+ addwrite "${EPREFIX}/var/cache/jython"
+
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ _python_calculate_PYTHON_ABIS
+ export EPYTHON="$(PYTHON -f)"
+ else
+ PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
+ fi
+
+ if ! has "${EAPI:-0}" 0 1 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; then
+ if [[ "${PYTHON_USE_WITH_OPT}" ]]; then
+ if [[ "${PYTHON_USE_WITH_OPT}" == !* ]]; then
+ use ${PYTHON_USE_WITH_OPT#!} && return
+ else
+ use !${PYTHON_USE_WITH_OPT} && return
+ fi
+ fi
+
+ python_pkg_setup_check_USE_flags() {
+ local python_atom USE_flag
+ python_atom="$(python_get_implementational_package)"
+
+ for USE_flag in ${PYTHON_USE_WITH}; do
+ if ! has_version "${python_atom}[${USE_flag}]"; then
+ eerror "Please rebuild ${python_atom} with the following USE flags enabled: ${PYTHON_USE_WITH}"
+ die "Please rebuild ${python_atom} with the following USE flags enabled: ${PYTHON_USE_WITH}"
+ fi
+ done
+
+ for USE_flag in ${PYTHON_USE_WITH_OR}; do
+ if has_version "${python_atom}[${USE_flag}]"; then
+ return
+ fi
+ done
+
+ if [[ ${PYTHON_USE_WITH_OR} ]]; then
+ eerror "Please rebuild ${python_atom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}"
+ die "Please rebuild ${python_atom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}"
+ fi
+ }
+
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ PYTHON_SKIP_SANITY_CHECKS="1" python_execute_function -q python_pkg_setup_check_USE_flags
+ else
+ python_pkg_setup_check_USE_flags
+ fi
+
+ unset -f python_pkg_setup_check_USE_flags
+ fi
+
+ PYTHON_PKG_SETUP_EXECUTED="1"
+}
+
+_PYTHON_SHEBANG_BASE_PART_REGEX='^#![[:space:]]*([^[:space:]]*/usr/bin/env[[:space:]]+)?([^[:space:]]*/)?(jython|pypy-c|python)'
+
+# @FUNCTION: python_convert_shebangs
+# @USAGE: [-q|--quiet] [-r|--recursive] [-x|--only-executables] [--] <Python_ABI|Python_version> <file|directory> [files|directories]
+# @DESCRIPTION:
+# Convert shebangs in specified files. Directories can be specified only with --recursive option.
+python_convert_shebangs() {
+ _python_check_python_pkg_setup_execution
+
+ local argument file files=() only_executables="0" python_interpreter quiet="0" recursive="0" shebangs_converted="0"
+
+ while (($#)); do
+ case "$1" in
+ -r|--recursive)
+ recursive="1"
+ ;;
+ -q|--quiet)
+ quiet="1"
+ ;;
+ -x|--only-executables)
+ only_executables="1"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "$#" -eq 0 ]]; then
+ die "${FUNCNAME}(): Missing Python version and files or directories"
+ elif [[ "$#" -eq 1 ]]; then
+ die "${FUNCNAME}(): Missing files or directories"
+ fi
+
+ if [[ -n "$(_python_get_implementation --ignore-invalid "$1")" ]]; then
+ python_interpreter="$(PYTHON "$1")"
+ else
+ python_interpreter="python$1"
+ fi
+ shift
+
+ for argument in "$@"; do
+ if [[ ! -e "${argument}" ]]; then
+ die "${FUNCNAME}(): '${argument}' does not exist"
+ elif [[ -f "${argument}" ]]; then
+ files+=("${argument}")
+ elif [[ -d "${argument}" ]]; then
+ if [[ "${recursive}" == "1" ]]; then
+ while read -d $'\0' -r file; do
+ files+=("${file}")
+ done < <(find "${argument}" $([[ "${only_executables}" == "1" ]] && echo -perm /111) -type f -print0)
+ else
+ die "${FUNCNAME}(): '${argument}' is not a regular file"
+ fi
+ else
+ die "${FUNCNAME}(): '${argument}' is not a regular file or a directory"
+ fi
+ done
+
+ for file in "${files[@]}"; do
+ file="${file#./}"
+ [[ "${only_executables}" == "1" && ! -x "${file}" ]] && continue
+
+ if [[ "$(head -n1 "${file}")" =~ ${_PYTHON_SHEBANG_BASE_PART_REGEX} ]]; then
+ [[ "$(sed -ne "2p" "${file}")" =~ ^"# Gentoo '".*"' wrapper script generated by python_generate_wrapper_scripts()"$ ]] && continue
+
+ shebangs_converted="1"
+
+ if [[ "${quiet}" == "0" ]]; then
+ einfo "Converting shebang in '${file}'"
+ fi
+
+ sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?\(jython\|pypy-c\|python\)\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2${python_interpreter}\6:" -i "${file}" || die "Conversion of shebang in '${file}' failed"
+ fi
+ done
+
+ if [[ "${shebangs_converted}" == "0" ]]; then
+ ewarn "${FUNCNAME}(): Python scripts not found"
+ fi
+}
+
+# @FUNCTION: python_clean_py-compile_files
+# @USAGE: [-q|--quiet]
+# @DESCRIPTION:
+# Clean py-compile files to disable byte-compilation.
+python_clean_py-compile_files() {
+ _python_check_python_pkg_setup_execution
+
+ local file files=() quiet="0"
+
+ while (($#)); do
+ case "$1" in
+ -q|--quiet)
+ quiet="1"
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ die "${FUNCNAME}(): Invalid usage"
+ ;;
+ esac
+ shift
+ done
+
+ while read -d $'\0' -r file; do
+ files+=("${file#./}")
+ done < <(find -name py-compile -type f -print0)
+
+ for file in "${files[@]}"; do
+ if [[ "${quiet}" == "0" ]]; then
+ einfo "Cleaning '${file}' file"
+ fi
+ echo "#!/bin/sh" > "${file}"
+ done
+}
+
+# @FUNCTION: python_clean_installation_image
+# @USAGE: [-q|--quiet]
+# @DESCRIPTION:
+# Delete needless files in installation image.
+#
+# This function can be used only in src_install() phase.
+python_clean_installation_image() {
+ if [[ "${EBUILD_PHASE}" != "install" ]]; then
+ die "${FUNCNAME}() can be used only in src_install() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_initialize_prefix_variables
+
+ local file files=() quiet="0"
+
+ while (($#)); do
+ case "$1" in
+ -q|--quiet)
+ quiet="1"
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ die "${FUNCNAME}(): Invalid usage"
+ ;;
+ esac
+ shift
+ done
+
+ while read -d $'\0' -r file; do
+ files+=("${file}")
+ done < <(find "${ED}" "(" -name "*.py[co]" -o -name "*\$py.class" ")" -type f -print0)
+
+ if [[ "${#files[@]}" -gt 0 ]]; then
+ if [[ "${quiet}" == "0" ]]; then
+ ewarn "Deleting byte-compiled Python modules needlessly generated by build system:"
+ fi
+ for file in "${files[@]}"; do
+ if [[ "${quiet}" == "0" ]]; then
+ ewarn " ${file}"
+ fi
+ rm -f "${file}"
+
+ # Delete empty __pycache__ directories.
+ if [[ "${file%/*}" == *"/__pycache__" ]]; then
+ rmdir "${file%/*}" 2> /dev/null
+ fi
+ done
+ fi
+
+ python_clean_sitedirs() {
+ if [[ -d "${ED}$(python_get_sitedir)" ]]; then
+ find "${ED}$(python_get_sitedir)" "(" -name "*.c" -o -name "*.h" -o -name "*.la" ")" -type f -print0 | xargs -0 rm -f
+ fi
+ }
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ python_execute_function -q python_clean_sitedirs
+ else
+ python_clean_sitedirs
+ fi
+
+ unset -f python_clean_sitedirs
+}
+
+# ================================================================================================
+# =========== FUNCTIONS FOR PACKAGES SUPPORTING INSTALLATION FOR MULTIPLE PYTHON ABIS ============
+# ================================================================================================
+
+# @ECLASS-VARIABLE: SUPPORT_PYTHON_ABIS
+# @DESCRIPTION:
+# Set this in EAPI <= 4 to indicate that current package supports installation for
+# multiple Python ABIs.
+
+# @ECLASS-VARIABLE: PYTHON_TESTS_RESTRICTED_ABIS
+# @DESCRIPTION:
+# Space-separated list of Python ABI patterns. Testing in Python ABIs matching any Python ABI
+# patterns specified in this list is skipped.
+
+# @ECLASS-VARIABLE: PYTHON_EXPORT_PHASE_FUNCTIONS
+# @DESCRIPTION:
+# Set this to export phase functions for the following ebuild phases:
+# src_prepare(), src_configure(), src_compile(), src_test(), src_install().
+if ! has "${EAPI:-0}" 0 1; then
+ python_src_prepare() {
+ if [[ "${EBUILD_PHASE}" != "prepare" ]]; then
+ die "${FUNCNAME}() can be used only in src_prepare() phase"
+ fi
+
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+
+ _python_check_python_pkg_setup_execution
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ python_copy_sources
+ }
+
+ for python_default_function in src_configure src_compile src_test; do
+ eval "python_${python_default_function}() {
+ if [[ \"\${EBUILD_PHASE}\" != \"${python_default_function#src_}\" ]]; then
+ die \"\${FUNCNAME}() can be used only in ${python_default_function}() phase\"
+ fi
+
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die \"\${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs\"
+ fi
+
+ _python_check_python_pkg_setup_execution
+
+ python_execute_function -d -s -- \"\$@\"
+ }"
+ done
+ unset python_default_function
+
+ python_src_install() {
+ if [[ "${EBUILD_PHASE}" != "install" ]]; then
+ die "${FUNCNAME}() can be used only in src_install() phase"
+ fi
+
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+
+ _python_check_python_pkg_setup_execution
+
+ if has "${EAPI:-0}" 0 1 2 3; then
+ python_execute_function -d -s -- "$@"
+ else
+ python_installation() {
+ emake DESTDIR="${T}/images/${PYTHON_ABI}" install "$@"
+ }
+ python_execute_function -s python_installation "$@"
+ unset python_installation
+
+ python_merge_intermediate_installation_images "${T}/images"
+ fi
+ }
+
+ if [[ -n "${PYTHON_EXPORT_PHASE_FUNCTIONS}" ]]; then
+ EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
+ fi
+fi
+
+unset PYTHON_ABIS
+
+_python_calculate_PYTHON_ABIS() {
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+
+ _python_initial_sanity_checks
+
+ if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]]; then
+ local PYTHON_ABI
+
+ if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then
+ local cpython_enabled="0"
+
+ if [[ -z "${USE_PYTHON}" ]]; then
+ die "USE_PYTHON variable is empty"
+ fi
+
+ for PYTHON_ABI in ${USE_PYTHON}; do
+ if ! has "${PYTHON_ABI}" "${_PYTHON_GLOBALLY_SUPPORTED_ABIS[@]}"; then
+ die "USE_PYTHON variable contains invalid value '${PYTHON_ABI}'"
+ fi
+
+ if has "${PYTHON_ABI}" "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; then
+ cpython_enabled="1"
+ fi
+
+ if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
+ export PYTHON_ABIS+="${PYTHON_ABIS:+ }${PYTHON_ABI}"
+ fi
+ done
+
+ if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then
+ die "USE_PYTHON variable does not enable any Python ABI supported by ${CATEGORY}/${PF}"
+ fi
+
+ if [[ "${cpython_enabled}" == "0" ]]; then
+ die "USE_PYTHON variable does not enable any CPython ABI"
+ fi
+ else
+ local python_version python2_version python3_version support_python_major_version
+
+ if ! has_version "dev-lang/python"; then
+ die "${FUNCNAME}(): 'dev-lang/python' is not installed"
+ fi
+
+ python_version="$("${EPREFIX}/usr/bin/python" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
+
+ if has_version "=dev-lang/python-2*"; then
+ python2_version="$("${EPREFIX}/usr/bin/python2" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
+
+ support_python_major_version="0"
+ for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}"; do
+ if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
+ support_python_major_version="1"
+ break
+ fi
+ done
+ if [[ "${support_python_major_version}" == "1" ]]; then
+ if _python_check_python_abi_matching --patterns-list "${python2_version}" "${RESTRICT_PYTHON_ABIS}"; then
+ die "Active version of CPython 2 is not supported by ${CATEGORY}/${PF}"
+ fi
+ else
+ python2_version=""
+ fi
+ fi
+
+ if has_version "=dev-lang/python-3*"; then
+ python3_version="$("${EPREFIX}/usr/bin/python3" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
+
+ support_python_major_version="0"
+ for PYTHON_ABI in "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do
+ if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
+ support_python_major_version="1"
+ break
+ fi
+ done
+ if [[ "${support_python_major_version}" == "1" ]]; then
+ if _python_check_python_abi_matching --patterns-list "${python3_version}" "${RESTRICT_PYTHON_ABIS}"; then
+ die "Active version of CPython 3 is not supported by ${CATEGORY}/${PF}"
+ fi
+ else
+ python3_version=""
+ fi
+ fi
+
+ if [[ -z "${python2_version}" && -z "${python3_version}" ]]; then
+ eerror "${CATEGORY}/${PF} requires at least one of the following packages:"
+ for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do
+ if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
+ eerror " dev-lang/python:${PYTHON_ABI}"
+ fi
+ done
+ die "No supported version of CPython installed"
+ fi
+
+ if [[ -n "${python2_version}" && "${python_version}" == "2."* && "${python_version}" != "${python2_version}" ]]; then
+ eerror "Python wrapper is configured incorrectly or '${EPREFIX}/usr/bin/python2' symlink"
+ eerror "is set incorrectly. Use \`eselect python\` to fix configuration."
+ die "Incorrect configuration of Python"
+ fi
+ if [[ -n "${python3_version}" && "${python_version}" == "3."* && "${python_version}" != "${python3_version}" ]]; then
+ eerror "Python wrapper is configured incorrectly or '${EPREFIX}/usr/bin/python3' symlink"
+ eerror "is set incorrectly. Use \`eselect python\` to fix configuration."
+ die "Incorrect configuration of Python"
+ fi
+
+ PYTHON_ABIS="${python2_version} ${python3_version}"
+ PYTHON_ABIS="${PYTHON_ABIS# }"
+ export PYTHON_ABIS="${PYTHON_ABIS% }"
+ fi
+ fi
+
+ _python_final_sanity_checks
+}
+
+_python_prepare_flags() {
+ local array=() deleted_flag element flags new_value old_flag old_value operator pattern prefix variable
+
+ for variable in CPPFLAGS CFLAGS CXXFLAGS LDFLAGS; do
+ eval "_PYTHON_SAVED_${variable}=\"\${!variable}\""
+ for prefix in PYTHON_USER_ PYTHON_; do
+ if [[ "$(declare -p ${prefix}${variable} 2> /dev/null)" == "declare -a ${prefix}${variable}="* ]]; then
+ eval "array=(\"\${${prefix}${variable}[@]}\")"
+ for element in "${array[@]}"; do
+ if [[ "${element}" =~ ^${_PYTHON_ABI_PATTERN_REGEX}\ (\+|-)\ .+ ]]; then
+ pattern="${element%% *}"
+ element="${element#* }"
+ operator="${element%% *}"
+ flags="${element#* }"
+ if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
+ if [[ "${operator}" == "+" ]]; then
+ eval "export ${variable}+=\"\${variable:+ }${flags}\""
+ elif [[ "${operator}" == "-" ]]; then
+ flags="${flags// /$'\n'}"
+ old_value="${!variable// /$'\n'}"
+ new_value=""
+ while read old_flag; do
+ while read deleted_flag; do
+ if [[ "${old_flag}" == ${deleted_flag} ]]; then
+ continue 2
+ fi
+ done <<< "${flags}"
+ new_value+="${new_value:+ }${old_flag}"
+ done <<< "${old_value}"
+ eval "export ${variable}=\"\${new_value}\""
+ fi
+ fi
+ else
+ die "Element '${element}' of ${prefix}${variable} array has invalid syntax"
+ fi
+ done
+ elif [[ -n "$(declare -p ${prefix}${variable} 2> /dev/null)" ]]; then
+ die "${prefix}${variable} should be indexed array"
+ fi
+ done
+ done
+}
+
+_python_restore_flags() {
+ local variable
+
+ for variable in CPPFLAGS CFLAGS CXXFLAGS LDFLAGS; do
+ eval "${variable}=\"\${_PYTHON_SAVED_${variable}}\""
+ unset _PYTHON_SAVED_${variable}
+ done
+}
+
+# @FUNCTION: python_execute_function
+# @USAGE: [--action-message message] [-d|--default-function] [--failure-message message] [-f|--final-ABI] [--nonfatal] [-q|--quiet] [-s|--separate-build-dirs] [--source-dir source_directory] [--] <function> [arguments]
+# @DESCRIPTION:
+# Execute specified function for each value of PYTHON_ABIS, optionally passing additional
+# arguments. The specified function can use PYTHON_ABI and BUILDDIR variables.
+python_execute_function() {
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_set_color_variables
+
+ local action action_message action_message_template default_function="0" failure_message failure_message_template final_ABI="0" function iterated_PYTHON_ABIS nonfatal="0" previous_directory previous_directory_stack previous_directory_stack_length PYTHON_ABI quiet="0" return_code separate_build_dirs="0" source_dir
+
+ while (($#)); do
+ case "$1" in
+ --action-message)
+ action_message_template="$2"
+ shift
+ ;;
+ -d|--default-function)
+ default_function="1"
+ ;;
+ --failure-message)
+ failure_message_template="$2"
+ shift
+ ;;
+ -f|--final-ABI)
+ final_ABI="1"
+ ;;
+ --nonfatal)
+ nonfatal="1"
+ ;;
+ -q|--quiet)
+ quiet="1"
+ ;;
+ -s|--separate-build-dirs)
+ separate_build_dirs="1"
+ ;;
+ --source-dir)
+ source_dir="$2"
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ if [[ -n "${source_dir}" && "${separate_build_dirs}" == 0 ]]; then
+ die "${FUNCNAME}(): '--source-dir' option can be specified only with '--separate-build-dirs' option"
+ fi
+
+ if [[ "${default_function}" == "0" ]]; then
+ if [[ "$#" -eq 0 ]]; then
+ die "${FUNCNAME}(): Missing function name"
+ fi
+ function="$1"
+ shift
+
+ if [[ -z "$(type -t "${function}")" ]]; then
+ die "${FUNCNAME}(): '${function}' function is not defined"
+ fi
+ else
+ if has "${EAPI:-0}" 0 1; then
+ die "${FUNCNAME}(): '--default-function' option cannot be used in this EAPI"
+ fi
+
+ if [[ "${EBUILD_PHASE}" == "configure" ]]; then
+ if has "${EAPI}" 2 3; then
+ python_default_function() {
+ econf "$@"
+ }
+ else
+ python_default_function() {
+ nonfatal econf "$@"
+ }
+ fi
+ elif [[ "${EBUILD_PHASE}" == "compile" ]]; then
+ python_default_function() {
+ emake "$@"
+ }
+ elif [[ "${EBUILD_PHASE}" == "test" ]]; then
+ python_default_function() {
+ # Stolen from portage's _eapi0_src_test()
+ local emake_cmd="${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE}"
+ if ${emake_cmd} -j1 -n check &> /dev/null; then
+ ${emake_cmd} -j1 check "$@"
+ elif ${emake_cmd} -j1 -n test &> /dev/null; then
+ ${emake_cmd} -j1 test "$@"
+ fi
+ }
+ elif [[ "${EBUILD_PHASE}" == "install" ]]; then
+ python_default_function() {
+ emake DESTDIR="${D}" install "$@"
+ }
+ else
+ die "${FUNCNAME}(): '--default-function' option cannot be used in this ebuild phase"
+ fi
+ function="python_default_function"
+ fi
+
+ # Ensure that python_execute_function() cannot be directly or indirectly called by python_execute_function().
+ if _python_abi-specific_local_scope; then
+ die "${FUNCNAME}(): Invalid call stack"
+ fi
+
+ if [[ "${quiet}" == "0" ]]; then
+ [[ "${EBUILD_PHASE}" == "setup" ]] && action="Setting up"
+ [[ "${EBUILD_PHASE}" == "unpack" ]] && action="Unpacking"
+ [[ "${EBUILD_PHASE}" == "prepare" ]] && action="Preparation"
+ [[ "${EBUILD_PHASE}" == "configure" ]] && action="Configuration"
+ [[ "${EBUILD_PHASE}" == "compile" ]] && action="Building"
+ [[ "${EBUILD_PHASE}" == "test" ]] && action="Testing"
+ [[ "${EBUILD_PHASE}" == "install" ]] && action="Installation"
+ [[ "${EBUILD_PHASE}" == "preinst" ]] && action="Preinstallation"
+ [[ "${EBUILD_PHASE}" == "postinst" ]] && action="Postinstallation"
+ [[ "${EBUILD_PHASE}" == "prerm" ]] && action="Preuninstallation"
+ [[ "${EBUILD_PHASE}" == "postrm" ]] && action="Postuninstallation"
+ fi
+
+ _python_calculate_PYTHON_ABIS
+ if [[ "${final_ABI}" == "1" ]]; then
+ iterated_PYTHON_ABIS="$(PYTHON -f --ABI)"
+ else
+ iterated_PYTHON_ABIS="${PYTHON_ABIS}"
+ fi
+ for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
+ if [[ "${EBUILD_PHASE}" == "test" ]] && _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${PYTHON_TESTS_RESTRICTED_ABIS}"; then
+ if [[ "${quiet}" == "0" ]]; then
+ echo " ${_GREEN}*${_NORMAL} ${_BLUE}Testing of ${CATEGORY}/${PF} with $(python_get_implementation_and_version) skipped${_NORMAL}"
+ fi
+ continue
+ fi
+
+ _python_prepare_flags
+
+ if [[ "${quiet}" == "0" ]]; then
+ if [[ -n "${action_message_template}" ]]; then
+ eval "action_message=\"${action_message_template}\""
+ else
+ action_message="${action} of ${CATEGORY}/${PF} with $(python_get_implementation_and_version)..."
+ fi
+ echo " ${_GREEN}*${_NORMAL} ${_BLUE}${action_message}${_NORMAL}"
+ fi
+
+ if [[ "${separate_build_dirs}" == "1" ]]; then
+ if [[ -n "${source_dir}" ]]; then
+ export BUILDDIR="${S}/${source_dir}-${PYTHON_ABI}"
+ else
+ export BUILDDIR="${S}-${PYTHON_ABI}"
+ fi
+ pushd "${BUILDDIR}" > /dev/null || die "pushd failed"
+ else
+ export BUILDDIR="${S}"
+ fi
+
+ previous_directory="$(pwd)"
+ previous_directory_stack="$(dirs -p)"
+ previous_directory_stack_length="$(dirs -p | wc -l)"
+
+ if ! has "${EAPI}" 0 1 2 3 && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then
+ EPYTHON="$(PYTHON)" nonfatal "${function}" "$@"
+ else
+ EPYTHON="$(PYTHON)" "${function}" "$@"
+ fi
+
+ return_code="$?"
+
+ _python_restore_flags
+
+ if [[ "${return_code}" -ne 0 ]]; then
+ if [[ -n "${failure_message_template}" ]]; then
+ eval "failure_message=\"${failure_message_template}\""
+ else
+ failure_message="${action} failed with $(python_get_implementation_and_version) in ${function}() function"
+ fi
+
+ if [[ "${nonfatal}" == "1" ]]; then
+ if [[ "${quiet}" == "0" ]]; then
+ ewarn "${failure_message}"
+ fi
+ elif [[ "${final_ABI}" == "0" ]] && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then
+ if [[ "${EBUILD_PHASE}" != "test" ]] || ! has test-fail-continue ${FEATURES}; then
+ local enabled_PYTHON_ABIS= other_PYTHON_ABI
+ for other_PYTHON_ABI in ${PYTHON_ABIS}; do
+ [[ "${other_PYTHON_ABI}" != "${PYTHON_ABI}" ]] && enabled_PYTHON_ABIS+="${enabled_PYTHON_ABIS:+ }${other_PYTHON_ABI}"
+ done
+ export PYTHON_ABIS="${enabled_PYTHON_ABIS}"
+ fi
+ if [[ "${quiet}" == "0" ]]; then
+ ewarn "${failure_message}"
+ fi
+ if [[ -z "${PYTHON_ABIS}" ]]; then
+ die "${function}() function failed with all enabled Python ABIs"
+ fi
+ else
+ die "${failure_message}"
+ fi
+ fi
+
+ # Ensure that directory stack has not been decreased.
+ if [[ "$(dirs -p | wc -l)" -lt "${previous_directory_stack_length}" ]]; then
+ die "Directory stack decreased illegally"
+ fi
+
+ # Avoid side effects of earlier returning from the specified function.
+ while [[ "$(dirs -p | wc -l)" -gt "${previous_directory_stack_length}" ]]; do
+ popd > /dev/null || die "popd failed"
+ done
+
+ # Ensure that the bottom part of directory stack has not been changed. Restore
+ # previous directory (from before running of the specified function) before
+ # comparison of directory stacks to avoid mismatch of directory stacks after
+ # potential using of 'cd' to change current directory. Restoration of previous
+ # directory allows to safely use 'cd' to change current directory in the
+ # specified function without changing it back to original directory.
+ cd "${previous_directory}"
+ if [[ "$(dirs -p)" != "${previous_directory_stack}" ]]; then
+ die "Directory stack changed illegally"
+ fi
+
+ if [[ "${separate_build_dirs}" == "1" ]]; then
+ popd > /dev/null || die "popd failed"
+ fi
+ unset BUILDDIR
+ done
+
+ if [[ "${default_function}" == "1" ]]; then
+ unset -f python_default_function
+ fi
+}
+
+# @FUNCTION: python_copy_sources
+# @USAGE: <directory="${S}"> [directory]
+# @DESCRIPTION:
+# Copy unpacked sources of current package to separate build directory for each Python ABI.
+python_copy_sources() {
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+
+ _python_check_python_pkg_setup_execution
+
+ local dir dirs=() PYTHON_ABI
+
+ if [[ "$#" -eq 0 ]]; then
+ if [[ "${WORKDIR}" == "${S}" ]]; then
+ die "${FUNCNAME}() cannot be used with current value of S variable"
+ fi
+ dirs=("${S%/}")
+ else
+ dirs=("$@")
+ fi
+
+ _python_calculate_PYTHON_ABIS
+ for PYTHON_ABI in ${PYTHON_ABIS}; do
+ for dir in "${dirs[@]}"; do
+ cp -pr "${dir}" "${dir}-${PYTHON_ABI}" > /dev/null || die "Copying of sources failed"
+ done
+ done
+}
+
+# @FUNCTION: python_generate_wrapper_scripts
+# @USAGE: [-E|--respect-EPYTHON] [-f|--force] [-q|--quiet] [--] <file> [files]
+# @DESCRIPTION:
+# Generate wrapper scripts. Existing files are overwritten only with --force option.
+# If --respect-EPYTHON option is specified, then generated wrapper scripts will
+# respect EPYTHON variable at run time.
+#
+# This function can be used only in src_install() phase.
+python_generate_wrapper_scripts() {
+ if [[ "${EBUILD_PHASE}" != "install" ]]; then
+ die "${FUNCNAME}() can be used only in src_install() phase"
+ fi
+
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_initialize_prefix_variables
+
+ local eselect_python_option file force="0" quiet="0" PYTHON_ABI PYTHON_ABIS_list python2_enabled="0" python3_enabled="0" respect_EPYTHON="0"
+
+ while (($#)); do
+ case "$1" in
+ -E|--respect-EPYTHON)
+ respect_EPYTHON="1"
+ ;;
+ -f|--force)
+ force="1"
+ ;;
+ -q|--quiet)
+ quiet="1"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "$#" -eq 0 ]]; then
+ die "${FUNCNAME}(): Missing arguments"
+ fi
+
+ _python_calculate_PYTHON_ABIS
+ for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}"; do
+ if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then
+ python2_enabled="1"
+ fi
+ done
+ for PYTHON_ABI in "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do
+ if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then
+ python3_enabled="1"
+ fi
+ done
+
+ if [[ "${python2_enabled}" == "1" && "${python3_enabled}" == "1" ]]; then
+ eselect_python_option=
+ elif [[ "${python2_enabled}" == "1" && "${python3_enabled}" == "0" ]]; then
+ eselect_python_option="--python2"
+ elif [[ "${python2_enabled}" == "0" && "${python3_enabled}" == "1" ]]; then
+ eselect_python_option="--python3"
+ else
+ die "${FUNCNAME}(): Unsupported environment"
+ fi
+
+ PYTHON_ABIS_list="$("$(PYTHON -f)" -c "print(', '.join('\"%s\"' % x for x in reversed('${PYTHON_ABIS}'.split())))")"
+
+ for file in "$@"; do
+ if [[ -f "${file}" && "${force}" == "0" ]]; then
+ die "${FUNCNAME}(): '${file}' already exists"
+ fi
+
+ if [[ "${quiet}" == "0" ]]; then
+ einfo "Generating '${file#${ED%/}}' wrapper script"
+ fi
+
+ cat << EOF > "${file}"
+#!/usr/bin/env python
+# Gentoo '${file##*/}' wrapper script generated by python_generate_wrapper_scripts()
+
+import os
+import re
+import subprocess
+import sys
+
+cpython_ABI_re = re.compile(r"^(\d+\.\d+)$")
+jython_ABI_re = re.compile(r"^(\d+\.\d+)-jython$")
+pypy_ABI_re = re.compile(r"^\d+\.\d+-pypy-(\d+\.\d+)$")
+cpython_interpreter_re = re.compile(r"^python(\d+\.\d+)$")
+jython_interpreter_re = re.compile(r"^jython(\d+\.\d+)$")
+pypy_interpreter_re = re.compile(r"^pypy-c(\d+\.\d+)$")
+cpython_shebang_re = re.compile(r"^#![ \t]*(?:${EPREFIX}/usr/bin/python|(?:${EPREFIX})?/usr/bin/env[ \t]+(?:${EPREFIX}/usr/bin/)?python)")
+python_shebang_options_re = re.compile(r"^#![ \t]*${EPREFIX}/usr/bin/(?:jython|pypy-c|python)(?:\d+(?:\.\d+)?)?[ \t]+(-\S)")
+python_verification_output_re = re.compile("^GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n$")
+
+#pypy_versions_mapping = {
+# "1.5": "2.7",
+# "1.6": "2.7",
+# "1.7": "2.7",
+# "1.8": "2.7",
+# "1.9": "2.7",
+# "2.0": "2.7",
+#}
+
+def get_PYTHON_ABI(python_interpreter):
+ cpython_matched = cpython_interpreter_re.match(python_interpreter)
+ jython_matched = jython_interpreter_re.match(python_interpreter)
+ pypy_matched = pypy_interpreter_re.match(python_interpreter)
+ if cpython_matched is not None:
+ PYTHON_ABI = cpython_matched.group(1)
+ elif jython_matched is not None:
+ PYTHON_ABI = jython_matched.group(1) + "-jython"
+ elif pypy_matched is not None:
+ #PYTHON_ABI = pypy_versions_mapping[pypy_matched.group(1)] + "-pypy-" + pypy_matched.group(1)
+ PYTHON_ABI = "2.7-pypy-" + pypy_matched.group(1)
+ else:
+ PYTHON_ABI = None
+ return PYTHON_ABI
+
+def get_python_interpreter(PYTHON_ABI):
+ cpython_matched = cpython_ABI_re.match(PYTHON_ABI)
+ jython_matched = jython_ABI_re.match(PYTHON_ABI)
+ pypy_matched = pypy_ABI_re.match(PYTHON_ABI)
+ if cpython_matched is not None:
+ python_interpreter = "python" + cpython_matched.group(1)
+ elif jython_matched is not None:
+ python_interpreter = "jython" + jython_matched.group(1)
+ elif pypy_matched is not None:
+ python_interpreter = "pypy-c" + pypy_matched.group(1)
+ else:
+ python_interpreter = None
+ return python_interpreter
+
+EOF
+ if [[ "$?" != "0" ]]; then
+ die "${FUNCNAME}(): Generation of '$1' failed"
+ fi
+ if [[ "${respect_EPYTHON}" == "1" ]]; then
+ cat << EOF >> "${file}"
+python_interpreter = os.environ.get("EPYTHON")
+if python_interpreter:
+ PYTHON_ABI = get_PYTHON_ABI(python_interpreter)
+ if PYTHON_ABI is None:
+ sys.stderr.write("%s: EPYTHON variable has unrecognized value '%s'\n" % (sys.argv[0], python_interpreter))
+ sys.exit(1)
+else:
+ try:
+ environment = os.environ.copy()
+ environment["ROOT"] = "/"
+ eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], env=environment, stdout=subprocess.PIPE)
+ if eselect_process.wait() != 0:
+ raise ValueError
+ except (OSError, ValueError):
+ sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0])
+ sys.exit(1)
+
+ python_interpreter = eselect_process.stdout.read()
+ if not isinstance(python_interpreter, str):
+ # Python 3
+ python_interpreter = python_interpreter.decode()
+ python_interpreter = python_interpreter.rstrip("\n")
+
+ PYTHON_ABI = get_PYTHON_ABI(python_interpreter)
+ if PYTHON_ABI is None:
+ sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], python_interpreter))
+ sys.exit(1)
+
+wrapper_script_path = os.path.realpath(sys.argv[0])
+target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI)
+if not os.path.exists(target_executable_path):
+ sys.stderr.write("%s: '%s' does not exist\n" % (sys.argv[0], target_executable_path))
+ sys.exit(1)
+EOF
+ if [[ "$?" != "0" ]]; then
+ die "${FUNCNAME}(): Generation of '$1' failed"
+ fi
+ else
+ cat << EOF >> "${file}"
+try:
+ environment = os.environ.copy()
+ environment["ROOT"] = "/"
+ eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], env=environment, stdout=subprocess.PIPE)
+ if eselect_process.wait() != 0:
+ raise ValueError
+except (OSError, ValueError):
+ sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0])
+ sys.exit(1)
+
+python_interpreter = eselect_process.stdout.read()
+if not isinstance(python_interpreter, str):
+ # Python 3
+ python_interpreter = python_interpreter.decode()
+python_interpreter = python_interpreter.rstrip("\n")
+
+PYTHON_ABI = get_PYTHON_ABI(python_interpreter)
+if PYTHON_ABI is None:
+ sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], python_interpreter))
+ sys.exit(1)
+
+wrapper_script_path = os.path.realpath(sys.argv[0])
+for PYTHON_ABI in [PYTHON_ABI, ${PYTHON_ABIS_list}]:
+ target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI)
+ if os.path.exists(target_executable_path):
+ break
+else:
+ sys.stderr.write("%s: No target script exists for '%s'\n" % (sys.argv[0], wrapper_script_path))
+ sys.exit(1)
+
+python_interpreter = get_python_interpreter(PYTHON_ABI)
+if python_interpreter is None:
+ sys.stderr.write("%s: Unrecognized Python ABI '%s'\n" % (sys.argv[0], PYTHON_ABI))
+ sys.exit(1)
+EOF
+ if [[ "$?" != "0" ]]; then
+ die "${FUNCNAME}(): Generation of '$1' failed"
+ fi
+ fi
+ cat << EOF >> "${file}"
+
+target_executable = open(target_executable_path, "rb")
+target_executable_first_line = target_executable.readline()
+target_executable.close()
+if not isinstance(target_executable_first_line, str):
+ # Python 3
+ target_executable_first_line = target_executable_first_line.decode("utf_8", "replace")
+
+options = []
+python_shebang_options_matched = python_shebang_options_re.match(target_executable_first_line)
+if python_shebang_options_matched is not None:
+ options = [python_shebang_options_matched.group(1)]
+
+cpython_shebang_matched = cpython_shebang_re.match(target_executable_first_line)
+
+if cpython_shebang_matched is not None:
+ try:
+ python_interpreter_path = "${EPREFIX}/usr/bin/%s" % python_interpreter
+ os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"] = "1"
+ python_verification_process = subprocess.Popen([python_interpreter_path, "-c", "pass"], stdout=subprocess.PIPE)
+ del os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"]
+ if python_verification_process.wait() != 0:
+ raise ValueError
+
+ python_verification_output = python_verification_process.stdout.read()
+ if not isinstance(python_verification_output, str):
+ # Python 3
+ python_verification_output = python_verification_output.decode()
+
+ if not python_verification_output_re.match(python_verification_output):
+ raise ValueError
+
+ if cpython_interpreter_re.match(python_interpreter) is not None:
+ os.environ["GENTOO_PYTHON_PROCESS_NAME"] = os.path.basename(sys.argv[0])
+ os.environ["GENTOO_PYTHON_WRAPPER_SCRIPT_PATH"] = sys.argv[0]
+ os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH"] = target_executable_path
+
+ if hasattr(os, "execv"):
+ os.execv(python_interpreter_path, [python_interpreter_path] + options + sys.argv)
+ else:
+ sys.exit(subprocess.Popen([python_interpreter_path] + options + sys.argv).wait())
+ except (KeyboardInterrupt, SystemExit):
+ raise
+ except:
+ pass
+ for variable in ("GENTOO_PYTHON_PROCESS_NAME", "GENTOO_PYTHON_WRAPPER_SCRIPT_PATH", "GENTOO_PYTHON_TARGET_SCRIPT_PATH", "GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"):
+ if variable in os.environ:
+ del os.environ[variable]
+
+if hasattr(os, "execv"):
+ os.execv(target_executable_path, sys.argv)
+else:
+ sys.exit(subprocess.Popen([target_executable_path] + sys.argv[1:]).wait())
+EOF
+ if [[ "$?" != "0" ]]; then
+ die "${FUNCNAME}(): Generation of '$1' failed"
+ fi
+ fperms +x "${file#${ED%/}}" || die "fperms '${file}' failed"
+ done
+}
+
+# @ECLASS-VARIABLE: PYTHON_VERSIONED_SCRIPTS
+# @DESCRIPTION:
+# Array of regular expressions of paths to versioned Python scripts.
+# Python scripts in /usr/bin and /usr/sbin are versioned by default.
+
+# @ECLASS-VARIABLE: PYTHON_VERSIONED_EXECUTABLES
+# @DESCRIPTION:
+# Array of regular expressions of paths to versioned executables (including Python scripts).
+
+# @ECLASS-VARIABLE: PYTHON_NONVERSIONED_EXECUTABLES
+# @DESCRIPTION:
+# Array of regular expressions of paths to nonversioned executables (including Python scripts).
+
+# @FUNCTION: python_merge_intermediate_installation_images
+# @USAGE: [-q|--quiet] [--] <intermediate_installation_images_directory>
+# @DESCRIPTION:
+# Merge intermediate installation images into installation image.
+#
+# This function can be used only in src_install() phase.
+python_merge_intermediate_installation_images() {
+ if [[ "${EBUILD_PHASE}" != "install" ]]; then
+ die "${FUNCNAME}() can be used only in src_install() phase"
+ fi
+
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_initialize_prefix_variables
+
+ local absolute_file b file files=() intermediate_installation_images_directory PYTHON_ABI quiet="0" regex shebang version_executable wrapper_scripts=() wrapper_scripts_set=()
+
+ while (($#)); do
+ case "$1" in
+ -q|--quiet)
+ quiet="1"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "$#" -ne 1 ]]; then
+ die "${FUNCNAME}() requires 1 argument"
+ fi
+
+ intermediate_installation_images_directory="$1"
+
+ if [[ ! -d "${intermediate_installation_images_directory}" ]]; then
+ die "${FUNCNAME}(): Intermediate installation images directory '${intermediate_installation_images_directory}' does not exist"
+ fi
+
+ _python_calculate_PYTHON_ABIS
+ if [[ "$(PYTHON -f --ABI)" == 3.* ]]; then
+ b="b"
+ fi
+
+ while read -d $'\0' -r file; do
+ files+=("${file}")
+ done < <("$(PYTHON -f)" -c \
+"import os
+import sys
+
+if hasattr(sys.stdout, 'buffer'):
+ # Python 3
+ stdout = sys.stdout.buffer
+else:
+ # Python 2
+ stdout = sys.stdout
+
+files_set = set()
+
+os.chdir(${b}'${intermediate_installation_images_directory}')
+
+for PYTHON_ABI in ${b}'${PYTHON_ABIS}'.split():
+ for root, dirs, files in os.walk(PYTHON_ABI + ${b}'${EPREFIX}'):
+ root = root[len(PYTHON_ABI + ${b}'${EPREFIX}')+1:]
+ files_set.update(root + ${b}'/' + file for file in files)
+
+for file in sorted(files_set):
+ stdout.write(file)
+ stdout.write(${b}'\x00')" || die "${FUNCNAME}(): Failure of extraction of files in intermediate installation images")
+
+ for PYTHON_ABI in ${PYTHON_ABIS}; do
+ if [[ ! -d "${intermediate_installation_images_directory}/${PYTHON_ABI}" ]]; then
+ die "${FUNCNAME}(): Intermediate installation image for Python ABI '${PYTHON_ABI}' does not exist"
+ fi
+
+ pushd "${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}" > /dev/null || die "pushd failed"
+
+ for file in "${files[@]}"; do
+ version_executable="0"
+ for regex in "/usr/bin/.*" "/usr/sbin/.*" "${PYTHON_VERSIONED_SCRIPTS[@]}"; do
+ if [[ "/${file}" =~ ^${regex}$ ]]; then
+ version_executable="1"
+ break
+ fi
+ done
+ for regex in "${PYTHON_VERSIONED_EXECUTABLES[@]}"; do
+ if [[ "/${file}" =~ ^${regex}$ ]]; then
+ version_executable="2"
+ break
+ fi
+ done
+ if [[ "${version_executable}" != "0" ]]; then
+ for regex in "${PYTHON_NONVERSIONED_EXECUTABLES[@]}"; do
+ if [[ "/${file}" =~ ^${regex}$ ]]; then
+ version_executable="0"
+ break
+ fi
+ done
+ fi
+
+ [[ "${version_executable}" == "0" ]] && continue
+
+ if [[ -L "${file}" ]]; then
+ absolute_file="$(readlink "${file}")"
+ if [[ "${absolute_file}" == /* ]]; then
+ absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${absolute_file##/}"
+ else
+ if [[ "${file}" == */* ]]; then
+ absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${file%/*}/${absolute_file}"
+ else
+ absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${absolute_file}"
+ fi
+ fi
+ else
+ absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${file}"
+ fi
+
+ [[ ! -x "${absolute_file}" ]] && continue
+
+ shebang="$(head -n1 "${absolute_file}")" || die "Extraction of shebang from '${absolute_file}' failed"
+
+ if [[ "${version_executable}" == "2" ]]; then
+ wrapper_scripts+=("${ED}${file}")
+ elif [[ "${version_executable}" == "1" ]]; then
+ if [[ "${shebang}" =~ ${_PYTHON_SHEBANG_BASE_PART_REGEX}([[:digit:]]+(\.[[:digit:]]+)?)?($|[[:space:]]+) ]]; then
+ wrapper_scripts+=("${ED}${file}")
+ else
+ version_executable="0"
+ fi
+ fi
+
+ [[ "${version_executable}" == "0" ]] && continue
+
+ if [[ -e "${file}-${PYTHON_ABI}" ]]; then
+ die "${FUNCNAME}(): '${EPREFIX}/${file}-${PYTHON_ABI}' already exists"
+ fi
+
+ mv "${file}" "${file}-${PYTHON_ABI}" || die "Renaming of '${file}' failed"
+
+ if [[ "${shebang}" =~ ${_PYTHON_SHEBANG_BASE_PART_REGEX}[[:digit:]]*($|[[:space:]]+) ]]; then
+ if [[ -L "${file}-${PYTHON_ABI}" ]]; then
+ python_convert_shebangs $([[ "${quiet}" == "1" ]] && echo --quiet) "${PYTHON_ABI}" "${absolute_file}"
+ else
+ python_convert_shebangs $([[ "${quiet}" == "1" ]] && echo --quiet) "${PYTHON_ABI}" "${file}-${PYTHON_ABI}"
+ fi
+ fi
+ done
+
+ popd > /dev/null || die "popd failed"
+
+ # This is per bug #390691, without the duplication refactor, and with
+ # the 3-way structure per comment #6. This enable users with old
+ # coreutils to upgrade a lot easier (you need to upgrade python+portage
+ # before coreutils can be upgraded).
+ if ROOT="/" has_version '>=sys-apps/coreutils-6.9.90'; then
+ cp -fr --preserve=all --no-preserve=context "${intermediate_installation_images_directory}/${PYTHON_ABI}/"* "${D}" || die "Merging of intermediate installation image for Python ABI '${PYTHON_ABI} into installation image failed"
+ elif ROOT="/" has_version sys-apps/coreutils; then
+ cp -fr --preserve=all "${intermediate_installation_images_directory}/${PYTHON_ABI}/"* "${D}" || die "Merging of intermediate installation image for Python ABI '${PYTHON_ABI} into installation image failed"
+ else
+ cp -fpr "${intermediate_installation_images_directory}/${PYTHON_ABI}/"* "${D}" || die "Merging of intermediate installation image for Python ABI '${PYTHON_ABI} into installation image failed"
+ fi
+ done
+
+ rm -fr "${intermediate_installation_images_directory}"
+
+ if [[ "${#wrapper_scripts[@]}" -ge 1 ]]; then
+ rm -f "${T}/python_wrapper_scripts"
+
+ for file in "${wrapper_scripts[@]}"; do
+ echo -n "${file}" >> "${T}/python_wrapper_scripts"
+ echo -en "\x00" >> "${T}/python_wrapper_scripts"
+ done
+
+ while read -d $'\0' -r file; do
+ wrapper_scripts_set+=("${file}")
+ done < <("$(PYTHON -f)" -c \
+"import sys
+
+if hasattr(sys.stdout, 'buffer'):
+ # Python 3
+ stdout = sys.stdout.buffer
+else:
+ # Python 2
+ stdout = sys.stdout
+
+python_wrapper_scripts_file = open('${T}/python_wrapper_scripts', 'rb')
+files = set(python_wrapper_scripts_file.read().rstrip(${b}'\x00').split(${b}'\x00'))
+python_wrapper_scripts_file.close()
+
+for file in sorted(files):
+ stdout.write(file)
+ stdout.write(${b}'\x00')" || die "${FUNCNAME}(): Failure of extraction of set of wrapper scripts")
+
+ python_generate_wrapper_scripts $([[ "${quiet}" == "1" ]] && echo --quiet) "${wrapper_scripts_set[@]}"
+ fi
+}
+
+# ================================================================================================
+# ========= FUNCTIONS FOR PACKAGES NOT SUPPORTING INSTALLATION FOR MULTIPLE PYTHON ABIS ==========
+# ================================================================================================
+
+unset EPYTHON PYTHON_ABI
+
+# @FUNCTION: python_set_active_version
+# @USAGE: <Python_ABI|2|3>
+# @DESCRIPTION:
+# Set locally active version of Python.
+# If Python_ABI argument is specified, then version of Python corresponding to Python_ABI is used.
+# If 2 argument is specified, then active version of CPython 2 is used.
+# If 3 argument is specified, then active version of CPython 3 is used.
+#
+# This function can be used only in pkg_setup() phase.
+python_set_active_version() {
+ if [[ "${EBUILD_PHASE}" != "setup" ]]; then
+ die "${FUNCNAME}() can be used only in pkg_setup() phase"
+ fi
+
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+ fi
+
+ if [[ "$#" -ne 1 ]]; then
+ die "${FUNCNAME}() requires 1 argument"
+ fi
+
+ _python_initial_sanity_checks
+
+ if [[ -z "${PYTHON_ABI}" ]]; then
+ if [[ -n "$(_python_get_implementation --ignore-invalid "$1")" ]]; then
+ # PYTHON_ABI variable is intended to be used only in ebuilds/eclasses,
+ # so it does not need to be exported to subprocesses.
+ PYTHON_ABI="$1"
+ if ! _python_implementation && ! has_version "$(python_get_implementational_package)"; then
+ die "${FUNCNAME}(): '$(python_get_implementational_package)' is not installed"
+ fi
+ export EPYTHON="$(PYTHON "$1")"
+ elif [[ "$1" == "2" ]]; then
+ if ! _python_implementation && ! has_version "=dev-lang/python-2*"; then
+ die "${FUNCNAME}(): '=dev-lang/python-2*' is not installed"
+ fi
+ export EPYTHON="$(PYTHON -2)"
+ PYTHON_ABI="${EPYTHON#python}"
+ PYTHON_ABI="${PYTHON_ABI%%-*}"
+ elif [[ "$1" == "3" ]]; then
+ if ! _python_implementation && ! has_version "=dev-lang/python-3*"; then
+ die "${FUNCNAME}(): '=dev-lang/python-3*' is not installed"
+ fi
+ export EPYTHON="$(PYTHON -3)"
+ PYTHON_ABI="${EPYTHON#python}"
+ PYTHON_ABI="${PYTHON_ABI%%-*}"
+ else
+ die "${FUNCNAME}(): Unrecognized argument '$1'"
+ fi
+ fi
+
+ _python_final_sanity_checks
+
+ # python-updater checks PYTHON_REQUESTED_ACTIVE_VERSION variable.
+ PYTHON_REQUESTED_ACTIVE_VERSION="$1"
+}
+
+# @FUNCTION: python_need_rebuild
+# @DESCRIPTION:
+# Mark current package for rebuilding by python-updater after
+# switching of active version of Python.
+python_need_rebuild() {
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+ fi
+
+ _python_check_python_pkg_setup_execution
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ export PYTHON_NEED_REBUILD="$(PYTHON --ABI)"
+}
+
+# ================================================================================================
+# ======================================= GETTER FUNCTIONS =======================================
+# ================================================================================================
+
+_PYTHON_ABI_EXTRACTION_COMMAND=\
+'import platform
+import sys
+sys.stdout.write(".".join(str(x) for x in sys.version_info[:2]))
+if platform.system()[:4] == "Java":
+ sys.stdout.write("-jython")
+elif hasattr(platform, "python_implementation") and platform.python_implementation() == "PyPy":
+ sys.stdout.write("-pypy-" + ".".join(str(x) for x in sys.pypy_version_info[:2]))'
+
+_python_get_implementation() {
+ local ignore_invalid="0"
+
+ while (($#)); do
+ case "$1" in
+ --ignore-invalid)
+ ignore_invalid="1"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "$#" -ne 1 ]]; then
+ die "${FUNCNAME}() requires 1 argument"
+ fi
+
+ if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
+ echo "CPython"
+ elif [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
+ echo "Jython"
+ elif [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+-pypy-[[:digit:]]+\.[[:digit:]]+$ ]]; then
+ echo "PyPy"
+ else
+ if [[ "${ignore_invalid}" == "0" ]]; then
+ die "${FUNCNAME}(): Unrecognized Python ABI '$1'"
+ fi
+ fi
+}
+
+# @FUNCTION: PYTHON
+# @USAGE: [-2] [-3] [--ABI] [-a|--absolute-path] [-f|--final-ABI] [--] <Python_ABI="${PYTHON_ABI}">
+# @DESCRIPTION:
+# Print filename of Python interpreter for specified Python ABI. If Python_ABI argument
+# is ommitted, then PYTHON_ABI environment variable must be set and is used.
+# If -2 option is specified, then active version of CPython 2 is used.
+# If -3 option is specified, then active version of CPython 3 is used.
+# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
+# -2, -3 and --final-ABI options and Python_ABI argument cannot be specified simultaneously.
+# If --ABI option is specified, then only specified Python ABI is printed instead of
+# filename of Python interpreter.
+# If --absolute-path option is specified, then absolute path to Python interpreter is printed.
+# --ABI and --absolute-path options cannot be specified simultaneously.
+PYTHON() {
+ _python_check_python_pkg_setup_execution
+
+ local ABI_output="0" absolute_path_output="0" final_ABI="0" PYTHON_ABI="${PYTHON_ABI}" python_interpreter python2="0" python3="0"
+
+ while (($#)); do
+ case "$1" in
+ -2)
+ python2="1"
+ ;;
+ -3)
+ python3="1"
+ ;;
+ --ABI)
+ ABI_output="1"
+ ;;
+ -a|--absolute-path)
+ absolute_path_output="1"
+ ;;
+ -f|--final-ABI)
+ final_ABI="1"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${ABI_output}" == "1" && "${absolute_path_output}" == "1" ]]; then
+ die "${FUNCNAME}(): '--ABI' and '--absolute-path' options cannot be specified simultaneously"
+ fi
+
+ if [[ "$((${python2} + ${python3} + ${final_ABI}))" -gt 1 ]]; then
+ die "${FUNCNAME}(): '-2', '-3' or '--final-ABI' options cannot be specified simultaneously"
+ fi
+
+ if [[ "$#" -eq 0 ]]; then
+ if [[ "${final_ABI}" == "1" ]]; then
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+ _python_calculate_PYTHON_ABIS
+ PYTHON_ABI="${PYTHON_ABIS##* }"
+ elif [[ "${python2}" == "1" ]]; then
+ PYTHON_ABI="$(ROOT="/" eselect python show --python2 --ABI)"
+ if [[ -z "${PYTHON_ABI}" ]]; then
+ die "${FUNCNAME}(): Active version of CPython 2 not set"
+ elif [[ "${PYTHON_ABI}" != "2."* ]]; then
+ die "${FUNCNAME}(): Internal error in \`eselect python show --python2\`"
+ fi
+ elif [[ "${python3}" == "1" ]]; then
+ PYTHON_ABI="$(ROOT="/" eselect python show --python3 --ABI)"
+ if [[ -z "${PYTHON_ABI}" ]]; then
+ die "${FUNCNAME}(): Active version of CPython 3 not set"
+ elif [[ "${PYTHON_ABI}" != "3."* ]]; then
+ die "${FUNCNAME}(): Internal error in \`eselect python show --python3\`"
+ fi
+ elif _python_package_supporting_installation_for_multiple_python_abis; then
+ if ! _python_abi-specific_local_scope; then
+ die "${FUNCNAME}() should be used in ABI-specific local scope"
+ fi
+ else
+ PYTHON_ABI="$("${EPREFIX}/usr/bin/python" -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")"
+ if [[ -z "${PYTHON_ABI}" ]]; then
+ die "${FUNCNAME}(): Failure of extraction of locally active version of Python"
+ fi
+ fi
+ elif [[ "$#" -eq 1 ]]; then
+ if [[ "${final_ABI}" == "1" ]]; then
+ die "${FUNCNAME}(): '--final-ABI' option and Python ABI cannot be specified simultaneously"
+ fi
+ if [[ "${python2}" == "1" ]]; then
+ die "${FUNCNAME}(): '-2' option and Python ABI cannot be specified simultaneously"
+ fi
+ if [[ "${python3}" == "1" ]]; then
+ die "${FUNCNAME}(): '-3' option and Python ABI cannot be specified simultaneously"
+ fi
+ PYTHON_ABI="$1"
+ else
+ die "${FUNCNAME}(): Invalid usage"
+ fi
+
+ if [[ "${ABI_output}" == "1" ]]; then
+ echo -n "${PYTHON_ABI}"
+ return
+ else
+ if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
+ python_interpreter="python${PYTHON_ABI}"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
+ python_interpreter="jython${PYTHON_ABI%-jython}"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
+ python_interpreter="pypy-c${PYTHON_ABI#*-pypy-}"
+ fi
+
+ if [[ "${absolute_path_output}" == "1" ]]; then
+ echo -n "${EPREFIX}/usr/bin/${python_interpreter}"
+ else
+ echo -n "${python_interpreter}"
+ fi
+ fi
+
+ if [[ -n "${ABI}" && "${ABI}" != "${DEFAULT_ABI}" && "${DEFAULT_ABI}" != "default" ]]; then
+ echo -n "-${ABI}"
+ fi
+}
+
+# @FUNCTION: python_get_implementation
+# @USAGE: [-f|--final-ABI]
+# @DESCRIPTION:
+# Print name of Python implementation.
+# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
+python_get_implementation() {
+ _python_check_python_pkg_setup_execution
+
+ local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"
+
+ while (($#)); do
+ case "$1" in
+ -f|--final-ABI)
+ final_ABI="1"
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ die "${FUNCNAME}(): Invalid usage"
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${final_ABI}" == "1" ]]; then
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+ PYTHON_ABI="$(PYTHON -f --ABI)"
+ else
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ if ! _python_abi-specific_local_scope; then
+ die "${FUNCNAME}() should be used in ABI-specific local scope"
+ fi
+ else
+ PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
+ fi
+ fi
+
+ echo "$(_python_get_implementation "${PYTHON_ABI}")"
+}
+
+# @FUNCTION: python_get_implementational_package
+# @USAGE: [-f|--final-ABI]
+# @DESCRIPTION:
+# Print category, name and slot of package providing Python implementation.
+# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
+python_get_implementational_package() {
+ _python_check_python_pkg_setup_execution
+
+ local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"
+
+ while (($#)); do
+ case "$1" in
+ -f|--final-ABI)
+ final_ABI="1"
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ die "${FUNCNAME}(): Invalid usage"
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${final_ABI}" == "1" ]]; then
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+ PYTHON_ABI="$(PYTHON -f --ABI)"
+ else
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ if ! _python_abi-specific_local_scope; then
+ die "${FUNCNAME}() should be used in ABI-specific local scope"
+ fi
+ else
+ PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
+ fi
+ fi
+
+ if [[ "${EAPI:-0}" == "0" ]]; then
+ if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
+ echo "=dev-lang/python-${PYTHON_ABI}*"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
+ echo "=dev-java/jython-${PYTHON_ABI%-jython}*"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
+ echo "=virtual/pypy-${PYTHON_ABI#*-pypy-}*"
+ fi
+ else
+ if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
+ echo "dev-lang/python:${PYTHON_ABI}"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
+ echo "dev-java/jython:${PYTHON_ABI%-jython}"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
+ echo "virtual/pypy:${PYTHON_ABI#*-pypy-}"
+ fi
+ fi
+}
+
+# @FUNCTION: python_get_includedir
+# @USAGE: [-b|--base-path] [-f|--final-ABI]
+# @DESCRIPTION:
+# Print path to Python include directory.
+# If --base-path option is specified, then path not prefixed with "/" is printed.
+# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
+python_get_includedir() {
+ _python_check_python_pkg_setup_execution
+
+ local base_path="0" final_ABI="0" prefix PYTHON_ABI="${PYTHON_ABI}"
+
+ while (($#)); do
+ case "$1" in
+ -b|--base-path)
+ base_path="1"
+ ;;
+ -f|--final-ABI)
+ final_ABI="1"
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ die "${FUNCNAME}(): Invalid usage"
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${base_path}" == "0" ]]; then
+ prefix="/"
+ fi
+
+ if [[ "${final_ABI}" == "1" ]]; then
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+ PYTHON_ABI="$(PYTHON -f --ABI)"
+ else
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ if ! _python_abi-specific_local_scope; then
+ die "${FUNCNAME}() should be used in ABI-specific local scope"
+ fi
+ else
+ PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
+ fi
+ fi
+
+ if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
+ echo "${prefix}usr/include/python${PYTHON_ABI}"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
+ echo "${prefix}usr/share/jython-${PYTHON_ABI%-jython}/Include"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
+ echo "${prefix}usr/$(get_libdir)/pypy${PYTHON_ABI#*-pypy-}/include"
+ fi
+}
+
+# @FUNCTION: python_get_libdir
+# @USAGE: [-b|--base-path] [-f|--final-ABI]
+# @DESCRIPTION:
+# Print path to Python standard library directory.
+# If --base-path option is specified, then path not prefixed with "/" is printed.
+# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
+python_get_libdir() {
+ _python_check_python_pkg_setup_execution
+
+ local base_path="0" final_ABI="0" prefix PYTHON_ABI="${PYTHON_ABI}"
+
+ while (($#)); do
+ case "$1" in
+ -b|--base-path)
+ base_path="1"
+ ;;
+ -f|--final-ABI)
+ final_ABI="1"
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ die "${FUNCNAME}(): Invalid usage"
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${base_path}" == "0" ]]; then
+ prefix="/"
+ fi
+
+ if [[ "${final_ABI}" == "1" ]]; then
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+ PYTHON_ABI="$(PYTHON -f --ABI)"
+ else
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ if ! _python_abi-specific_local_scope; then
+ die "${FUNCNAME}() should be used in ABI-specific local scope"
+ fi
+ else
+ PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
+ fi
+ fi
+
+ if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
+ echo "${prefix}usr/$(get_libdir)/python${PYTHON_ABI}"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
+ echo "${prefix}usr/share/jython-${PYTHON_ABI%-jython}/Lib"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
+ die "${FUNCNAME}(): PyPy has multiple standard library directories"
+ fi
+}
+
+# @FUNCTION: python_get_sitedir
+# @USAGE: [-b|--base-path] [-f|--final-ABI]
+# @DESCRIPTION:
+# Print path to Python site-packages directory.
+# If --base-path option is specified, then path not prefixed with "/" is printed.
+# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
+python_get_sitedir() {
+ _python_check_python_pkg_setup_execution
+
+ local base_path="0" final_ABI="0" prefix PYTHON_ABI="${PYTHON_ABI}"
+
+ while (($#)); do
+ case "$1" in
+ -b|--base-path)
+ base_path="1"
+ ;;
+ -f|--final-ABI)
+ final_ABI="1"
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ die "${FUNCNAME}(): Invalid usage"
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${base_path}" == "0" ]]; then
+ prefix="/"
+ fi
+
+ if [[ "${final_ABI}" == "1" ]]; then
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+ PYTHON_ABI="$(PYTHON -f --ABI)"
+ else
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ if ! _python_abi-specific_local_scope; then
+ die "${FUNCNAME}() should be used in ABI-specific local scope"
+ fi
+ else
+ PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
+ fi
+ fi
+
+ if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
+ echo "${prefix}usr/$(get_libdir)/python${PYTHON_ABI}/site-packages"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
+ echo "${prefix}usr/share/jython-${PYTHON_ABI%-jython}/Lib/site-packages"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
+ echo "${prefix}usr/$(get_libdir)/pypy${PYTHON_ABI#*-pypy-}/site-packages"
+ fi
+}
+
+# @FUNCTION: python_get_library
+# @USAGE: [-b|--base-path] [-f|--final-ABI] [-l|--linker-option]
+# @DESCRIPTION:
+# Print path to Python library.
+# If --base-path option is specified, then path not prefixed with "/" is printed.
+# If --linker-option is specified, then "-l${library}" linker option is printed.
+# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
+python_get_library() {
+ _python_check_python_pkg_setup_execution
+
+ local base_path="0" final_ABI="0" linker_option="0" prefix PYTHON_ABI="${PYTHON_ABI}"
+
+ while (($#)); do
+ case "$1" in
+ -b|--base-path)
+ base_path="1"
+ ;;
+ -f|--final-ABI)
+ final_ABI="1"
+ ;;
+ -l|--linker-option)
+ linker_option="1"
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ die "${FUNCNAME}(): Invalid usage"
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${base_path}" == "0" ]]; then
+ prefix="/"
+ fi
+
+ if [[ "${base_path}" == "1" && "${linker_option}" == "1" ]]; then
+ die "${FUNCNAME}(): '--base-path' and '--linker-option' options cannot be specified simultaneously"
+ fi
+
+ if [[ "${final_ABI}" == "1" ]]; then
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+ PYTHON_ABI="$(PYTHON -f --ABI)"
+ else
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ if ! _python_abi-specific_local_scope; then
+ die "${FUNCNAME}() should be used in ABI-specific local scope"
+ fi
+ else
+ PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
+ fi
+ fi
+
+ if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
+ if [[ "${linker_option}" == "1" ]]; then
+ echo "-lpython${PYTHON_ABI}"
+ else
+ echo "${prefix}usr/$(get_libdir)/libpython${PYTHON_ABI}$(get_libname)"
+ fi
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
+ die "${FUNCNAME}(): Jython does not have shared library"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
+ die "${FUNCNAME}(): PyPy does not have shared library"
+ fi
+}
+
+# @FUNCTION: python_get_version
+# @USAGE: [-f|--final-ABI] [-l|--language] [--full] [--major] [--minor] [--micro]
+# @DESCRIPTION:
+# Print version of Python implementation.
+# --full, --major, --minor and --micro options cannot be specified simultaneously.
+# If --full, --major, --minor and --micro options are not specified, then "${major_version}.${minor_version}" is printed.
+# If --language option is specified, then version of Python language is printed.
+# --language and --full options cannot be specified simultaneously.
+# --language and --micro options cannot be specified simultaneously.
+# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
+python_get_version() {
+ _python_check_python_pkg_setup_execution
+
+ local final_ABI="0" language="0" language_version full="0" major="0" minor="0" micro="0" PYTHON_ABI="${PYTHON_ABI}" python_command
+
+ while (($#)); do
+ case "$1" in
+ -f|--final-ABI)
+ final_ABI="1"
+ ;;
+ -l|--language)
+ language="1"
+ ;;
+ --full)
+ full="1"
+ ;;
+ --major)
+ major="1"
+ ;;
+ --minor)
+ minor="1"
+ ;;
+ --micro)
+ micro="1"
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ die "${FUNCNAME}(): Invalid usage"
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${final_ABI}" == "1" ]]; then
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+ else
+ if _python_package_supporting_installation_for_multiple_python_abis && ! _python_abi-specific_local_scope; then
+ die "${FUNCNAME}() should be used in ABI-specific local scope"
+ fi
+ fi
+
+ if [[ "$((${full} + ${major} + ${minor} + ${micro}))" -gt 1 ]]; then
+ die "${FUNCNAME}(): '--full', '--major', '--minor' or '--micro' options cannot be specified simultaneously"
+ fi
+
+ if [[ "${language}" == "1" ]]; then
+ if [[ "${final_ABI}" == "1" ]]; then
+ PYTHON_ABI="$(PYTHON -f --ABI)"
+ elif [[ -z "${PYTHON_ABI}" ]]; then
+ PYTHON_ABI="$(PYTHON --ABI)"
+ fi
+ language_version="${PYTHON_ABI%%-*}"
+ if [[ "${full}" == "1" ]]; then
+ die "${FUNCNAME}(): '--language' and '--full' options cannot be specified simultaneously"
+ elif [[ "${major}" == "1" ]]; then
+ echo "${language_version%.*}"
+ elif [[ "${minor}" == "1" ]]; then
+ echo "${language_version#*.}"
+ elif [[ "${micro}" == "1" ]]; then
+ die "${FUNCNAME}(): '--language' and '--micro' options cannot be specified simultaneously"
+ else
+ echo "${language_version}"
+ fi
+ else
+ if [[ "${full}" == "1" ]]; then
+ python_command="import sys; print('.'.join(str(x) for x in getattr(sys, 'pypy_version_info', sys.version_info)[:3]))"
+ elif [[ "${major}" == "1" ]]; then
+ python_command="import sys; print(getattr(sys, 'pypy_version_info', sys.version_info)[0])"
+ elif [[ "${minor}" == "1" ]]; then
+ python_command="import sys; print(getattr(sys, 'pypy_version_info', sys.version_info)[1])"
+ elif [[ "${micro}" == "1" ]]; then
+ python_command="import sys; print(getattr(sys, 'pypy_version_info', sys.version_info)[2])"
+ else
+ if [[ -n "${PYTHON_ABI}" && "${final_ABI}" == "0" ]]; then
+ if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
+ echo "${PYTHON_ABI}"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
+ echo "${PYTHON_ABI%-jython}"
+ elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
+ echo "${PYTHON_ABI#*-pypy-}"
+ fi
+ return
+ fi
+ python_command="from sys import version_info; print('.'.join(str(x) for x in version_info[:2]))"
+ fi
+
+ if [[ "${final_ABI}" == "1" ]]; then
+ "$(PYTHON -f)" -c "${python_command}"
+ else
+ "$(PYTHON ${PYTHON_ABI})" -c "${python_command}"
+ fi
+ fi
+}
+
+# @FUNCTION: python_get_implementation_and_version
+# @USAGE: [-f|--final-ABI]
+# @DESCRIPTION:
+# Print name and version of Python implementation.
+# If version of Python implementation is not bound to version of Python language, then
+# version of Python language is additionally printed.
+# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
+python_get_implementation_and_version() {
+ _python_check_python_pkg_setup_execution
+
+ local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"
+
+ while (($#)); do
+ case "$1" in
+ -f|--final-ABI)
+ final_ABI="1"
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ die "${FUNCNAME}(): Invalid usage"
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${final_ABI}" == "1" ]]; then
+ if ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+ PYTHON_ABI="$(PYTHON -f --ABI)"
+ else
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ if ! _python_abi-specific_local_scope; then
+ die "${FUNCNAME}() should be used in ABI-specific local scope"
+ fi
+ else
+ PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
+ fi
+ fi
+
+ if [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-[[:alnum:]]+-[[:digit:]]+\.[[:digit:]]+$ ]]; then
+ echo "$(_python_get_implementation "${PYTHON_ABI}") ${PYTHON_ABI##*-} (Python ${PYTHON_ABI%%-*})"
+ else
+ echo "$(_python_get_implementation "${PYTHON_ABI}") ${PYTHON_ABI%%-*}"
+ fi
+}
+
+# ================================================================================================
+# ================================ FUNCTIONS FOR RUNNING OF TESTS ================================
+# ================================================================================================
+
+# @ECLASS-VARIABLE: PYTHON_TEST_VERBOSITY
+# @DESCRIPTION:
+# User-configurable verbosity of tests of Python modules.
+# Supported values: 0, 1, 2, 3, 4.
+PYTHON_TEST_VERBOSITY="${PYTHON_TEST_VERBOSITY:-1}"
+
+_python_test_hook() {
+ if [[ "$#" -ne 1 ]]; then
+ die "${FUNCNAME}() requires 1 argument"
+ fi
+
+ if _python_package_supporting_installation_for_multiple_python_abis && [[ "$(type -t "${_PYTHON_TEST_FUNCTION}_$1_hook")" == "function" ]]; then
+ "${_PYTHON_TEST_FUNCTION}_$1_hook"
+ fi
+}
+
+# @FUNCTION: python_execute_nosetests
+# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
+# @DESCRIPTION:
+# Execute nosetests for all enabled Python ABIs.
+# In ebuilds of packages supporting installation for multiple Python ABIs, this function calls
+# python_execute_nosetests_pre_hook() and python_execute_nosetests_post_hook(), if they are defined.
+python_execute_nosetests() {
+ _python_check_python_pkg_setup_execution
+ _python_set_color_variables
+
+ local PYTHONPATH_template separate_build_dirs
+
+ while (($#)); do
+ case "$1" in
+ -P|--PYTHONPATH)
+ PYTHONPATH_template="$2"
+ shift
+ ;;
+ -s|--separate-build-dirs)
+ separate_build_dirs="1"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ python_test_function() {
+ local evaluated_PYTHONPATH
+
+ eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
+
+ _PYTHON_TEST_FUNCTION="python_execute_nosetests" _python_test_hook pre
+
+ if [[ -n "${evaluated_PYTHONPATH}" ]]; then
+ echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL}
+ PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?"
+ else
+ echo ${_BOLD}nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL}
+ nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?"
+ fi
+
+ _PYTHON_TEST_FUNCTION="python_execute_nosetests" _python_test_hook post
+ }
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
+ else
+ if [[ -n "${separate_build_dirs}" ]]; then
+ die "${FUNCNAME}(): Invalid usage"
+ fi
+ python_test_function "$@" || die "Testing failed"
+ fi
+
+ unset -f python_test_function
+}
+
+# @FUNCTION: python_execute_py.test
+# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
+# @DESCRIPTION:
+# Execute py.test for all enabled Python ABIs.
+# In ebuilds of packages supporting installation for multiple Python ABIs, this function calls
+# python_execute_py.test_pre_hook() and python_execute_py.test_post_hook(), if they are defined.
+python_execute_py.test() {
+ _python_check_python_pkg_setup_execution
+ _python_set_color_variables
+
+ local PYTHONPATH_template separate_build_dirs
+
+ while (($#)); do
+ case "$1" in
+ -P|--PYTHONPATH)
+ PYTHONPATH_template="$2"
+ shift
+ ;;
+ -s|--separate-build-dirs)
+ separate_build_dirs="1"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ python_test_function() {
+ local evaluated_PYTHONPATH
+
+ eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
+
+ _PYTHON_TEST_FUNCTION="python_execute_py.test" _python_test_hook pre
+
+ if [[ -n "${evaluated_PYTHONPATH}" ]]; then
+ echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@"${_NORMAL}
+ PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@" || return "$?"
+ else
+ echo ${_BOLD}py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@"${_NORMAL}
+ py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@" || return "$?"
+ fi
+
+ _PYTHON_TEST_FUNCTION="python_execute_py.test" _python_test_hook post
+ }
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
+ else
+ if [[ -n "${separate_build_dirs}" ]]; then
+ die "${FUNCNAME}(): Invalid usage"
+ fi
+ python_test_function "$@" || die "Testing failed"
+ fi
+
+ unset -f python_test_function
+}
+
+# @FUNCTION: python_execute_trial
+# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
+# @DESCRIPTION:
+# Execute trial for all enabled Python ABIs.
+# In ebuilds of packages supporting installation for multiple Python ABIs, this function
+# calls python_execute_trial_pre_hook() and python_execute_trial_post_hook(), if they are defined.
+python_execute_trial() {
+ _python_check_python_pkg_setup_execution
+ _python_set_color_variables
+
+ local PYTHONPATH_template separate_build_dirs
+
+ while (($#)); do
+ case "$1" in
+ -P|--PYTHONPATH)
+ PYTHONPATH_template="$2"
+ shift
+ ;;
+ -s|--separate-build-dirs)
+ separate_build_dirs="1"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ python_test_function() {
+ local evaluated_PYTHONPATH
+
+ eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
+
+ _PYTHON_TEST_FUNCTION="python_execute_trial" _python_test_hook pre
+
+ if [[ -n "${evaluated_PYTHONPATH}" ]]; then
+ echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL}
+ PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?"
+ else
+ echo ${_BOLD}trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL}
+ trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?"
+ fi
+
+ _PYTHON_TEST_FUNCTION="python_execute_trial" _python_test_hook post
+ }
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
+ else
+ if [[ -n "${separate_build_dirs}" ]]; then
+ die "${FUNCNAME}(): Invalid usage"
+ fi
+ python_test_function "$@" || die "Testing failed"
+ fi
+
+ unset -f python_test_function
+}
+
+# ================================================================================================
+# ======================= FUNCTIONS FOR HANDLING OF BYTE-COMPILED MODULES ========================
+# ================================================================================================
+
+# @FUNCTION: python_enable_pyc
+# @DESCRIPTION:
+# Tell Python to automatically recompile modules to .pyc/.pyo if the
+# timestamps/version stamps have changed.
+python_enable_pyc() {
+ _python_check_python_pkg_setup_execution
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ unset PYTHONDONTWRITEBYTECODE
+}
+
+# @FUNCTION: python_disable_pyc
+# @DESCRIPTION:
+# Tell Python not to automatically recompile modules to .pyc/.pyo
+# even if the timestamps/version stamps do not match. This is done
+# to protect sandbox.
+python_disable_pyc() {
+ _python_check_python_pkg_setup_execution
+
+ if [[ "$#" -ne 0 ]]; then
+ die "${FUNCNAME}() does not accept arguments"
+ fi
+
+ export PYTHONDONTWRITEBYTECODE="1"
+}
+
+_python_vecho() {
+ [[ -z ${PORTAGE_VERBOSE} ]] || echo "$@"
+}
+
+_python_clean_compiled_modules() {
+ _python_initialize_prefix_variables
+ _python_set_color_variables
+
+ [[ "${FUNCNAME[1]}" =~ ^(python_mod_optimize|python_mod_cleanup)$ ]] || die "${FUNCNAME}(): Invalid usage"
+
+ local base_module_name compiled_file compiled_files=() dir path py_file root
+
+ # Strip trailing slash from EROOT.
+ root="${EROOT%/}"
+
+ for path in "$@"; do
+ compiled_files=()
+ if [[ -d "${path}" ]]; then
+ while read -d $'\0' -r compiled_file; do
+ compiled_files+=("${compiled_file}")
+ done < <(find "${path}" "(" -name "*.py[co]" -o -name "*\$py.class" ")" -print0)
+
+ if [[ "${EBUILD_PHASE}" == "postrm" ]]; then
+ # Delete empty child directories.
+ find "${path}" -type d | sort -r | while read -r dir; do
+ if rmdir "${dir}" 2> /dev/null; then
+ _python_vecho "<<< ${dir}"
+ fi
+ done
+ fi
+ elif [[ "${path}" == *.py ]]; then
+ base_module_name="${path##*/}"
+ base_module_name="${base_module_name%.py}"
+ if [[ -d "${path%/*}/__pycache__" ]]; then
+ while read -d $'\0' -r compiled_file; do
+ compiled_files+=("${compiled_file}")
+ done < <(find "${path%/*}/__pycache__" "(" -name "${base_module_name}.*.py[co]" -o -name "${base_module_name}\$py.class" ")" -print0)
+ fi
+ compiled_files+=("${path}c" "${path}o" "${path%.py}\$py.class")
+ fi
+
+ for compiled_file in "${compiled_files[@]}"; do
+ [[ ! -f "${compiled_file}" ]] && continue
+ dir="${compiled_file%/*}"
+ dir="${dir##*/}"
+ if [[ "${compiled_file}" == *.py[co] ]]; then
+ if [[ "${dir}" == "__pycache__" ]]; then
+ base_module_name="${compiled_file##*/}"
+ base_module_name="${base_module_name%.*py[co]}"
+ base_module_name="${base_module_name%.*}"
+ py_file="${compiled_file%__pycache__/*}${base_module_name}.py"
+ else
+ py_file="${compiled_file%[co]}"
+ fi
+ if [[ "${EBUILD_PHASE}" == "postinst" ]]; then
+ [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue
+ else
+ [[ -f "${py_file}" ]] && continue
+ fi
+ _python_vecho "<<< ${compiled_file%[co]}[co]"
+ rm -f "${compiled_file%[co]}"[co]
+ elif [[ "${compiled_file}" == *\$py.class ]]; then
+ if [[ "${dir}" == "__pycache__" ]]; then
+ base_module_name="${compiled_file##*/}"
+ base_module_name="${base_module_name%\$py.class}"
+ py_file="${compiled_file%__pycache__/*}${base_module_name}.py"
+ else
+ py_file="${compiled_file%\$py.class}.py"
+ fi
+ if [[ "${EBUILD_PHASE}" == "postinst" ]]; then
+ [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue
+ else
+ [[ -f "${py_file}" ]] && continue
+ fi
+ _python_vecho "<<< ${compiled_file}"
+ rm -f "${compiled_file}"
+ else
+ die "${FUNCNAME}(): Unrecognized file type: '${compiled_file}'"
+ fi
+
+ # Delete empty parent directories.
+ dir="${compiled_file%/*}"
+ while [[ "${dir}" != "${root}" ]]; do
+ if rmdir "${dir}" 2> /dev/null; then
+ _python_vecho "<<< ${dir}"
+ else
+ break
+ fi
+ dir="${dir%/*}"
+ done
+ done
+ done
+}
+
+# @FUNCTION: python_mod_optimize
+# @USAGE: [--allow-evaluated-non-sitedir-paths] [-d directory] [-f] [-l] [-q] [-x regular_expression] [--] <file|directory> [files|directories]
+# @DESCRIPTION:
+# Byte-compile specified Python modules.
+# -d, -f, -l, -q and -x options passed to this function are passed to compileall.py.
+#
+# This function can be used only in pkg_postinst() phase.
+python_mod_optimize() {
+ if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
+ die "${FUNCNAME}() can be used only in pkg_postinst() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_initialize_prefix_variables
+
+ if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
+ # PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs.
+ local allow_evaluated_non_sitedir_paths="0" dir dirs=() evaluated_dirs=() evaluated_files=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=() stderr stderr_line
+
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then
+ die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called"
+ fi
+ iterated_PYTHON_ABIS="${PYTHON_ABIS}"
+ else
+ if has "${EAPI:-0}" 0 1 2 3; then
+ iterated_PYTHON_ABIS="${PYTHON_ABI:=$(PYTHON --ABI)}"
+ else
+ iterated_PYTHON_ABIS="${PYTHON_ABI}"
+ fi
+ fi
+
+ # Strip trailing slash from EROOT.
+ root="${EROOT%/}"
+
+ while (($#)); do
+ case "$1" in
+ --allow-evaluated-non-sitedir-paths)
+ allow_evaluated_non_sitedir_paths="1"
+ ;;
+ -l|-f|-q)
+ options+=("$1")
+ ;;
+ -d|-x)
+ options+=("$1" "$2")
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${allow_evaluated_non_sitedir_paths}" == "1" ]] && ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+
+ if [[ "$#" -eq 0 ]]; then
+ die "${FUNCNAME}(): Missing files or directories"
+ fi
+
+ while (($#)); do
+ if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
+ die "${FUNCNAME}(): Invalid argument '$1'"
+ elif ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then
+ die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
+ elif [[ "$1" =~ ^/ ]]; then
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
+ die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+ fi
+ if [[ "$1" != *\$* ]]; then
+ die "${FUNCNAME}(): '$1' has invalid syntax"
+ fi
+ if [[ "$1" == *.py ]]; then
+ evaluated_files+=("$1")
+ else
+ evaluated_dirs+=("$1")
+ fi
+ else
+ if [[ -d "${root}$1" ]]; then
+ other_dirs+=("${root}$1")
+ elif [[ -f "${root}$1" ]]; then
+ other_files+=("${root}$1")
+ elif [[ -e "${root}$1" ]]; then
+ eerror "${FUNCNAME}(): '${root}$1' is not a regular file or a directory"
+ else
+ eerror "${FUNCNAME}(): '${root}$1' does not exist"
+ fi
+ fi
+ else
+ for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
+ if [[ -d "${root}$(python_get_sitedir)/$1" ]]; then
+ site_packages_dirs+=("$1")
+ break
+ elif [[ -f "${root}$(python_get_sitedir)/$1" ]]; then
+ site_packages_files+=("$1")
+ break
+ elif [[ -e "${root}$(python_get_sitedir)/$1" ]]; then
+ eerror "${FUNCNAME}(): '$1' is not a regular file or a directory"
+ else
+ eerror "${FUNCNAME}(): '$1' does not exist"
+ fi
+ done
+ fi
+ shift
+ done
+
+ # Set additional options.
+ options+=("-q")
+
+ for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
+ if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})) || ((${#evaluated_dirs[@]})) || ((${#evaluated_files[@]})); then
+ return_code="0"
+ stderr=""
+ ebegin "Compilation and optimization of Python modules for $(python_get_implementation_and_version)"
+ if ((${#site_packages_dirs[@]})) || ((${#evaluated_dirs[@]})); then
+ for dir in "${site_packages_dirs[@]}"; do
+ dirs+=("${root}$(python_get_sitedir)/${dir}")
+ done
+ for dir in "${evaluated_dirs[@]}"; do
+ eval "dirs+=(\"\${root}${dir}\")"
+ done
+ stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m compileall "${options[@]}" "${dirs[@]}" 2>&1)" || return_code="1"
+ if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
+ "$(PYTHON)" -O -m compileall "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1"
+ fi
+ _python_clean_compiled_modules "${dirs[@]}"
+ fi
+ if ((${#site_packages_files[@]})) || ((${#evaluated_files[@]})); then
+ for file in "${site_packages_files[@]}"; do
+ files+=("${root}$(python_get_sitedir)/${file}")
+ done
+ for file in "${evaluated_files[@]}"; do
+ eval "files+=(\"\${root}${file}\")"
+ done
+ stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m py_compile "${files[@]}" 2>&1)" || return_code="1"
+ if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
+ "$(PYTHON)" -O -m py_compile "${files[@]}" &> /dev/null || return_code="1"
+ fi
+ _python_clean_compiled_modules "${files[@]}"
+ fi
+ eend "${return_code}"
+ if [[ -n "${stderr}" ]]; then
+ eerror "Syntax errors / warnings in Python modules for $(python_get_implementation_and_version):" &> /dev/null
+ while read stderr_line; do
+ eerror " ${stderr_line}"
+ done <<< "${stderr}"
+ fi
+ fi
+ unset dirs files
+ done
+
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ # Restore previous value of PYTHON_ABI.
+ if [[ -n "${previous_PYTHON_ABI}" ]]; then
+ PYTHON_ABI="${previous_PYTHON_ABI}"
+ else
+ unset PYTHON_ABI
+ fi
+ fi
+
+ if ((${#other_dirs[@]})) || ((${#other_files[@]})); then
+ return_code="0"
+ stderr=""
+ ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation_and_version)"
+ if ((${#other_dirs[@]})); then
+ stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m compileall "${options[@]}" "${other_dirs[@]}" 2>&1)" || return_code="1"
+ if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
+ "$(PYTHON ${PYTHON_ABI})" -O -m compileall "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1"
+ fi
+ _python_clean_compiled_modules "${other_dirs[@]}"
+ fi
+ if ((${#other_files[@]})); then
+ stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m py_compile "${other_files[@]}" 2>&1)" || return_code="1"
+ if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
+ "$(PYTHON ${PYTHON_ABI})" -O -m py_compile "${other_files[@]}" &> /dev/null || return_code="1"
+ fi
+ _python_clean_compiled_modules "${other_files[@]}"
+ fi
+ eend "${return_code}"
+ if [[ -n "${stderr}" ]]; then
+ eerror "Syntax errors / warnings in Python modules placed outside of site-packages directories for $(python_get_implementation_and_version):" &> /dev/null
+ while read stderr_line; do
+ eerror " ${stderr_line}"
+ done <<< "${stderr}"
+ fi
+ fi
+ else
+ # Deprecated part of python_mod_optimize()
+
+ local myroot mydirs=() myfiles=() myopts=() return_code="0"
+
+ # strip trailing slash
+ myroot="${EROOT%/}"
+
+ # respect EROOT and options passed to compileall.py
+ while (($#)); do
+ case "$1" in
+ -l|-f|-q)
+ myopts+=("$1")
+ ;;
+ -d|-x)
+ myopts+=("$1" "$2")
+ shift
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "$#" -eq 0 ]]; then
+ die "${FUNCNAME}(): Missing files or directories"
+ fi
+
+ while (($#)); do
+ if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
+ die "${FUNCNAME}(): Invalid argument '$1'"
+ elif [[ -d "${myroot}/${1#/}" ]]; then
+ mydirs+=("${myroot}/${1#/}")
+ elif [[ -f "${myroot}/${1#/}" ]]; then
+ myfiles+=("${myroot}/${1#/}")
+ elif [[ -e "${myroot}/${1#/}" ]]; then
+ eerror "${FUNCNAME}(): ${myroot}/${1#/} is not a regular file or directory"
+ else
+ eerror "${FUNCNAME}(): ${myroot}/${1#/} does not exist"
+ fi
+ shift
+ done
+
+ # set additional opts
+ myopts+=(-q)
+
+ PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
+
+ ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)"
+ if ((${#mydirs[@]})); then
+ "$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" || return_code="1"
+ "$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" &> /dev/null || return_code="1"
+ _python_clean_compiled_modules "${mydirs[@]}"
+ fi
+
+ if ((${#myfiles[@]})); then
+ "$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" || return_code="1"
+ "$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" &> /dev/null || return_code="1"
+ _python_clean_compiled_modules "${myfiles[@]}"
+ fi
+
+ eend "${return_code}"
+ fi
+}
+
+# @FUNCTION: python_mod_cleanup
+# @USAGE: [--allow-evaluated-non-sitedir-paths] [--] <file|directory> [files|directories]
+# @DESCRIPTION:
+# Delete orphaned byte-compiled Python modules corresponding to specified Python modules.
+#
+# This function can be used only in pkg_postrm() phase.
+python_mod_cleanup() {
+ if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
+ die "${FUNCNAME}() can be used only in pkg_postrm() phase"
+ fi
+
+ _python_check_python_pkg_setup_execution
+ _python_initialize_prefix_variables
+
+ local allow_evaluated_non_sitedir_paths="0" dir iterated_PYTHON_ABIS PYTHON_ABI="${PYTHON_ABI}" root search_paths=() sitedir
+
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then
+ die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called"
+ fi
+ iterated_PYTHON_ABIS="${PYTHON_ABIS}"
+ else
+ if has "${EAPI:-0}" 0 1 2 3; then
+ iterated_PYTHON_ABIS="${PYTHON_ABI:-$(PYTHON --ABI)}"
+ else
+ iterated_PYTHON_ABIS="${PYTHON_ABI}"
+ fi
+ fi
+
+ # Strip trailing slash from EROOT.
+ root="${EROOT%/}"
+
+ while (($#)); do
+ case "$1" in
+ --allow-evaluated-non-sitedir-paths)
+ allow_evaluated_non_sitedir_paths="1"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ -*)
+ die "${FUNCNAME}(): Unrecognized option '$1'"
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+ done
+
+ if [[ "${allow_evaluated_non_sitedir_paths}" == "1" ]] && ! _python_package_supporting_installation_for_multiple_python_abis; then
+ die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
+ fi
+
+ if [[ "$#" -eq 0 ]]; then
+ die "${FUNCNAME}(): Missing files or directories"
+ fi
+
+ if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
+ while (($#)); do
+ if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
+ die "${FUNCNAME}(): Invalid argument '$1'"
+ elif ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then
+ die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
+ elif [[ "$1" =~ ^/ ]]; then
+ if _python_package_supporting_installation_for_multiple_python_abis; then
+ if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
+ die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
+ fi
+ if [[ "$1" != *\$* ]]; then
+ die "${FUNCNAME}(): '$1' has invalid syntax"
+ fi
+ for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
+ eval "search_paths+=(\"\${root}$1\")"
+ done
+ else
+ search_paths+=("${root}$1")
+ fi
+ else
+ for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
+ search_paths+=("${root}$(python_get_sitedir)/$1")
+ done
+ fi
+ shift
+ done
+ else
+ # Deprecated part of python_mod_cleanup()
+
+ search_paths=("${@#/}")
+ search_paths=("${search_paths[@]/#/${root}/}")
+ fi
+
+ _python_clean_compiled_modules "${search_paths[@]}"
+}
+
+# ================================================================================================
+# ===================================== DEPRECATED FUNCTIONS =====================================
+# ================================================================================================
+
+fi # _PYTHON_ECLASS_INHERITED
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-08-13 14:50 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-08-13 14:50 UTC (permalink / raw
To: gentoo-commits
commit: c79645f0d1db37885a1ad59696996504dffbdda1
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 13 12:04:26 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Aug 13 12:04:26 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=c79645f0
qt4-build-multilib.eclass: Update Qt4 SRC_URI, moved to upstream archives
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/qt4-build-multilib.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/qt4-build-multilib.eclass b/eclass/qt4-build-multilib.eclass
index 7666936b..83fb54a9 100644
--- a/eclass/qt4-build-multilib.eclass
+++ b/eclass/qt4-build-multilib.eclass
@@ -32,7 +32,7 @@ case ${PV} in
# official stable release
QT4_BUILD_TYPE="release"
MY_P=qt-everywhere-opensource-src-${PV/_/-}
- SRC_URI="http://download.qt.io/official_releases/qt/${PV%.*}/${PV}/${MY_P}.tar.gz"
+ SRC_URI="http://download.qt.io/archive/qt/${PV%.*}/${PV}/${MY_P}.tar.gz"
S=${WORKDIR}/${MY_P}
;;
esac
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-08-13 14:50 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-08-13 14:50 UTC (permalink / raw
To: gentoo-commits
commit: 49be5a235d747e4655ea591025048153f9328b5f
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 13 12:29:24 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Aug 13 14:47:42 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=49be5a23
qt4-build-multilib.eclass: Drop dev-qt/qtchooser dependency
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/qt4-build-multilib.eclass | 3 ---
1 file changed, 3 deletions(-)
diff --git a/eclass/qt4-build-multilib.eclass b/eclass/qt4-build-multilib.eclass
index 83fb54a9..b044a7d6 100644
--- a/eclass/qt4-build-multilib.eclass
+++ b/eclass/qt4-build-multilib.eclass
@@ -53,9 +53,6 @@ DEPEND="
dev-lang/perl
virtual/pkgconfig[${MULTILIB_USEDEP}]
"
-RDEPEND="
- dev-qt/qtchooser
-"
# src_{configure,compile,test,install} are inherited from multilib-minimal
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-08-13 14:50 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-08-13 14:50 UTC (permalink / raw
To: gentoo-commits
commit: 3962316389a3fad321922fa8238fbf51cee7bddb
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 13 12:34:06 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Aug 13 14:47:42 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=39623163
qt4-build-multilib.eclass: Drop all traces of IUSE=aqua
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/qt4-build-multilib.eclass | 91 +++-------------------------------------
1 file changed, 5 insertions(+), 86 deletions(-)
diff --git a/eclass/qt4-build-multilib.eclass b/eclass/qt4-build-multilib.eclass
index b044a7d6..3cf33cf9 100644
--- a/eclass/qt4-build-multilib.eclass
+++ b/eclass/qt4-build-multilib.eclass
@@ -45,7 +45,7 @@ EGIT_REPO_URI=(
[[ ${QT4_BUILD_TYPE} == live ]] && inherit git-r3
if [[ ${PN} != qttranslations ]]; then
- IUSE="aqua debug pch"
+ IUSE="debug pch"
[[ ${PN} != qtxmlpatterns ]] && IUSE+=" +exceptions"
fi
@@ -231,20 +231,6 @@ qt4-build-multilib_src_prepare() {
mkspecs/$(qt4_get_mkspec)/qmake.conf \
|| die "sed QMAKE_(LIB|INC)DIR failed"
- if use_if_iuse aqua; then
- sed -i \
- -e '/^CONFIG/s:app_bundle::' \
- -e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \
- mkspecs/$(qt4_get_mkspec)/qmake.conf \
- || die "sed failed (aqua)"
-
- # we are crazy and build cocoa + qt3support
- if { ! in_iuse qt3support || use qt3support; } && [[ ${CHOST##*-darwin} -ge 9 ]]; then
- sed -i -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \
- configure || die "sed failed (cocoa + qt3support)"
- fi
- fi
-
if [[ ${CHOST} == *-darwin* ]]; then
# Set FLAGS and remove -arch, since our gcc-apple is multilib crippled (by design)
sed -i \
@@ -400,19 +386,6 @@ qt4_multilib_src_configure() {
$([[ ${CHOST} != *-solaris* ]] && echo -reduce-relocations)
)
- if use_if_iuse aqua; then
- if [[ ${CHOST##*-darwin} -ge 9 ]]; then
- conf+=(
- # on (snow) leopard use the new (frameworked) cocoa code
- -cocoa -framework
- # add hint for the framework location
- -F"${QT4_LIBDIR}"
- )
- else
- conf+=(-no-framework)
- fi
- fi
-
conf+=(
# module-specific options
"${myconf[@]}"
@@ -483,23 +456,14 @@ qt4_multilib_src_install() {
fi
qt4_install_module_qconfigs
- qt4_symlink_framework_headers
}
qt4_multilib_src_install_all() {
if [[ ${PN} == qtcore ]]; then
# include gentoo-qconfig.h at the beginning of Qt{,Core}/qconfig.h
- if use aqua && [[ ${CHOST#*-darwin} -ge 9 ]]; then
- sed -i -e '1i #include <QtCore/Gentoo/gentoo-qconfig.h>\n' \
- "${D}${QT4_LIBDIR}"/QtCore.framework/Headers/qconfig.h \
- || die "sed failed (qconfig.h)"
- dosym "${QT4_HEADERDIR#${EPREFIX}}"/Gentoo \
- "${QT4_LIBDIR#${EPREFIX}}"/QtCore.framework/Headers/Gentoo
- else
- sed -i -e '1i #include <Gentoo/gentoo-qconfig.h>\n' \
- "${D}${QT4_HEADERDIR}"/Qt{,Core}/qconfig.h \
- || die "sed failed (qconfig.h)"
- fi
+ sed -i -e '1i #include <Gentoo/gentoo-qconfig.h>\n' \
+ "${D}${QT4_HEADERDIR}"/Qt{,Core}/qconfig.h \
+ || die "sed failed (qconfig.h)"
dodir "${QT4_DATADIR#${EPREFIX}}"/mkspecs/gentoo
mv "${D}${QT4_DATADIR}"/mkspecs/{qconfig.pri,gentoo/} || die
@@ -736,49 +700,6 @@ qt4_regenerate_global_qconfigs() {
fi
}
-# @FUNCTION: qt4_symlink_framework_headers
-# @DESCRIPTION:
-# On OS X we need to add some symlinks when frameworks are being
-# used, to avoid complications with some more or less stupid packages.
-qt4_symlink_framework_headers() {
- if use_if_iuse aqua && [[ ${CHOST##*-darwin} -ge 9 ]]; then
- local frw dest f h rdir
- # Some packages tend to include <Qt/...>
- dodir "${QT4_HEADERDIR#${EPREFIX}}"/Qt
-
- # Fake normal headers when frameworks are installed... eases life later
- # on, make sure we use relative links though, as some ebuilds assume
- # these dirs exist in src_install to add additional files
- f=${QT4_HEADERDIR}
- h=${QT4_LIBDIR}
- while [[ -n ${f} && ${f%%/*} == ${h%%/*} ]] ; do
- f=${f#*/}
- h=${h#*/}
- done
- rdir=${h}
- f="../"
- while [[ ${h} == */* ]] ; do
- f="${f}../"
- h=${h#*/}
- done
- rdir="${f}${rdir}"
-
- for frw in "${D}${QT4_LIBDIR}"/*.framework; do
- [[ -e "${frw}"/Headers ]] || continue
- f=$(basename ${frw})
- dest="${QT4_HEADERDIR#${EPREFIX}}"/${f%.framework}
- dosym "${rdir}"/${f}/Headers "${dest}"
-
- # Link normal headers as well.
- for hdr in "${D}${QT4_LIBDIR}/${f}"/Headers/*; do
- h=$(basename ${hdr})
- dosym "../${rdir}"/${f}/Headers/${h} \
- "${QT4_HEADERDIR#${EPREFIX}}"/Qt/${h}
- done
- done
- fi
-}
-
# @FUNCTION: qt4_get_mkspec
# @INTERNAL
# @DESCRIPTION:
@@ -790,9 +711,7 @@ qt4_get_mkspec() {
*-linux*)
spec=linux ;;
*-darwin*)
- use_if_iuse aqua &&
- spec=macx || # mac with carbon/cocoa
- spec=darwin ;; # darwin/mac with X11
+ spec=darwin ;; # darwin/mac with X11
*-freebsd*|*-dragonfly*)
spec=freebsd ;;
*-netbsd*)
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-08-13 14:50 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-08-13 14:50 UTC (permalink / raw
To: gentoo-commits
commit: f789c5dc0e4b5a248710360f6a18e965cc7bd364
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 13 13:22:18 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Aug 13 14:47:42 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=f789c5dc
qt4-build-multilib.eclass: Drop virtual/pkgconfig multilib usedep
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/qt4-build-multilib.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/qt4-build-multilib.eclass b/eclass/qt4-build-multilib.eclass
index 3cf33cf9..e426f8d4 100644
--- a/eclass/qt4-build-multilib.eclass
+++ b/eclass/qt4-build-multilib.eclass
@@ -51,7 +51,7 @@ fi
DEPEND="
dev-lang/perl
- virtual/pkgconfig[${MULTILIB_USEDEP}]
+ virtual/pkgconfig
"
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-08-16 20:05 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-08-16 20:05 UTC (permalink / raw
To: gentoo-commits
commit: 35222236f21f5579e9493e240036d73fea26ed7d
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 16 18:50:35 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Aug 16 18:50:35 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=35222236
cmake-utils.eclass: Inherit ninja-utils only in >=EAPI-7
It's kind of a hack, but there's no use for this in kde-sunset overlay anyway.
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/cmake-utils.eclass | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index 30c6016b..989b1c5c 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -112,7 +112,7 @@ case ${EAPI} in
*) die "EAPI=${EAPI:-0} is not supported" ;;
esac
-inherit toolchain-funcs ninja-utils flag-o-matic multiprocessing xdg-utils
+inherit toolchain-funcs flag-o-matic multiprocessing xdg-utils
case ${EAPI} in
[3456])
@@ -121,6 +121,7 @@ case ${EAPI} in
;;
*)
: ${CMAKE_MAKEFILE_GENERATOR:=ninja}
+ inherit ninja-utils
;;
esac
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-08-23 19:46 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-08-23 19:46 UTC (permalink / raw
To: gentoo-commits
commit: c5f5858e6ed8800f1b44d3a24296a66b3e79527e
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 23 16:25:39 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Aug 23 19:05:30 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=c5f5858e
kde.eclass, kde-functions.eclass: Properly fix KDEBASE to address the eloquent remark in 7ba60b69
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/kde-functions.eclass | 17 ++++++++++-------
eclass/kde.eclass | 4 ++--
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/eclass/kde-functions.eclass b/eclass/kde-functions.eclass
index b9137fa2..9c9506db 100644
--- a/eclass/kde-functions.eclass
+++ b/eclass/kde-functions.eclass
@@ -387,7 +387,7 @@ need-kde() {
else
x_DEPEND="${DEPEND}"
fi
- if [[ -n "${KDEBASE}" ]]; then
+ if [[ "${KDEBASE}" == "true" ]]; then
# If we're a kde-base package, we need at least our own version of kdelibs.
# Note: we only set RDEPEND if it is already set, otherwise
# we break packages relying on portage copying RDEPEND from DEPEND.
@@ -404,7 +404,7 @@ need-kde() {
qtver-from-kdever ${KDEVER}
need-qt ${selected_version}
- if [[ -n "${KDEBASE}" ]]; then
+ if [[ "${KDEBASE}" == "true" ]]; then
SLOT="$KDEMAJORVER.$KDEMINORVER"
else
: ${SLOT="0"}
@@ -457,7 +457,7 @@ set-kdedir() {
if [[ -n "$KDEPREFIX" ]]; then
export PREFIX="$KDEPREFIX"
else
- if [[ -z "$KDEBASE" ]]; then
+ if [[ -z ${KDEBASE} || ${KDEBASE} != "true" ]]; then
PREFIX="/usr/kde/3.5"
else
case $KDEMAJORVER.$KDEMINORVER in
@@ -472,7 +472,7 @@ set-kdedir() {
if [[ -n "$KDELIBSDIR" ]]; then
export KDEDIR="$KDELIBSDIR"
else
- if [[ -z "$KDEBASE" ]]; then
+ if [[ -z ${KDEBASE} || ${KDEBASE} != "true" ]]; then
# find the latest kdelibs installed
for x in /usr/kde/{svn,3.5} "${PREFIX}" \
"${KDE3LIBSDIR}" "${KDELIBSDIR}" "${KDE3DIR}" "${KDEDIR}" /usr/kde/*; do
@@ -662,9 +662,12 @@ postprocess_desktop_entries() {
validate_desktop_entries "${PREFIX}"/share/applications
}
-# is this a kde-base ebuid? CYKER - KLUDGE KLUDGE KLUDGE FUCK YOU kde-apps
+# is this ebuild part of the KDE SC? kde-base/ or kde-apps/ are only hints
if [[ "${CATEGORY}" == "kde-base" || "${CATEGORY}" == "kde-apps" ]]; then
debug-print "${ECLASS}: KDEBASE ebuild recognized"
- export KDEBASE="true"
- export KDEREVISION
+ KDEBASE=${KDEBASE:=true}
+ if [[ ${KDEBASE} == "true" ]]; then
+ export KDEBASE
+ export KDEREVISION
+ fi
fi
diff --git a/eclass/kde.eclass b/eclass/kde.eclass
index c0c636c4..8bf71e2a 100644
--- a/eclass/kde.eclass
+++ b/eclass/kde.eclass
@@ -173,7 +173,7 @@ kde_src_prepare() {
for f in "${PATCHDIR}"/${p}-${PV}-*{diff,patch}; do
[[ -e ${f} ]] && PATCHES+=("${f}")
done
- if [[ -n "${KDEBASE}" ]]; then
+ if [[ "${KDEBASE}" == "true" ]]; then
for f in "${PATCHDIR}"/${p}-${SLOT}-*{diff,patch}; do
[[ -e ${f} ]] && PATCHES+=("${f}")
done
@@ -563,7 +563,7 @@ kde_src_install() {
shift
done
- if [[ -n ${KDEBASE} && "${PN}" != "arts" && -d "${D}"/usr/share/doc/${PF} ]]; then
+ if [[ ${KDEBASE} == "true" && "${PN}" != "arts" && -d "${D}"/usr/share/doc/${PF} ]]; then
# work around bug #97196
dodir /usr/share/doc/kde && \
mv "${D}"/usr/share/doc/${PF} "${D}"/usr/share/doc/kde/ || \
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-08-25 14:51 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-08-25 14:51 UTC (permalink / raw
To: gentoo-commits
commit: f21fdf41091eb03a10dce8e7491b6f7a78196a49
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 24 17:56:39 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Aug 25 14:44:47 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=f21fdf41
kde4-base.eclass: Fix MissingTestRestrict if CPPUNIT_REQUIRED=optional
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/kde4-base.eclass | 1 +
1 file changed, 1 insertion(+)
diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass
index d8e922ec..92e8164e 100644
--- a/eclass/kde4-base.eclass
+++ b/eclass/kde4-base.eclass
@@ -339,6 +339,7 @@ case ${CPPUNIT_REQUIRED} in
optional)
IUSE+=" test"
DEPEND+=" test? ( ${cppuintdepend} )"
+ RESTRICT+=" !test? ( test )"
;;
*) ;;
esac
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-08-25 14:59 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-08-25 14:59 UTC (permalink / raw
To: gentoo-commits
commit: 856b4c1716e9aa8977b7fa0e5a0037fb83a2cac1
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 24 19:38:15 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Aug 25 14:52:58 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=856b4c17
kde4-base.eclass: Re-add 4.13.3 SRC_URI for kde-plasma/kactivitymanagerd
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/kde4-base.eclass | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass
index 92e8164e..b13eb71a 100644
--- a/eclass/kde4-base.eclass
+++ b/eclass/kde4-base.eclass
@@ -495,9 +495,12 @@ _calculate_src_uri() {
4.11.22)
# Part of 15.08.0 actually, sigh. Not stable for next release!
SRC_URI="mirror://kde/Attic/applications/15.08.0/src/${_kmname_pv}.tar.xz" ;;
+ 4.13.3)
+ # kde-plasma/kactivitymanagerd
+ SRC_URI="mirror://kde/Attic/${PV}/src/${_kmname_pv}.tar.xz" ;;
4.14.3)
# Last SC release
- SRC_URI="mirror://kde/stable/${PV}/src/${_kmname_pv}.tar.xz" ;;
+ SRC_URI="mirror://kde/Attic/${PV}/src/${_kmname_pv}.tar.xz" ;;
4.14.10)
# Part of 15.04.3 actually, sigh. Used by last version of KDE PIM 4.
SRC_URI="mirror://kde/Attic/applications/15.04.3/src/${_kmname_pv}.tar.xz" ;;
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-09-20 12:06 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-09-20 12:06 UTC (permalink / raw
To: gentoo-commits
commit: 61ba5fa8fd86062875c384b1100c897bd69a8925
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 20 11:15:31 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Sep 20 11:15:31 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=61ba5fa8
kde4-base.eclass, kde4-meta.eclass: Drop use of use_if_iuse
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/kde4-base.eclass | 2 +-
eclass/kde4-meta.eclass | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass
index b13eb71a..32da6eeb 100644
--- a/eclass/kde4-base.eclass
+++ b/eclass/kde4-base.eclass
@@ -779,7 +779,7 @@ kde4-base_src_configure() {
# Build tests in src_test only, where we override this value
local cmakeargs=(-DKDE4_BUILD_TESTS=OFF)
- if use_if_iuse debug; then
+ if in_iuse debug && use debug; then
# Set "real" debug mode
CMAKE_KDE_BUILD_TYPE="Debugfull"
else
diff --git a/eclass/kde4-meta.eclass b/eclass/kde4-meta.eclass
index 7b67a63c..e6543231 100644
--- a/eclass/kde4-meta.eclass
+++ b/eclass/kde4-meta.eclass
@@ -253,7 +253,7 @@ kde4-meta_create_extractlists() {
# Add default handbook locations
# FIXME - legacy code - remove when 4.4.5 is gone or preferrably port 4.4.5.
- if [[ $(get_kde_version) < 4.5 ]] && use_if_iuse handbook && [[ -z ${KMNOMODULE} ]]; then
+ if [[ $(get_kde_version) < 4.5 ]] && in_iuse handbook && use handbook && [[ -z ${KMNOMODULE} ]]; then
# We use the basename of $KMMODULE because $KMMODULE can contain
# the path to the module subdirectory.
KMEXTRA_NONFATAL+="
@@ -302,7 +302,7 @@ kde4-meta_create_extractlists() {
CTestCustom.cmake
kdepim-version.h.cmake
kdepim-version.h"
- if use_if_iuse kontact; then
+ if in_iuse kontact && use kontact; then
KMEXTRA+="
kontact/plugins/${PLUGINNAME:-${PN}}/"
fi
@@ -528,7 +528,7 @@ kde4-meta_change_cmakelists() {
-e 's/if[[:space:]]*([[:space:]]*[[:alnum:]]*_FOUND[[:space:]]*)[[:space:]]*$/if(1) # &/' \
-i CMakeLists.txt || die "failed to disable hardcoded checks"
# Disable broken or redundant build logic
- if use_if_iuse kontact || [[ ${PN} = kontact ]]; then
+ if in_iuse kontact && use kontact || [[ ${PN} = kontact ]]; then
sed -e 's/if[[:space:]]*([[:space:]]*BUILD_.*)[[:space:]]*$/if(1) # &/' \
-e 's/if[[:space:]]*([[:space:]]*[[:alnum:]]*_FOUND[[:space:]]*)[[:space:]]*$/if(1) # &/' \
-i kontact/plugins/CMakeLists.txt || die 'failed to override build logic'
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-11-30 2:19 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-11-30 2:19 UTC (permalink / raw
To: gentoo-commits
commit: bafbcc93354e2648f1853fdb0659025fdcafe000
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 30 02:15:15 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Nov 30 02:19:18 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=bafbcc93
qt3.eclass: Remove unused eclass
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/qt3.eclass | 141 ------------------------------------------------------
1 file changed, 141 deletions(-)
diff --git a/eclass/qt3.eclass b/eclass/qt3.eclass
deleted file mode 100644
index cd59f8e3..00000000
--- a/eclass/qt3.eclass
+++ /dev/null
@@ -1,141 +0,0 @@
-# Copyright 2005-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/qt3.eclass,v 1.41 2009/05/17 15:17:03 hwoarang Exp $
-
-# @ECLASS: qt3.eclass
-# @MAINTAINER:
-# kde-sunset overlay maintainers
-# @BLURB: Eclass for Qt3 packages
-# @DESCRIPTION:
-# This eclass contains various functions that may be useful
-# when dealing with packages using Qt3 libraries.
-
-inherit toolchain-funcs versionator eutils
-
-QTPKG="dev-qt/qt-"
-QT3MAJORVERSIONS="3.3 3.2 3.1 3.0"
-QT3VERSIONS="3.3.8b-r1 3.3.8b 3.3.8-r4 3.3.8-r3 3.3.8-r2 3.3.8-r1 3.3.8 3.3.6-r5 3.3.6-r4 3.3.6-r3 3.3.6-r2 3.3.6-r1 3.3.6 3.3.5-r1 3.3.5 3.3.4-r9 3.3.4-r8 3.3.4-r7 3.3.4-r6 3.3.4-r5 3.3.4-r4 3.3.4-r3 3.3.4-r2 3.3.4-r1 3.3.4 3.3.3-r3 3.3.3-r2 3.3.3-r1 3.3.3 3.3.2 3.3.1-r2 3.3.1-r1 3.3.1 3.3.0-r1 3.3.0 3.2.3-r1 3.2.3 3.2.2-r1 3.2.2 3.2.1-r2 3.2.1-r1 3.2.1 3.2.0 3.1.2-r4 3.1.2-r3 3.1.2-r2 3.1.2-r1 3.1.2 3.1.1-r2 3.1.1-r1 3.1.1 3.1.0-r3 3.1.0-r2 3.1.0-r1 3.1.0"
-
-if [[ -z "${QTDIR}" ]]; then
- export QTDIR="/usr/qt/3"
-fi
-
-addwrite "${QTDIR}/etc/settings"
-addpredict "${QTDIR}/etc/settings"
-
-# @FUNCTION: qt_min_version
-# @USAGE: [minimum version]
-# @DESCRIPTION:
-# This function is deprecated. Use slot dependencies instead.
-qt_min_version() {
- local list=$(qt_min_version_list "$@")
- ewarn "${CATEGORY}/${PF}: qt_min_version() is deprecated. Use slot dependencies instead."
- if [[ ${list%% *} == "${list}" ]]; then
- echo "${list}"
- else
- echo "|| ( ${list} )"
- fi
-}
-
-qt_min_version_list() {
- local MINVER="$1"
- local VERSIONS=""
-
- case "${MINVER}" in
- 3|3.0|3.0.0) VERSIONS="=${QTPKG}3*";;
- 3.1|3.1.0|3.2|3.2.0|3.3|3.3.0)
- for x in ${QT3MAJORVERSIONS}; do
- if $(version_is_at_least "${MINVER}" "${x}"); then
- VERSIONS="${VERSIONS} =${QTPKG}${x}*"
- fi
- done
- ;;
- 3*)
- for x in ${QT3VERSIONS}; do
- if $(version_is_at_least "${MINVER}" "${x}"); then
- VERSIONS="${VERSIONS} =${QTPKG}${x}"
- fi
- done
- ;;
- *) VERSIONS="=${QTPKG}3*";;
- esac
-
- echo ${VERSIONS}
-}
-
-# @FUNCTION: eqmake3
-# @USAGE: [.pro file] [additional parameters to qmake]
-# @MAINTAINER:
-# Przemyslaw Maciag <troll@gentoo.org>
-# Davide Pesavento <davidepesa@gmail.com>
-# @DESCRIPTION:
-# Runs qmake on the specified .pro file (defaults to
-# ${PN}.pro if eqmake3 was called with no argument).
-# Additional parameters are passed unmodified to qmake.
-eqmake3() {
- local LOGFILE="${T}/qmake-$$.out"
- local projprofile="${1}"
- [[ -z ${projprofile} ]] && projprofile="${PN}.pro"
- shift 1
-
- ebegin "Processing qmake ${projprofile}"
-
- # file exists?
- if [[ ! -f ${projprofile} ]]; then
- echo
- eerror "Project .pro file \"${projprofile}\" does not exist"
- eerror "qmake cannot handle non-existing .pro files"
- echo
- eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
- echo
- die "Project file not found in ${PN} sources"
- fi
-
- echo >> ${LOGFILE}
- echo "****** qmake ${projprofile} ******" >> ${LOGFILE}
- echo >> ${LOGFILE}
-
- # some standard config options
- local configoptplus="CONFIG += no_fixpath"
- local configoptminus="CONFIG -="
- if has debug ${IUSE} && use debug; then
- configoptplus="${configoptplus} debug"
- configoptminus="${configoptminus} release"
- else
- configoptplus="${configoptplus} release"
- configoptminus="${configoptminus} debug"
- fi
-
- ${QTDIR}/bin/qmake ${projprofile} \
- QTDIR=${QTDIR} \
- QMAKE=${QTDIR}/bin/qmake \
- QMAKE_CC=$(tc-getCC) \
- QMAKE_CXX=$(tc-getCXX) \
- QMAKE_LINK=$(tc-getCXX) \
- QMAKE_CFLAGS_RELEASE="${CFLAGS}" \
- QMAKE_CFLAGS_DEBUG="${CFLAGS}" \
- QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \
- QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \
- QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \
- QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \
- "${configoptminus}" \
- "${configoptplus}" \
- QMAKE_RPATH= \
- QMAKE_STRIP= \
- ${@} >> ${LOGFILE} 2>&1
-
- local result=$?
- eend ${result}
-
- # was qmake successful?
- if [[ ${result} -ne 0 ]]; then
- echo
- eerror "Running qmake on \"${projprofile}\" has failed"
- echo
- eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org"
- echo
- die "qmake failed on ${projprofile}"
- fi
-
- return ${result}
-}
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-11-30 2:19 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-11-30 2:19 UTC (permalink / raw
To: gentoo-commits
commit: 6f225f0386aded38ad9217f03f234d7d5738480c
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 30 02:14:42 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Nov 30 02:19:18 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=6f225f03
kde*eclass: Cleanup KDE3 era
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/kde-functions.eclass | 672 --------------------------------------------
eclass/kde-meta.eclass | 463 ------------------------------
eclass/kde.eclass | 614 ----------------------------------------
3 files changed, 1749 deletions(-)
diff --git a/eclass/kde-functions.eclass b/eclass/kde-functions.eclass
deleted file mode 100644
index 32ada14b..00000000
--- a/eclass/kde-functions.eclass
+++ /dev/null
@@ -1,672 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: kde-functions.eclass
-# @MAINTAINER:
-# kde@gentoo.org
-# Original author Dan Armak <danarmak@gentoo.org>
-#
-# @BLURB: This contains everything except things that modify ebuild variables and
-# @DESCRIPTION:
-# This contains everything except things that modify ebuild variables
-# and functions (e.g. $P, src_compile() etc.)
-
-inherit qt3 eutils
-
-# map of the monolithic->split ebuild derivation; used to build deps describing
-# the relationships between them
-KDE_DERIVATION_MAP='
-kde-apps/kdeaccessibility kde-base/kbstateapplet
-kde-apps/kdeaccessibility kde-base/kdeaccessibility-iconthemes
-kde-apps/kdeaccessibility kde-apps/kmag
-kde-apps/kdeaccessibility kde-apps/kmousetool
-kde-apps/kdeaccessibility kde-apps/kmouth
-kde-apps/kdeaccessibility kde-base/kttsd
-kde-apps/kdeaccessibility kde-base/ksayit
-kde-base/kdeaddons kde-base/atlantikdesigner
-kde-base/kdeaddons kde-base/kaddressbook-plugins
-kde-base/kdeaddons kde-base/kate-plugins
-kde-base/kdeaddons kde-base/kdeaddons-docs-konq-plugins
-kde-base/kdeaddons kde-base/kdeaddons-kfile-plugins
-kde-base/kdeaddons kde-base/kicker-applets
-kde-base/kdeaddons kde-base/knewsticker-scripts
-kde-base/kdeaddons kde-apps/konq-plugins
-kde-base/kdeaddons kde-base/konqueror-akregator
-kde-base/kdeaddons kde-base/ksig
-kde-base/kdeaddons kde-base/noatun-plugins
-kde-base/kdeaddons kde-base/renamedlg-audio
-kde-base/kdeaddons kde-base/renamedlg-images
-kde-base/kdeadmin kde-apps/kcron
-kde-base/kdeadmin kde-base/kdat
-kde-base/kdeadmin kde-base/kdeadmin-kfile-plugins
-kde-base/kdeadmin kde-base/knetworkconf
-kde-base/kdeadmin kde-base/kpackage
-kde-base/kdeadmin kde-base/ksysv
-kde-base/kdeadmin kde-apps/kuser
-kde-base/kdeadmin kde-base/lilo-config
-kde-base/kdeadmin kde-base/secpolicy
-kde-base/kdeartwork kde-apps/kdeartwork-emoticons
-kde-base/kdeartwork kde-base/kdeartwork-icewm-themes
-kde-base/kdeartwork kde-apps/kdeartwork-iconthemes
-kde-base/kdeartwork kde-apps/kdeartwork-kscreensaver
-kde-base/kdeartwork kde-base/kdeartwork-kwin-styles
-kde-base/kdeartwork kde-base/kdeartwork-kworldclock
-kde-base/kdeartwork kde-base/kdeartwork-kworldwatch
-kde-base/kdeartwork kde-base/kdeartwork-sounds
-kde-base/kdeartwork kde-apps/kdeartwork-styles
-kde-base/kdeartwork kde-apps/kdeartwork-wallpapers
-kde-base/kdebase kde-plasma/drkonqi
-kde-base/kdebase kde-base/kappfinder
-kde-base/kdebase kde-apps/kate
-kde-base/kdebase kde-base/kcheckpass
-kde-base/kdebase kde-base/kcminit
-kde-base/kdebase kde-apps/kcontrol
-kde-base/kdebase kde-base/kdcop
-kde-base/kdebase kde-apps/kdebase-data
-kde-base/kdebase kde-apps/kdebase-kioslaves
-kde-base/kdebase kde-base/kdebase-startkde
-kde-base/kdebase kde-base/kdebugdialog
-kde-base/kdebase kde-apps/kdepasswd
-kde-base/kdebase kde-base/kdeprint
-kde-base/kdebase kde-base/kdesktop
-kde-base/kdebase kde-apps/kdesu
-kde-base/kdebase kde-apps/kdialog
-kde-base/kdebase kde-base/kdm
-kde-base/kdebase kde-apps/kfind
-kde-base/kdebase kde-apps/khelpcenter
-kde-base/kdebase kde-base/khotkeys
-kde-base/kdebase kde-base/kicker
-kde-base/kdebase kde-base/klipper
-kde-base/kdebase kde-base/kmenuedit
-kde-base/kdebase kde-apps/knetattach
-kde-base/kdebase kde-apps/konqueror
-kde-base/kdebase kde-apps/konsole
-kde-base/kdebase kde-base/kpager
-kde-base/kdebase kde-base/kpersonalizer
-kde-base/kdebase kde-apps/kreadconfig
-kde-base/kdebase kde-plasma/kscreensaver
-kde-base/kdebase kde-base/ksmserver
-kde-base/kdebase kde-base/ksplashml
-kde-base/kdebase kde-apps/kstart
-kde-base/kdebase kde-base/ksysguard
-kde-base/kdebase kde-base/ksystraycmd
-kde-base/kdebase kde-base/ktip
-kde-base/kdebase kde-base/kwin
-kde-base/kdebase kde-base/kxkb
-kde-base/kdebase kde-apps/libkonq
-kde-base/kdebase kde-apps/nsplugins
-kde-base/kdebindings kde-base/dcopc
-kde-base/kdebindings kde-base/dcopjava
-kde-base/kdebindings kde-base/dcopperl
-kde-base/kdebindings kde-base/dcoppython
-kde-base/kdebindings kde-base/kalyptus
-kde-base/kdebindings kde-base/kdejava
-kde-base/kdebindings kde-base/kjsembed
-kde-base/kdebindings kde-base/korundum
-kde-base/kdebindings kde-base/pykde
-kde-base/kdebindings kde-base/qtjava
-kde-base/kdebindings kde-base/qtruby
-kde-base/kdebindings kde-base/qtsharp
-kde-base/kdebindings kde-base/smoke
-kde-base/kdebindings kde-base/xparts
-kde-base/kdeedu kde-apps/blinken
-kde-base/kdeedu kde-apps/kalzium
-kde-base/kdeedu kde-apps/kanagram
-kde-base/kdeedu kde-apps/kbruch
-kde-base/kdeedu kde-base/kdeedu-applnk
-kde-base/kdeedu kde-base/keduca
-kde-base/kdeedu kde-apps/kgeography
-kde-base/kdeedu kde-apps/khangman
-kde-base/kdeedu kde-apps/kig
-kde-base/kdeedu kde-apps/kiten
-kde-base/kdeedu kde-base/klatin
-kde-base/kdeedu kde-apps/klettres
-kde-base/kdeedu kde-base/kmathtool
-kde-base/kdeedu kde-base/kmessedwords
-kde-base/kdeedu kde-apps/kmplot
-kde-base/kdeedu kde-base/kpercentage
-kde-base/kdeedu sci-astronomy/kstars
-kde-base/kdeedu kde-apps/ktouch
-kde-base/kdeedu kde-apps/kturtle
-kde-base/kdeedu kde-base/kverbos
-kde-base/kdeedu kde-base/kvoctrain
-kde-base/kdeedu kde-apps/kwordquiz
-kde-base/kdeedu kde-apps/libkdeedu
-kde-base/kdegames kde-base/atlantik
-kde-base/kdegames kde-base/kasteroids
-kde-base/kdegames kde-apps/katomic
-kde-base/kdegames kde-base/kbackgammon
-kde-base/kdegames kde-base/kbattleship
-kde-base/kdegames kde-apps/kblackbox
-kde-base/kdegames kde-apps/kbounce
-kde-base/kdegames kde-base/kenolaba
-kde-base/kdegames kde-base/kfouleggs
-kde-base/kdegames kde-apps/kgoldrunner
-kde-base/kdegames kde-apps/kjumpingcube
-kde-base/kdegames kde-apps/klickety
-kde-base/kdegames kde-apps/klines
-kde-base/kdegames kde-apps/kmahjongg
-kde-base/kdegames kde-apps/kmines
-kde-base/kdegames kde-apps/knetwalk
-kde-base/kdegames kde-base/kolf
-kde-base/kdegames kde-apps/konquest
-kde-base/kdegames kde-apps/kpat
-kde-base/kdegames kde-base/kpoker
-kde-base/kdegames kde-apps/kreversi
-kde-base/kdegames kde-base/ksame
-kde-base/kdegames kde-apps/kshisen
-kde-base/kdegames kde-base/ksirtet
-kde-base/kdegames kde-base/ksmiletris
-kde-base/kdegames kde-base/ksnake
-kde-base/kdegames kde-base/ksokoban
-kde-base/kdegames kde-apps/kspaceduel
-kde-base/kdegames kde-base/ktron
-kde-base/kdegames kde-apps/ktuberling
-kde-base/kdegames kde-base/kwin4
-kde-base/kdegames kde-apps/libkdegames
-kde-base/kdegames kde-base/libksirtet
-kde-base/kdegames kde-apps/lskat
-kde-base/kdegraphics kde-apps/kamera
-kde-base/kdegraphics kde-base/kcoloredit
-kde-base/kdegraphics kde-base/kdegraphics-kfile-plugins
-kde-base/kdegraphics kde-base/kdvi
-kde-base/kdegraphics kde-base/kfax
-kde-base/kdegraphics kde-apps/kgamma
-kde-base/kdegraphics kde-base/kghostview
-kde-base/kdegraphics kde-base/kiconedit
-kde-base/kdegraphics kde-base/kmrml
-kde-base/kdegraphics kde-apps/kolourpaint
-kde-base/kdegraphics kde-base/kooka
-kde-base/kdegraphics kde-base/kpdf
-kde-base/kdegraphics kde-base/kpovmodeler
-kde-base/kdegraphics kde-apps/kruler
-kde-base/kdegraphics kde-apps/ksnapshot
-kde-base/kdegraphics kde-base/ksvg
-kde-base/kdegraphics kde-base/kuickshow
-kde-base/kdegraphics kde-base/kview
-kde-base/kdegraphics kde-base/kviewshell
-kde-base/kdegraphics kde-base/libkscan
-kde-base/kdemultimedia kde-base/akode
-kde-base/kdemultimedia kde-base/artsplugin-akode
-kde-base/kdemultimedia kde-base/artsplugin-audiofile
-kde-base/kdemultimedia kde-base/artsplugin-mpeglib
-kde-base/kdemultimedia kde-base/artsplugin-mpg123
-kde-base/kdemultimedia kde-base/artsplugin-xine
-kde-base/kdemultimedia kde-apps/juk
-kde-base/kdemultimedia kde-base/kaboodle
-kde-base/kdemultimedia kde-base/kaudiocreator
-kde-base/kdemultimedia kde-base/kdemultimedia-arts
-kde-base/kdemultimedia kde-base/kdemultimedia-kappfinder-data
-kde-base/kdemultimedia kde-base/kdemultimedia-kfile-plugins
-kde-base/kdemultimedia kde-base/kdemultimedia-kioslaves
-kde-base/kdemultimedia kde-base/kmid
-kde-base/kdemultimedia kde-apps/kmix
-kde-base/kdemultimedia kde-base/krec
-kde-base/kdemultimedia kde-apps/kscd
-kde-base/kdemultimedia kde-apps/libkcddb
-kde-base/kdemultimedia kde-base/mpeglib
-kde-base/kdemultimedia kde-base/noatun
-kde-base/kdenetwork kde-base/dcoprss
-kde-base/kdenetwork kde-apps/kdenetwork-filesharing
-kde-base/kdenetwork kde-base/kdenetwork-kfile-plugins
-kde-base/kdenetwork kde-base/kdict
-kde-base/kdenetwork kde-base/kdnssd
-kde-base/kdenetwork kde-apps/kget
-kde-base/kdenetwork kde-base/knewsticker
-kde-base/kdenetwork kde-apps/kopete
-kde-base/kdenetwork kde-base/kpf
-kde-base/kdenetwork kde-apps/kppp
-kde-base/kdenetwork kde-apps/krdc
-kde-base/kdenetwork kde-apps/krfb
-kde-base/kdenetwork kde-base/ksirc
-kde-base/kdenetwork kde-base/ktalkd
-kde-base/kdenetwork kde-base/kwifimanager
-kde-base/kdenetwork kde-base/librss
-kde-base/kdenetwork kde-base/lisa
-kde-base/kdepim kde-apps/akregator
-kde-base/kdepim kde-base/certmanager
-kde-base/kdepim kde-apps/kaddressbook
-kde-base/kdepim kde-apps/kalarm
-kde-base/kdepim kde-base/kandy
-kde-base/kdepim kde-base/karm
-kde-base/kdepim kde-base/kdepim-kioslaves
-kde-base/kdepim kde-apps/kdepim-kresources
-kde-base/kdepim kde-apps/kdepim-wizards
-kde-base/kdepim kde-base/kitchensync
-kde-base/kdepim kde-apps/kmail
-kde-base/kdepim kde-base/kmailcvt
-kde-base/kdepim kde-apps/knode
-kde-base/kdepim kde-apps/knotes
-kde-base/kdepim kde-base/kode
-kde-base/kdepim kde-apps/konsolekalendar
-kde-base/kdepim kde-apps/kontact
-kde-base/kdepim kde-base/kontact-specialdates
-kde-base/kdepim kde-apps/korganizer
-kde-base/kdepim kde-base/korn
-kde-base/kdepim kde-base/kpilot
-kde-base/kdepim kde-base/ksync
-kde-base/kdepim kde-apps/ktnef
-kde-base/kdepim kde-base/libkcal
-kde-base/kdepim kde-base/libkdenetwork
-kde-base/kdepim kde-base/libkdepim
-kde-base/kdepim kde-base/libkholidays
-kde-base/kdepim kde-base/libkmime
-kde-base/kdepim kde-base/libkpgp
-kde-base/kdepim kde-base/libkpimexchange
-kde-base/kdepim kde-base/libkpimidentities
-kde-base/kdepim kde-base/libksieve
-kde-base/kdepim kde-base/mimelib
-kde-base/kdepim kde-base/networkstatus
-kde-base/kdesdk kde-base/cervisia
-kde-base/kdesdk kde-apps/kapptemplate
-kde-base/kdesdk kde-base/kbabel
-kde-base/kdesdk kde-base/kbugbuster
-kde-base/kdesdk kde-apps/kcachegrind
-kde-base/kdesdk kde-base/kdesdk-kfile-plugins
-kde-base/kdesdk kde-apps/kdesdk-kioslaves
-kde-base/kdesdk kde-base/kdesdk-misc
-kde-base/kdesdk kde-base/kdesdk-scripts
-kde-base/kdesdk kde-base/kmtrace
-kde-base/kdesdk kde-apps/kompare
-kde-base/kdesdk kde-base/kspy
-kde-base/kdesdk kde-base/kuiviewer
-kde-base/kdesdk kde-apps/umbrello
-kde-base/kdetoys kde-apps/amor
-kde-base/kdetoys kde-base/eyesapplet
-kde-base/kdetoys kde-base/fifteenapplet
-kde-base/kdetoys kde-base/kmoon
-kde-base/kdetoys kde-base/kodo
-kde-base/kdetoys kde-apps/kteatime
-kde-base/kdetoys kde-apps/ktux
-kde-base/kdetoys kde-base/kweather
-kde-base/kdetoys kde-base/kworldclock
-kde-base/kdetoys kde-base/kworldwatch
-kde-base/kdeutils kde-apps/ark
-kde-base/kdeutils kde-apps/kcalc
-kde-base/kdeutils kde-apps/kcharselect
-kde-base/kdeutils kde-base/kdelirc
-kde-base/kdeutils kde-apps/kdf
-kde-base/kdeutils kde-base/kedit
-kde-base/kdeutils kde-apps/kfloppy
-kde-base/kdeutils kde-apps/kgpg
-kde-base/kdeutils kde-base/khexedit
-kde-base/kdeutils app-text/kjots
-kde-base/kdeutils kde-base/klaptopdaemon
-kde-base/kdeutils kde-base/kmilo
-kde-base/kdeutils kde-base/kregexpeditor
-kde-base/kdeutils kde-base/ksim
-kde-base/kdeutils kde-apps/ktimer
-kde-base/kdeutils kde-apps/kwalletmanager
-kde-base/kdeutils kde-base/superkaramba
-kde-base/kdewebdev kde-base/kfilereplace
-kde-base/kdewebdev kde-apps/kimagemapeditor
-kde-base/kdewebdev kde-apps/klinkstatus
-kde-base/kdewebdev kde-apps/kommander
-kde-base/kdewebdev kde-base/kxsldbg
-kde-base/kdewebdev kde-base/quanta
-app-office/koffice app-office/karbon
-app-office/koffice app-office/kchart
-app-office/koffice app-office/kexi
-app-office/koffice app-office/kformula
-app-office/koffice app-office/kivio
-app-office/koffice app-office/koffice-data
-app-office/koffice app-office/koffice-libs
-app-office/koffice app-office/koffice-meta
-app-office/koffice app-office/koshell
-app-office/koffice app-office/kplato
-app-office/koffice app-office/kpresenter
-app-office/koffice media-gfx/krita
-app-office/koffice app-office/kspread
-app-office/koffice app-office/kugar
-app-office/koffice app-office/kword
-'
-
-# @FUNCTION: get-parent-package
-# @USAGE: < name of split-ebuild >
-# @DESCRIPTION:
-# accepts 1 parameter, the name of a split ebuild; echoes the name of its mother package
-get-parent-package() {
- local parent child
- while read parent child; do
- if [[ ${child} == $1 ]]; then
- echo ${parent}
- return 0
- fi
- done <<EOF
-$KDE_DERIVATION_MAP
-EOF
- die "Package $1 not found in KDE_DERIVATION_MAP, please report bug"
-}
-
-# @FUNCTION: get-child-packages
-# @USAGE: < name of monolithic package >
-# @DESCRIPTION:
-# accepts 1 parameter, the name of a monolithic package; echoes the names of all ebuilds derived from it
-get-child-packages() {
- local parent child
- while read parent child; do
- [[ ${parent} == $1 ]] && echo -n "${child} "
- done <<EOF
-$KDE_DERIVATION_MAP
-EOF
-}
-
-# @FUNCTION: is-parent-package
-# @USAGE: < name >
-# @RETURN: 0 if <name> is a parent package, otherwise 1
-is-parent-package() {
- local parent child
- while read parent child; do
- [[ "${parent}" == "$1" ]] && return 0
- done <<EOF
-$KDE_DERIVATION_MAP
-EOF
- return 1
-}
-
-# ---------------------------------------------------------------
-# kde/qt directory management etc. functions, was kde-dirs.ebuild
-# ---------------------------------------------------------------
-
-# @FUNCTION: need-kde
-# @USAGE: < version >
-# @DESCRIPTION:
-# Sets the correct DEPEND and RDEPEND for the needed kde < version >. Also takes
-# care of the correct Qt-version and correct RDEPEND handling.
-need-kde() {
- debug-print-function $FUNCNAME "$@"
-
- KDEVER="$1"
-
- # determine install locations
- set-kdedir ${KDEVER}
-
- if [[ "${RDEPEND-unset}" != "unset" ]]; then
- x_DEPEND="${RDEPEND}"
- else
- x_DEPEND="${DEPEND}"
- fi
- if [[ "${KDEBASE}" == "true" ]]; then
- # If we're a kde-base package, we need at least our own version of kdelibs.
- # Note: we only set RDEPEND if it is already set, otherwise
- # we break packages relying on portage copying RDEPEND from DEPEND.
- DEPEND="${DEPEND} ~kde-frameworks/kdelibs-$PV"
- RDEPEND="${x_DEPEND} ~kde-frameworks/kdelibs-${PV}"
- else
- # Things outside kde-base need a minimum version,
- # but kde-frameworks/kdelibs:kde-4 mustn't satisfy it.
- min-kde-ver ${KDEVER}
- DEPEND="${DEPEND} =kde-frameworks/kdelibs-3.5*"
- RDEPEND="${x_DEPEND} =kde-frameworks/kdelibs-3.5*"
- fi
-
- qtver-from-kdever ${KDEVER}
- need-qt ${selected_version}
-
- if [[ "${KDEBASE}" == "true" ]]; then
- SLOT="$KDEMAJORVER.$KDEMINORVER"
- else
- : ${SLOT="0"}
- fi
-}
-
-# @FUNCTION: set-kdedir
-# @USAGE: < version >
-# @DESCRIPTION:
-# Sets the right directories for the kde <version> wrt what kind of package will
-# be installed, e. g. third-party-apps, kde-base-packages, ...
-set-kdedir() {
- debug-print-function $FUNCNAME "$@"
-
-
- # set install location:
- # - 3rd party apps go into /usr, and have SLOT="0".
- # - kde-base category ebuilds go into /usr/kde/$MAJORVER.$MINORVER,
- # and have SLOT="$MAJORVER.$MINORVER".
- # - kde-base category cvs ebuilds have major version 5 and go into
- # /usr/kde/cvs; they have SLOT="cvs".
- # - Backward-compatibility exceptions: all kde2 packages (kde-base or otherwise)
- # go into /usr/kde/2. kde 3.0.x goes into /usr/kde/3 (and not 3.0).
- # - kde-base category ebuilds always depend on their exact matching version of
- # kdelibs and link against it. Other ebuilds link aginst the latest one found.
- # - This function exports $PREFIX (location to install to) and $KDEDIR
- # (location of kdelibs to link against) for all ebuilds.
- #
- # -- Overrides - deprecated but working for now: --
- # - If $KDEPREFIX is defined (in the profile or env), it overrides everything
- # and both base and 3rd party kde stuff goes in there.
- # - If $KDELIBSDIR is defined, the kdelibs installed in that location will be
- # used, even by kde-base packages.
-
- # get version elements
- IFSBACKUP="$IFS"
- IFS=".-_"
- for x in $1; do
- if [[ -z "$KDEMAJORVER" ]]; then KDEMAJORVER=$x
- else if [[ -z "$KDEMINORVER" ]]; then KDEMINORVER=$x
- else if [[ -z "$KDEREVISION" ]]; then KDEREVISION=$x
- fi; fi; fi
- done
- [[ -z "$KDEMINORVER" ]] && KDEMINORVER="0"
- [[ -z "$KDEREVISION" ]] && KDEREVISION="0"
- IFS="$IFSBACKUP"
- debug-print "$FUNCNAME: version breakup: KDEMAJORVER=$KDEMAJORVER KDEMINORVER=$KDEMINORVER KDEREVISION=$KDEREVISION"
-
- # install prefix
- if [[ -n "$KDEPREFIX" ]]; then
- export PREFIX="$KDEPREFIX"
- else
- if [[ -z ${KDEBASE} || ${KDEBASE} != "true" ]]; then
- PREFIX="/usr/kde/3.5"
- else
- case $KDEMAJORVER.$KDEMINORVER in
- 3*) export PREFIX="/usr/kde/3.5";;
- 5.0) export PREFIX="/usr/kde/svn";;
- *) die "failed to set PREFIX";;
- esac
- fi
- fi
-
- # kdelibs location
- if [[ -n "$KDELIBSDIR" ]]; then
- export KDEDIR="$KDELIBSDIR"
- else
- if [[ -z ${KDEBASE} || ${KDEBASE} != "true" ]]; then
- # find the latest kdelibs installed
- for x in /usr/kde/{svn,3.5} "${PREFIX}" \
- "${KDE3LIBSDIR}" "${KDELIBSDIR}" "${KDE3DIR}" "${KDEDIR}" /usr/kde/*; do
- if [[ -f "${x}/include/kwin.h" ]]; then
- debug-print found
- export KDEDIR="$x"
- break
- fi
- done
- else
- # kde-base ebuilds must always use the exact version of kdelibs they came with
- case $KDEMAJORVER.$KDEMINORVER in
- 3*) export KDEDIR="/usr/kde/3.5";;
- 5.0) export KDEDIR="/usr/kde/svn";;
- *) die "failed to set KDEDIR";;
- esac
- fi
- fi
-
- debug-print "$FUNCNAME: Will use the kdelibs installed in $KDEDIR, and install into $PREFIX."
-}
-
-# @FUNCTION: need-qt
-# @USAGE: < version >
-# @DESCRIPTION:
-# Sets the DEPEND and RDEPEND for Qt <version>.
-need-qt() {
- debug-print-function $FUNCNAME "${@}"
-
- QTVER="$1"
-
- QT=qt
-
- if [[ "${RDEPEND-unset}" != "unset" ]]; then
- x_DEPEND="${RDEPEND}"
- else
- x_DEPEND="${DEPEND}"
- fi
-
- case ${QTVER} in
- 3*) DEPEND="${DEPEND} =dev-qt/qt-meta-3*"
- RDEPEND="${RDEPEND} =dev-qt/qt-meta-3*"
- ;;
- *) echo "!!! error: $FUNCNAME() called with invalid parameter: \"$QTVER\", please report bug" && exit 1;;
- esac
-
-}
-
-# @FUNCTION: set-qtdir
-# @DESCRIPTION:
-# This function is not needed anymore.
-set-qtdir() {
- :
-}
-
-# @FUNCTION: qtver-from-kdever
-# @USAGE: < kde-version >
-# @DESCRIPTION:
-# returns minimal qt version needed for specified kde version
-qtver-from-kdever() {
- debug-print-function $FUNCNAME "$@"
-
- local ver
-
- case $1 in
- 3.1*) ver=3.1;;
- 3.2*) ver=3.2;;
- 3.3*) ver=3.3;;
- 3.4*) ver=3.3;;
- 3.5*) ver=3.3;;
- 3*) ver=3.0.5;;
- 5) ver=3.3;; # cvs version
- *) echo "!!! error: $FUNCNAME called with invalid parameter: \"$1\", please report bug" && exit 1;;
- esac
-
- selected_version="$ver"
-
-}
-
-min-kde-ver() {
- debug-print-function $FUNCNAME "$@"
-
- case $1 in
- 3.0*) selected_version="3.0";;
- 3.1*) selected_version="3.1";;
- 3.2*) selected_version="3.2";;
- 3.3*) selected_version="3.3";;
- 3.4*) selected_version="3.4";;
- 3.5*) selected_version="3.5";;
- 3*) selected_version="3.0";;
- 5) selected_version="5";;
- *) echo "!!! error: $FUNCNAME() called with invalid parameter: \"$1\", please report bug" && exit 1;;
- esac
-
-}
-
-# @FUNCTION: kde_sandbox_patch
-# @USAGE: < dir > [ dir ] [ dir ] [...]
-# @DESCRIPTION:
-# generic makefile sed for sandbox compatibility. for some reason when the kde makefiles (of many packages
-# and versions) try to chown root and chmod 4755 some binaries (after installing, target install-exec-local),
-# they do it to the files in $(bindir), not $(DESTDIR)/$(bindir). Most of these have been fixed in latest cvs
-# but a few remain here and there.
-#
-# Pass a list of dirs to sed, Makefile.{am,in} in these dirs will be sed'ed.
-# This should be harmless if the makefile doesn't need fixing.
-kde_sandbox_patch() {
- debug-print-function $FUNCNAME "$@"
-
- while [[ -n "$1" ]]; do
- # can't use dosed, because it only works for things in ${D}, not ${S}
- cd $1
- for x in Makefile.am Makefile.in Makefile
- do
- if [[ -f "$x" ]]; then
- echo Running sed on $x
- cp $x ${x}.orig
- sed -e 's: $(bindir): $(DESTDIR)/$(bindir):g' -e 's: $(kde_datadir): $(DESTDIR)/$(kde_datadir):g' -e 's: $(TIMID_DIR): $(DESTDIR)/$(TIMID_DIR):g' ${x}.orig > ${x}
- rm ${x}.orig
- fi
- done
- shift
- done
-
-}
-
-# @FUNCTION: kde_remove_flag
-# @USAGE: < dir > < flag >
-# @DESCRIPTION:
-# remove an optimization flag from a specific subdirectory's makefiles.
-# currently kdebase and koffice use it to compile certain subdirs without
-# -fomit-frame-pointer which breaks some things.
-kde_remove_flag() {
- debug-print-function $FUNCNAME "$@"
-
- cd "${S}"/${1} || die "cd to '${S}/${1}' failed."
- [[ -n "$2" ]] || die "missing argument to kde_remove_flag"
-
- cp Makefile Makefile.orig
- sed -e "/CFLAGS/ s/${2}//g
-/CXXFLAGS/ s/${2}//g" Makefile.orig > Makefile
-
- cd "${OLDPWD}"
-
-}
-
-buildsycoca() {
- [[ $EBUILD_PHASE != postinst ]] && [[ $EBUILD_PHASE != postrm ]] && \
- die "buildsycoca() has to be calles in pkg_postinst() and pkg_postrm()."
-
- if [[ -x ${KDEDIR}/bin/kbuildsycoca ]] && [[ -z ${ROOT} || ${ROOT} == "/" ]] ; then
- # First of all, make sure that the /usr/share/services directory exists
- # and it has the right permissions
- mkdir -p /usr/share/services
- chown root:0 /usr/share/services
- chmod 0755 /usr/share/services
-
- ebegin "Running kbuildsycoca to build global database"
- # Filter all KDEDIRs not belonging to the current SLOT from XDG_DATA_DIRS
- # before running kbuildsycoca. This makes sure they don't show up in the
- # 3.5 K-menu unless the user manually adds them.
- XDG_DATA_DIRS="/usr/share:${KDEDIR}/share:/usr/local/share"
- "${KDEDIR}"/bin/kbuildsycoca --global --noincremental &> /dev/null
- eend $?
- fi
-}
-
-postprocess_desktop_entries() {
- [[ $EBUILD_PHASE != preinst ]] && [[ $EBUILD_PHASE != install ]] && \
- die "postprocess_desktop_entries() has to be called in src_install() or pkg_preinst()."
-
- if [[ -d ${D}${PREFIX}/share/applnk ]] ; then
- # min/max depth is _important_ as it excludes legacy KDE stuff. Moving it would cause breakage.
- local desktop_entries="$(find "${D}${PREFIX}/share/applnk" -mindepth 2 -maxdepth 2 \
- -name '*\.desktop' -not -path '*.hidden*' 2>/dev/null)"
-
- if [[ -n ${desktop_entries} ]]; then
- for entry in ${desktop_entries} ; do
- if ! [[ -f "${D}${PREFIX}"/share/applications/kde/${entry##*/} ]] ; then
- dodir "${PREFIX}"/share/applications/kde
- mv ${entry} "${D}${PREFIX}"/share/applications/kde
- fi
- done
- fi
- fi
-
- validate_desktop_entries "${PREFIX}"/share/applications
-}
-
-# is this ebuild part of the KDE SC? kde-base/ or kde-apps/ are only hints
-if [[ "${CATEGORY}" == "kde-base" || "${CATEGORY}" == "kde-apps" ]]; then
- debug-print "${ECLASS}: KDEBASE ebuild recognized"
- KDEBASE=${KDEBASE:=true}
- if [[ ${KDEBASE} == "true" ]]; then
- export KDEBASE
- export KDEREVISION
- fi
-fi
diff --git a/eclass/kde-meta.eclass b/eclass/kde-meta.eclass
deleted file mode 100644
index 570efd6c..00000000
--- a/eclass/kde-meta.eclass
+++ /dev/null
@@ -1,463 +0,0 @@
-# Copyright 1999-2009 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kde-meta.eclass,v 1.91 2009/10/15 22:18:17 abcd Exp $
-
-# @ECLASS: kde-meta.eclass
-# @MAINTAINER:
-# kde@gentoo.org
-#
-# Original authors:
-# Dan Armak <danarmak@gentoo.org>
-# Simone Gotti <motaboy@gentoo.org>
-# @BLURB: This is the kde-meta eclass which supports broken-up kde-base packages.
-# @DESCRIPTION:
-# This is the kde-meta eclass which supports broken-up kde-base packages.
-
-
-inherit kde multilib
-
-# only broken-up ebuilds can use this eclass
-if [[ -z "$KMNAME" ]]; then
- die "kde-meta.eclass inherited but KMNAME not defined - broken ebuild"
-fi
-
-# Replace the $myPx mess - it was ugly as well as not general enough for 3.4.0-rc1
-# The following code should set TARBALLVER (the version in the tarball's name)
-# and TARBALLDIRVER (the version of the toplevel directory inside the tarball).
-case "$PV" in
- 3.5.0_beta2) TARBALLDIRVER="3.4.92"; TARBALLVER="3.4.92" ;;
- 3.5.0_rc1) TARBALLDIRVER="3.5.0"; TARBALLVER="3.5.0_rc1" ;;
- *) TARBALLDIRVER="$PV"; TARBALLVER="$PV" ;;
-esac
-if [[ "${KMNAME}" = "koffice" ]]; then
- case "$PV" in
- 1.6_beta1) TARBALLDIRVER="1.5.91"; TARBALLVER="1.5.91" ;;
- 1.6_rc1) TARBALLDIRVER="1.5.92"; TARBALLVER="1.5.92" ;;
- 1.6.3_p*) TARBALLDIRVER="1.6.3"; TARBALLVER="${PV}" ;;
- esac
-fi
-
-TARBALL="$KMNAME-$TARBALLVER.tar.bz2"
-
-# BEGIN adapted from kde-dist.eclass, code for older versions removed for cleanness
-if [[ "$KDEBASE" = "true" ]]; then
- unset SRC_URI
-
- need-kde $PV
-
- DESCRIPTION="KDE ${PV} - "
- HOMEPAGE="http://www.kde.org/"
- LICENSE="GPL-2"
- SLOT="$KDEMAJORVER.$KDEMINORVER"
-
- # Main tarball for normal downloading style
- # Note that we set SRC_PATH, and add it to SRC_URI later on
- case "$PV" in
- 3.5.0_*) SRC_PATH="mirror://kde/unstable/${PV/.0_/-}/src/$TARBALL" ;;
- 3.5_*) SRC_PATH="mirror://kde/unstable/${PV/_/-}/src/$TARBALL" ;;
- 3.5.0) SRC_PATH="mirror://kde/stable/3.5/src/$TARBALL" ;;
- 3*) SRC_PATH="mirror://kde/stable/$TARBALLVER/src/$TARBALL" ;;
- *) die "$ECLASS: Error: unrecognized version $PV, could not set SRC_URI" ;;
- esac
-
-elif [[ "$KMNAME" == "koffice" ]]; then
- SRC_PATH="mirror://kde/stable/koffice-$PV/src/koffice-$PV.tar.bz2"
- case $PV in
- 1.3.5)
- SRC_PATH="mirror://kde/stable/koffice-$PV/src/koffice-$PV.tar.bz2"
- ;;
- 1.6_beta1)
- SRC_PATH="mirror://kde/unstable/koffice-${PV/_/-}/koffice-${TARBALLVER}.tar.bz2"
- ;;
- 1.6.3_p*) SRC_PATH="mirror://gentoo/${TARBALL}"
- ;;
- *)
- # Identify beta and rc versions by underscore
- if [[ ${PV/_/} != ${PV} ]]; then
- SRC_PATH="mirror://kde/unstable/koffice-${PV/_/-}/src/koffice-${TARBALLVER}.tar.bz2"
- fi
- ;;
- esac
-fi
-
-SRC_URI="$SRC_URI $SRC_PATH"
-
-debug-print "$ECLASS: finished, SRC_URI=$SRC_URI"
-
-# Add a blocking dep on the package we're derived from
-if [[ "${KMNAME}" != "koffice" ]]; then
- DEPEND="${DEPEND} !=$(get-parent-package ${CATEGORY}/${PN})-${SLOT}*"
- RDEPEND="${RDEPEND} !=$(get-parent-package ${CATEGORY}/${PN})-${SLOT}*"
-else
- case ${EAPI:-0} in
- 0)
- # EAPIs without SLOT dependencies.
- IFSBACKUP="$IFS"
- IFS=".-_"
- for x in ${PV}; do
- if [[ -z "$KOFFICEMAJORVER" ]]; then KOFFICEMAJORVER=$x
- else if [[ -z "$KOFFICEMINORVER" ]]; then KOFFICEMINORVER=$x
- else if [[ -z "$KOFFICEREVISION" ]]; then KOFFICEREVISION=$x
- fi; fi; fi
- done
- [[ -z "$KOFFICEMINORVER" ]] && KOFFICEMINORVER="0"
- [[ -z "$KOFFICEREVISION" ]] && KOFFICEREVISION="0"
- IFS="$IFSBACKUP"
- DEPEND="${DEPEND} !=$(get-parent-package ${CATEGORY}/${PN})-${KOFFICEMAJORVER}.${KOFFICEMINORVER}*"
- RDEPEND="${RDEPEND} !=$(get-parent-package ${CATEGORY}/${PN})-${KOFFICEMAJORVER}.${KOFFICEMINORVER}*"
- ;;
- # EAPIs with SLOT dependencies.
- *)
- [[ -z ${SLOT} ]] && SLOT="0"
- DEPEND="${DEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}"
- RDEPEND="${RDEPEND} !$(get-parent-package ${CATEGORY}/${PN}):${SLOT}"
- ;;
- esac
-fi
-
-# @ECLASS-VARIABLE: KMNAME
-# @DESCRIPTION:
-# Name of the metapackage (eg kdebase, kdepim). Must be set before inheriting
-# this eclass, since it affects $SRC_URI. This variable MUST be set.
-
-# @ECLASS-VARIABLE: KMNOMODULE
-# @DESCRIPTION:
-# Unless set to "true", then KMMODULE will be not defined and so also the docs.
-# Useful when we want to installs subdirs of a subproject, like plugins, and we
-# have to mark the topsubdir ad KMEXTRACTONLY.
-
-# @ECLASS-VARIABLE: KMMODULE
-# @DESCRIPTION:
-# Defaults to $PN. Specify one subdirectory of KMNAME. Is treated exactly like items in KMEXTRA.
-# Fex., the ebuild name of kdebase/l10n is kdebase-l10n, because just 'l10n' would be too confusing.
-# Do not include the same item in more than one of KMMODULE, KMMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY, KMCOPYLIB.
-
-# @ECLASS-VARIABLE: KMNODOCS
-# @DESCRIPTION:
-# Unless set to "true", 'doc/$KMMODULE' is added to KMEXTRA. Set for packages that don't have docs.
-
-# @ECLASS-VARIABLE: KMEXTRA
-# @DESCRIPTION:
-# Specify files/dirs to extract, compile and install. $KMMODULE is added to
-# KMEXTRA automatically. So is doc/$KMMODULE (unless $KMNODOCS==true). Makefiles
-# are created automagically to compile/install the correct files. Observe these
-# rules:
-#
-# - Don't specify the same file in more than one of three variables (KMEXTRA,
-# KMCOMPILEONLY, and KMEXTRACTONLY)
-# - When using KMEXTRA, remember to add the doc/foo dir for the extra dirs if one exists.
-# - KMEXTRACTONLY take effect over an entire directory tree, you can override it defining
-#
-# KMEXTRA, KMCOMPILEONLY for every subdir that must have a different behavior.
-# eg. you have this tree:
-# foo/bar
-# foo/bar/baz1
-# foo/bar/baz1/taz
-# foo/bar/baz2
-# If you define:
-# KMEXTRACTONLY=foo/bar and KMEXTRA=foo/bar/baz1
-# then the only directory compiled will be foo/bar/baz1 and not foo/bar/baz1/taz (also if it's a subdir of a KMEXTRA) or foo/bar/baz2
-#
-# IMPORTANT!!! you can't define a KMCOMPILEONLY SUBDIR if its parents are defined as KMEXTRA or KMMODULE. or it will be installed anywhere. To avoid this probably are needed some chenges to the generated Makefile.in.
-# Do not include the same item in more than one of KMMODULE, KMMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY, KMCOPYLIB.
-
-# @ECLASS-VARIABLE: KMCOMPILEONLY
-# @DESCRIPTION:
-# Please see KMEXTRA
-
-# @ECLASS-VARIABLE: KMEXTRACTONLY
-# @DESCRIPTION:
-# Please see KMEXTRA
-
-# @ECLASS-VARIABLE: KMCOPYLIB
-# @DESCRIPTION:
-# Contains an even number of $IFS (i.e. whitespace) -separated words.
-# Each two consecutive words, libname and dirname, are considered. symlinks are created under $S/$dirname
-# pointing to $PREFIX/lib/libname*.
-# Do not include the same item in more than one of KMMODULE, KMMEXTRA, KMCOMPILEONLY, KMEXTRACTONLY, KMCOPYLIB.
-
-
-# ====================================================
-
-# @FUNCTION: create_fullpaths
-# @DESCRIPTION:
-# create a full path vars, and remove ALL the endings "/"
-create_fullpaths() {
- for item in $KMMODULE; do
- KMMODULEFULLPATH="$KMMODULEFULLPATH ${S}/${item%/}"
- done
- for item in $KMEXTRA; do
- KMEXTRAFULLPATH="$KMEXTRAFULLPATH ${S}/${item%/}"
- done
- for item in $KMCOMPILEONLY; do
- KMCOMPILEONLYFULLPATH="$KMCOMPILEONLYFULLPATH ${S}/${item%/}"
- done
- for item in $KMEXTRACTONLY; do
- KMEXTRACTONLYFULLPATH="$KMEXTRACTONLYFULLPATH ${S}/${item%/}"
- done
-}
-
-# @FUNCTION: change_makefiles
-# @USAGE: < dir > < isextractonly >
-# @DESCRIPTION:
-# Creates Makefile.am files in directories where we didn't extract the originals.
-# $isextractonly: true if the parent dir was defined as KMEXTRACTONLY
-# Recurses through $S and all subdirs. Creates Makefile.am with SUBDIRS=<list of existing subdirs>
-# or just empty all:, install: targets if no subdirs exist.
-change_makefiles() {
- debug-print-function $FUNCNAME "$@"
- local dirlistfullpath dirlist directory isextractonly
-
- cd "${1}"
- debug-print "We are in ${PWD}"
-
- # check if the dir is defined as KMEXTRACTONLY or if it was defined is KMEXTRACTONLY in the parent dir, this is valid only if it's not also defined as KMMODULE, KMEXTRA or KMCOMPILEONLY. They will ovverride KMEXTRACTONLY, but only in the current dir.
- isextractonly="false"
- if ( ( has "$1" $KMEXTRACTONLYFULLPATH || [[ $2 = "true" ]] ) && \
- ( ! has "$1" $KMMODULEFULLPATH $KMEXTRAFULLPATH $KMCOMPILEONLYFULLPATH ) ); then
- isextractonly="true"
- fi
- debug-print "isextractonly = $isextractonly"
-
- dirlistfullpath=
- for item in *; do
- if [[ -d "${item}" && "${item}" != "CVS" && "${S}/${item}" != "${S}/admin" ]]; then
- # add it to the dirlist, with the FULL path and an ending "/"
- dirlistfullpath="$dirlistfullpath ${1}/${item}"
- fi
- done
- debug-print "dirlist = $dirlistfullpath"
-
- for directory in $dirlistfullpath; do
-
- if ( has "$1" $KMEXTRACTONLYFULLPATH || [[ $2 = "true" ]] ); then
- change_makefiles $directory 'true'
- else
- change_makefiles $directory 'false'
- fi
- # come back to our dir
- cd $1
- done
-
- cd $1
- debug-print "Come back to ${PWD}"
- debug-print "dirlist = $dirlistfullpath"
- if [[ $isextractonly = "true" ]] || [[ ! -f Makefile.am ]] ; then
- # if this is a latest subdir
- if [[ -z "$dirlistfullpath" ]]; then
- debug-print "dirlist is empty => we are in the latest subdir"
- echo 'all:' > Makefile.am
- echo 'install:' >> Makefile.am
- echo '.PHONY: all' >> Makefile.am
- else # it's not a latest subdir
- debug-print "We aren't in the latest subdir"
- # remove the ending "/" and the full path"
- for directory in $dirlistfullpath; do
- directory=${directory%/}
- directory=${directory##*/}
- dirlist="$dirlist $directory"
- done
- echo "SUBDIRS=$dirlist" > Makefile.am
- fi
- fi
-}
-
-set_common_variables() {
- # Overridable module (subdirectory) name, with default value
- if [[ "$KMNOMODULE" != "true" ]] && [[ -z "$KMMODULE" ]]; then
- KMMODULE=$PN
- fi
-
- # Unless disabled, docs are also extracted, compiled and installed
- DOCS=""
- if [[ "$KMNOMODULE" != "true" ]] && [[ "$KMNODOCS" != "true" ]]; then
- DOCS="doc/$KMMODULE"
- fi
-}
-
-# @FUNCTION: kde-meta_src_unpack
-# @USAGE: [ unpack ] [ makefiles ]
-# @DESCRIPTION:
-# This has function sections now. Call unpack, apply any patches not in $PATCHES,
-# then call makefiles.
-kde-meta_src_unpack() {
- debug-print-function $FUNCNAME "$@"
-
- set_common_variables
-
- sections="$@"
- [[ -z "$sections" ]] && sections="unpack makefiles"
- for section in $sections; do
- case $section in
- unpack)
-
- # kdepim packages all seem to rely on libkdepim/kdepimmacros.h
- # also, all kdepim Makefile.am's reference doc/api/Doxyfile.am
- if [[ "$KMNAME" == "kdepim" ]]; then
- KMEXTRACTONLY="$KMEXTRACTONLY libkdepim/kdepimmacros.h doc/api"
- fi
-
- # Create final list of stuff to extract
- extractlist=""
- for item in admin Makefile.am Makefile.am.in configure.in.in configure.in.mid configure.in.bot \
- acinclude.m4 aclocal.m4 AUTHORS COPYING INSTALL README NEWS ChangeLog \
- $KMMODULE $KMEXTRA $KMCOMPILEONLY $KMEXTRACTONLY $DOCS
- do
- extractlist="$extractlist $KMNAME-$TARBALLDIRVER/${item%/}"
- done
-
- # $KMTARPARAMS is also available for an ebuild to use; currently used by kturtle
- TARFILE=$DISTDIR/$TARBALL
- KMTARPARAMS="$KMTARPARAMS -j"
- cd "${WORKDIR}"
-
- echo ">>> Unpacking parts of ${TARBALL} to ${WORKDIR}"
- # Note that KMTARPARAMS is also used by an ebuild
- tar -xpf $TARFILE $KMTARPARAMS $extractlist 2> /dev/null
-
- [[ -n ${A/${TARBALL}/} ]] && unpack ${A/${TARBALL}/}
-
- # Avoid syncing if possible
- # No idea what the above comment means...
- if [[ -n "$RAWTARBALL" ]]; then
- rm -f "${T}"/$RAWTARBALL
- fi
-
- # Default $S is based on $P not $myP; rename the extracted dir to fit $S
- mv $KMNAME-$TARBALLDIRVER $P || die "mv $KMNAME-$TARBallDIRVER failed."
- S="${WORKDIR}"/${P}
-
- # Copy over KMCOPYLIB items
- libname=""
- for x in $KMCOPYLIB; do
- if [[ "$libname" == "" ]]; then
- libname=$x
- else
- dirname=$x
- cd "${S}"
- mkdir -p ${dirname}
- cd ${dirname}
- search_path=$(echo "${PREFIX}"/$(get_libdir)/{,kde3/{,plugins/{designer,styles}}})
- if [[ ! "$(find ${search_path} -maxdepth 1 -name "${libname}*" 2>/dev/null)" == "" ]]; then
- echo "Symlinking library ${libname} under ${PREFIX}/$(get_libdir)/ in source dir"
- ln -s "${PREFIX}"/$(get_libdir)/${libname}* .
- else
- die "Can't find library ${libname} under ${PREFIX}/$(get_libdir)/"
- fi
- libname=""
- fi
- done
-
- # Don't add a param here without looking at its implementation.
- kde_src_unpack
-
- # kdebase: Remove the installation of the "startkde" and "kde3" scripts.
- if [[ "$KMNAME" == "kdebase" ]]; then
- sed -i -e s:"bin_SCRIPTS = startkde.*"::g "${S}"/Makefile.am.in
- fi
-
- ;;
- makefiles)
-
- case ${EAPI:-0} in
- 0|1) kde-meta_src_prepare ;;
- esac
-
- ;;
- esac
- done
-
- # for ebuilds with extended src_unpack
- cd "${S}"
-}
-
-# @FUNCTION: kde-meta_src_prepare
-# @DESCRIPTION:
-# Source tree preparation compatible with eapi 2
-kde-meta_src_prepare() {
- debug-print-function $FUNCNAME "$@"
-
- set_common_variables
-
- case ${EAPI:-0} in
- 0|1) ;; # Don't call kde_src_prepare, as kde_src_unpack already did so
- *) kde_src_prepare ;;
- esac
-
- # Create Makefile.am files
- create_fullpaths
- change_makefiles "${S}" "false"
-}
-
-# @FUNCTION: kde-meta_src_configure
-# @DESCRIPTION:
-# Configure stub for eapi 2
-kde-meta_src_configure() {
- debug-print-function $FUNCNAME "$@"
-
- set_common_variables
-
- if [[ "$KMNAME" == "kdebase" ]]; then
- # bug 82032: the configure check for java is unnecessary as well as broken
- myconf="$myconf --without-java"
- fi
-
- if [[ "$KMNAME" == "kdegames" ]]; then
- # make sure games are not installed with setgid bit, as it is a security risk.
- myconf="$myconf --disable-setgid"
- fi
-
- # Make sure kde_src_configure is run in EAPI >= 2
- case ${EAPI:-0} in
- 0|1) ;;
- *) kde_src_configure ;;
- esac
-}
-
-# @FUNCTION: kde-meta_src_compile
-# @DESCRIPTION:
-# Does some checks before it invokes kde_src_compile
-kde-meta_src_compile() {
- debug-print-function $FUNCNAME "$@"
- case ${EAPI:-0} in
- 0|1) kde-meta_src_configure ;;
- esac
- kde_src_compile "$@"
-}
-
-# @FUNCTION: kde-meta_src_install
-# @USAGE: [ make ] [ dodoc ] [ all ]
-# @DESCRIPTION:
-# The kde-meta src_install function
-kde-meta_src_install() {
- debug-print-function $FUNCNAME "$@"
-
- set_common_variables
-
- if [[ "$1" == "" ]]; then
- kde-meta_src_install make dodoc
- fi
- while [[ -n "$1" ]]; do
- case $1 in
- make)
- for dir in $KMMODULE $KMEXTRA $DOCS; do
- if [[ -d "${S}"/$dir ]]; then
- cd "${S}"/$dir
- emake DESTDIR="${D}" destdir="${D}" install || die "emake install failed."
- fi
- done
- ;;
- dodoc)
- kde_src_install dodoc
- ;;
- all)
- kde-meta_src_install make dodoc
- ;;
- esac
- shift
- done
-}
-case ${EAPI:-0} in
- 0|1) EXPORT_FUNCTIONS src_unpack src_compile src_install;;
- 2|3|4|5) EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install;;
-esac
diff --git a/eclass/kde.eclass b/eclass/kde.eclass
deleted file mode 100644
index 8bf71e2a..00000000
--- a/eclass/kde.eclass
+++ /dev/null
@@ -1,614 +0,0 @@
-# Copyright 1999-2008 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kde.eclass,v 1.223 2009/05/12 12:55:46 tampakrap Exp $
-
-# @ECLASS: kde.eclass
-# @MAINTAINER:
-# kde@gentoo.org
-#
-# original author Dan Armak <danarmak@gentoo.org>
-#
-# Revisions Caleb Tennis <caleb@gentoo.org>
-# @BLURB: The kde eclass is inherited by all kde-* eclasses.
-# @DESCRIPTION:
-# This eclass is inherited by all kde-* eclasses. Few ebuilds inherit straight from here.
-
-[[ -z ${WANT_AUTOMAKE} ]] && WANT_AUTOMAKE="1.9"
-
-inherit base eutils kde-functions flag-o-matic libtool autotools
-
-DESCRIPTION="Based on the $ECLASS eclass"
-HOMEPAGE="http://www.kde.org/"
-IUSE="debug elibc_FreeBSD"
-
-#CYKER - KLUDGE KLUDGE KLUDGE FUCK YOU kde-apps
-if [[ ${CATEGORY} == "kde-base" || "${CATEGORY}" == "kde-apps" ]]; then
- if [[ ${PV##*.} -lt 10 ]] ; then
- # Keep old ebuilds as is
- IUSE="${IUSE} kdeenablefinal"
- else
- # Don't use --enable-final anymore. Does only cause problems for users and
- # as an unwelcome extra invalid bug reports, without any reasonable benefit.
-
- # Get the aRts dependencies right - finally.
- case "${PN}" in
- blinken|juk|kalarm|kanagram|kbounce|kcontrol|konq-plugins|kscd|kscreensaver|kttsd|kwifimanager|kdelibs) ARTS_REQUIRED="" ;;
- artsplugin-*|kaboodle|kasteroids|kdemultimedia-arts|kolf|krec|ksayit|noatun*) ARTS_REQUIRED="yes" ;;
- *) ARTS_REQUIRED="never" ;;
- esac
- fi
-fi
-
-if [[ ${ARTS_REQUIRED} != "yes" && ${ARTS_REQUIRED} != "never" && ${PN} != "arts" ]]; then
- IUSE="${IUSE} arts"
-fi
-
-# @ECLASS-VARIABLE: KDE_S
-# @DESCRIPTION:
-# Like the 'normal' ${S} this variable takes the path to the temporary build
-# directory. If unset ${S} will be used.
-
-# @ECLASS-VARIABLE: USE_KEG_PACKAGING
-# @DESCRIPTION:
-# Set USE_KEG_PACKAGING=1 before inheriting if the package use extragear-like
-# packaging and then supports ${LANGS} and ${LANGS_DOC} variables. By default
-# translations are found in the po subdirectory of ${S}. Set KEG_PO_DIR to
-# override this default.
-if [[ -n ${USE_KEG_PACKAGING} && -n "${LANGS}${LANGS_DOC}" ]]; then
- for lang in ${LANGS} ${LANGS_DOC}; do
- IUSE="${IUSE} linguas_${lang}"
- done
-fi
-
-DEPEND="sys-devel/make
- virtual/pkgconfig
- dev-lang/perl"
-
-if [[ ${CATEGORY} != "kde-base" ]] || [[ ${CATEGORY} == "kde-base" && ${PV##*.} -lt 10 ]] ; then
- DEPEND="${DEPEND}
- x11-libs/libXt
- x11-base/xorg-proto"
- RDEPEND="xinerama? ( x11-libs/libXinerama )"
- IUSE="${IUSE} xinerama"
-else
- RDEPEND=""
-fi
-
-if [[ ${ARTS_REQUIRED} == "yes" ]]; then
- DEPEND="${DEPEND} kde-base/arts"
- RDEPEND="${RDEPEND} kde-base/arts"
-elif [[ ${ARTS_REQUIRED} != "never" && ${PN} != "arts" ]]; then
- DEPEND="${DEPEND} arts? ( kde-base/arts )"
- RDEPEND="${RDEPEND} arts? ( kde-base/arts )"
-fi
-
-# overridden in other places like kde-dist, kde-source and some individual ebuilds
-SLOT="0"
-
-# @ECLASS-VARIABLE: ARTS_REQUIRED
-# @DESCRIPTION:
-# Is aRTs-support required or not? Possible values are 'yes', 'never'. Otherwise
-# leave this variable unset. This results in an arts USE flag.
-
-# @FUNCTION: kde_pkg_setup
-# @DESCRIPTION:
-# Some basic test about arts-support. It also filters some compiler flags
-kde_pkg_setup() {
- if [[ ${PN} != "arts" ]] && [[ ${PN} != "kdelibs" ]] ; then
- if [[ ${ARTS_REQUIRED} == 'yes' ]] || \
- ( [[ ${ARTS_REQUIRED} != "never" ]] && use arts ) ; then
- if ! built_with_use =kde-frameworks/kdelibs-3.5* arts ; then
- if has arts ${IUSE} && use arts; then
- eerror "You are trying to compile ${CATEGORY}/${PF} with the \"arts\" USE flag enabled."
- else
- eerror "The package ${CATEGORY}/${PF} you're trying to merge requires aRTs."
- fi
- eerror "However, $(best_version =kde-frameworks/kdelibs-3.5*) was compiled with the arts USE flag disabled."
- eerror
- if has arts ${IUSE} && use arts; then
- eerror "You must either disable this USE flag, or recompile"
- else
- eerror "To build this package you have to recompile"
- fi
- eerror "$(best_version =kde-frameworks/kdelibs-3.5*) with the arts USE flag enabled."
- die "kdelibs missing arts"
- fi
- fi
- fi
-
- if [[ "${PN}" = "kdelibs" ]]; then
- use doc && if ! built_with_use =dev-qt/qt-meta-3* doc ; then
- eerror "Building kdelibs with the doc USE flag requires qt to be built with the doc USE flag."
- eerror "Please re-emerge qt-3 with this USE flag enabled."
- fi
- fi
-
- # Let filter visibility flags that will *really* hurt your KDE
- # _experimental_ support for this is enabled by kdehiddenvisibility useflag
- filter-flags -fvisibility=hidden -fvisibility-inlines-hidden
-}
-
-# @FUNCTION: kde_src_unpack
-# @DESCRIPTION:
-# This function unpacks the sources.
-# For EAPI 0 and 1 it allso runs kde_src_prepare.
-kde_src_unpack() {
- debug-print-function $FUNCNAME "$@"
- [[ -z "$*" ]] || die "$FUNCNAME no longer supports stages."
- [[ -z "${KDE_S}" ]] && KDE_S="${S}"
- # Don't use base_src_unpack, as that will call base_src_prepare
- # in the wrong place
- [[ -d "${KDE_S}" ]] || unpack ${A}
- case ${EAPI:-0} in
- 0|1) kde_src_prepare ;;
- esac
-}
-
-# @FUNCTION: kde_src_prepare
-# @DESCRIPTION:
-# This function patches the sources. The patches need to be named
-# $PN-$PV-*{diff,patch}
-#
-# This function also handles the linguas if extragear-like packaging is enabled.
-# (See USE_KEG_PACKAGING)
-kde_src_prepare() {
- debug-print-function $FUNCNAME "$@"
- local PATCHDIR="${WORKDIR}/patches/"
-
- # Unpack first and deal with KDE patches after examing possible patch sets.
- # To be picked up, patches need to be named $PN-$PV-*{diff,patch} and be
- # placed in $PATCHDIR. Monolithic ebuilds will use the split ebuild patches.
- if [[ -d "${PATCHDIR}" ]] ; then
- local packages p f
- if is-parent-package ${CATEGORY}/${PN} ; then
- packages="$(get-child-packages ${CATEGORY}/${PN})"
- packages="${packages//${CATEGORY}\//} ${PN}"
- else
- packages="${PN}"
- fi
- if [[ -n ${PATCHES[@]} && $(declare -p PATCHES) != 'declare -a '* ]]; then
- PATCHES=(${PATCHES})
- fi
- for p in ${packages}; do
- for f in "${PATCHDIR}"/${p}-${PV}-*{diff,patch}; do
- [[ -e ${f} ]] && PATCHES+=("${f}")
- done
- if [[ "${KDEBASE}" == "true" ]]; then
- for f in "${PATCHDIR}"/${p}-${SLOT}-*{diff,patch}; do
- [[ -e ${f} ]] && PATCHES+=("${f}")
- done
- fi
- done
- fi
-
- base_src_prepare
-
- # if extragear-like packaging is enabled, set the translations and the
- # documentation depending on LINGUAS settings
- if [[ -n ${USE_KEG_PACKAGING} ]]; then
- if [[ -z ${LINGUAS} ]]; then
- einfo "You can drop some of the translations of the interface and"
- einfo "documentation by setting the \${LINGUAS} variable to the"
- einfo "languages you want installed."
- einfo
- einfo "Enabling all languages"
- else
- # we sanitise LINGUAS to avoid issues when a user specifies the same
- # linguas twice. bug #215016.
- local sanitised_linguas=$(echo "${LINGUAS}" | tr '[[:space:]]' '\n' | sort | uniq)
- if [[ -n ${LANGS} ]]; then
- MAKE_PO=$(echo "${sanitised_linguas} ${LANGS}" | tr '[[:space:]]' '\n' | sort | uniq -d | tr '\n' ' ')
- einfo "Enabling translations for: ${MAKE_PO}"
- sed -i -e "s:^SUBDIRS[ \t]*=.*:SUBDIRS = ${MAKE_PO}:" "${KDE_S}/${KEG_PO_DIR:-po}/Makefile.am" \
- || die "sed for locale failed"
- rm -f "${KDE_S}/configure"
- fi
-
- if [[ -n ${LANGS_DOC} ]]; then
- MAKE_DOC=$(echo "${sanitised_linguas} ${LANGS_DOC}" | tr '[[:space:]]' '\n' | sort | uniq -d | tr '\n' ' ')
- einfo "Enabling documentation for: ${MAKE_DOC}"
- [[ -n ${MAKE_DOC} ]] && [[ -n ${DOC_DIR_SUFFIX} ]] && MAKE_DOC=$(echo "${MAKE_DOC}" | tr '\n' ' ') && MAKE_DOC="${MAKE_DOC// /${DOC_DIR_SUFFIX} }"
- sed -i -e "s:^SUBDIRS[ \t]*=.*:SUBDIRS = ${MAKE_DOC} ${PN}:" \
- "${KDE_S}/doc/Makefile.am" || die "sed for locale failed"
- rm -f "${KDE_S}/configure"
- fi
- fi
- fi
-
- # fix the 'languageChange undeclared' bug group: touch all .ui files, so that the
- # makefile regenerate any .cpp and .h files depending on them.
- cd "${KDE_S}"
- debug-print "$FUNCNAME: Searching for .ui files in ${PWD}"
- UIFILES="$(find . -name '*.ui' -print)"
- debug-print "$FUNCNAME: .ui files found:"
- debug-print "$UIFILES"
- # done in two stages, because touch doens't have a silent/force mode
- if [[ -n "$UIFILES" ]]; then
- debug-print "$FUNCNAME: touching .ui files..."
- touch $UIFILES
- fi
-
- if [[ -d "${WORKDIR}/admin" ]] && [[ -d "${KDE_S}/admin" ]]; then
- ebegin "Updating admin/ directory..."
- rm -rf "${KDE_S}/admin" "${KDE_S}/configure" || die "Unable to remove old admin/ directory"
- ln -s "${WORKDIR}/admin" "${KDE_S}/admin" || die "Unable to symlink the new admin/ directory"
- eend 0
- fi
-
- # >=autoconf-archive-2016.03.20 tries to include
- # ax_cxx_compile_stdcxx.m4 which these old kde packages seek in ${S}.
- # Create a symlink so we don't break the build.
- if [[ -f "/usr/share/aclocal/ax_cxx_compile_stdcxx.m4" ]] ; then
- ln -s /usr/share/aclocal/ax_cxx_compile_stdcxx.m4 "${S}" || die
- fi
-}
-
-# @FUNCTION: kde_src_configure
-# @USAGE: [ myconf ] [ configure ] [ all ]
-# @DESCRIPTION:
-# This function compiles the sources. It takes care of "cannot write to .kde
-# or .qt"-problem due to sandbox and some other sandbox issues.
-#
-# If no argument is given, all is assumed.
-kde_src_configure() {
- debug-print-function $FUNCNAME "$@"
-
- [[ -z "$1" ]] && kde_src_configure all
-
- [[ -z "${KDE_S}" ]] && KDE_S="${S}"
- cd "${KDE_S}"
-
- export kde_widgetdir="$KDEDIR/$(get_libdir)/kde3/plugins/designer"
-
- # fix the sandbox errors "can't writ to .kde or .qt" problems.
- # this is a fake homedir that is writeable under the sandbox, so that the build process
- # can do anything it wants with it.
- REALHOME="$HOME"
- mkdir -p "${T}"/fakehome/.kde
- mkdir -p "${T}"/fakehome/.qt
- export HOME="${T}"/fakehome
- addwrite "${QTDIR}/etc/settings"
-
- # Fix bug 96177: if KDEROOTHOME is defined, the ebuild accesses the real homedir via it, and not our exported $HOME
- unset KDEHOME
- unset KDEROOTHOME
-
- # things that should access the real homedir
- [[ -d "$REALHOME/.ccache" ]] && ln -sf "$REALHOME/.ccache" "$HOME/"
-
- while [[ "$1" ]]; do
-
- case $1 in
- myconf)
- debug-print-section myconf
- if [[ ${CATEGORY} != "kde-base" ]] || [[ ${CATEGORY} == "kde-base" && ${PV##*.} -lt 10 ]] ; then
- myconf+=" --with-x --enable-mitshm $(use_with xinerama) --with-qt-dir=${QTDIR} --enable-mt --with-qt-libraries=${QTDIR}/$(get_libdir)"
- else
- myconf+=" --with-qt-dir=${QTDIR} --enable-mt --with-qt-libraries=${QTDIR}/$(get_libdir)"
- fi
- # calculate dependencies separately from compiling, enables ccache to work on kde compiles
- myconf="$myconf --disable-dependency-tracking"
- if use debug ; then
- myconf="$myconf --enable-debug=full --with-debug"
- else
- myconf="$myconf --disable-debug --without-debug"
- fi
- if has kdeenablefinal ${IUSE}; then
- myconf="$myconf $(use_enable kdeenablefinal final)"
- fi
- if [[ ${ARTS_REQUIRED} == "never" ]]; then
- myconf="$myconf --without-arts"
- elif [[ ${ARTS_REQUIRED} != 'yes' && ${PN} != "arts" ]]; then
- # This might break some external package until
- # ARTS_REQUIRED="yes" is set on them, KDE 3.2 is no more
- # supported anyway.
- myconf="$myconf $(use_with arts)"
- fi
- debug-print "$FUNCNAME: myconf: set to ${myconf}"
- ;;
- configure)
- debug-print-section configure
- debug-print "$FUNCNAME::configure: myconf=$myconf"
-
- export WANT_AUTOMAKE
-
- # rebuild configure script, etc
- # This can happen with e.g. a cvs snapshot
- if [[ ! -f "./configure" ]]; then
- # This is needed to fix building with autoconf 2.60.
- # Many thanks to who preferred such a stupid check rather
- # than a working arithmetic comparison.
- if [[ -f admin/cvs.sh ]]; then
- sed -i -e '/case $AUTO\(CONF\|HEADER\)_VERSION in/,+1 s/2\.5/2.[56]/g' \
- admin/cvs.sh
- fi
-
- # Replace the detection script with a dummy, let our wrappers do the work
- if [[ -f admin/detect-autoconf.sh ]]; then
- cat - > admin/detect-autoconf.sh <<EOF
-#!/bin/sh
-export AUTOCONF="autoconf"
-export AUTOHEADER="autoheader"
-export AUTOM4TE="autom4te"
-export AUTOMAKE="automake"
-export ACLOCAL="aclocal"
-export WHICH="which"
-EOF
- fi
-
- # Make build succeed with >=autoconf-2.65, see http://tinyurl.com/yc4nbhq
- if [[ -f admin/acinclude.m4.in ]] && \
- [[ ! -f ${T}/acinclude.m4.in ]]; then
- cp admin/acinclude.m4.in "${T}"
- einfo "Patching admin/acinclude.m4.in"
- patch -f --ignore-whitespace admin/acinclude.m4.in <<'EOF'
---- admin/acinclude.m4.in
-+++ admin/acinclude.m4.in
-@@ -3081,6 +3081,13 @@
- fi
- ])
-
-+AC_DEFUN([GENTOO_DUMMY_CFLAGS],
-+[
-+ dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
-+ CFLAGS=" $CFLAGS"
-+])
-+AC_BEFORE([GENTOO_DUMMY_CFLAGS],[AC_PROG_CC])
-+
- AC_DEFUN([AC_CHECK_COMPILERS],
- [
- AC_ARG_ENABLE(debug,
-@@ -3141,12 +3148,10 @@
- [kde_use_profiling="no"]
- )
-
-- dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
-- CFLAGS=" $CFLAGS"
--
-- AC_PROG_CC
-+ AC_REQUIRE([GENTOO_DUMMY_CFLAGS])
-+ AC_REQUIRE([AC_PROG_CC])
-
-- AC_PROG_CPP
-+ AC_REQUIRE([AC_PROG_CPP])
-
- if test "$GCC" = "yes"; then
- if test "$kde_use_debug_code" != "no"; then
-@@ -3176,7 +3181,7 @@
-
- CXXFLAGS=" $CXXFLAGS"
-
-- AC_PROG_CXX
-+ AC_REQUIRE([AC_PROG_CXX])
-
- KDE_CHECK_FOR_BAD_COMPILER
-
-EOF
- if [[ $? != 0 ]]; then
- ewarn "Failed to patch admin/acinclude.m4.in"
- cp "${T}/acinclude.m4.in" admin/acinclude.m4.in
- fi
- fi
- for x in Makefile.cvs admin/Makefile.common; do
- if [[ -f "$x" && -z "$makefile" ]]; then makefile="$x"; fi
- done
- if [[ -f "$makefile" ]]; then
- debug-print "$FUNCNAME: configure: generating configure script, running make -f $makefile"
- emake -f $makefile
- fi
- [[ -f "./configure" ]] || die "no configure script found, generation unsuccessful"
- fi
-
- export PATH="${KDEDIR}/bin:${PATH}"
-
- # configure doesn't need to know about the other KDEs installed.
- # in fact, if it does, it sometimes tries to use the wrong dcopidl, etc.
- # due to the messed up way configure searches for things
- export KDEDIRS="${PREFIX}:${KDEDIR}"
-
- # Visiblity stuff is broken. Just disable it when it's present.
- export kde_cv_prog_cxx_fvisibility_hidden=no
-
- if has kdehiddenvisibility ${IUSE} && use kdehiddenvisibility; then
- if [[ $(gcc-major-version)$(gcc-minor-version) -ge 41 ]]; then
- if [[ ${PN} != "kdelibs" && ${PN} != "arts" ]] && \
- ! fgrep -q "#define __KDE_HAVE_GCC_VISIBILITY" "${KDEDIR}/include/kdemacros.h"; then
-
- eerror "You asked to enable hidden visibility, but your kdelibs was"
- eerror "built without its support. Please rebuild kdelibs with the"
- eerror "kdehiddenvisibility useflag enabled."
- die "kdelibs without hidden visibility"
- else
- unset kde_cv_prog_cxx_fvisibility_hidden
- myconf="$myconf $(use_enable kdehiddenvisibility gcc-hidden-visibility)"
- fi
- else
- eerror "You're trying to enable hidden visibility, but"
- eerror "you are using an old GCC version. Hidden visibility"
- eerror "can be enabled only with GCC 4.1 and later."
- fi
- fi
-
- # If we're in a kde-base ebuild, set the prefixed directories to
- # override the ones set by econf.
- if [[ -n ${PREFIX} && ${PREFIX} != "/usr" ]]; then
- myconf="${myconf} --prefix=${PREFIX}
- --mandir=${PREFIX}/share/man
- --infodir=${PREFIX}/share/info
- --datadir=${PREFIX}/share
- --sysconfdir=${PREFIX}/etc"
- fi
-
- # Use libsuffix to keep KDE happy, the --libdir parameter get
- # still honored.
- if [[ $(get_libdir) != "lib" ]] ; then
- myconf="${myconf} --enable-libsuffix=$(get_libdir | sed s/lib//)"
- fi
-
- export PATH="${KDEDIR}/bin:${PATH}"
-
- # The configure checks for kconfig_compiler do not respect PATH
- export KCONFIG_COMPILER="${KDEDIR}/bin/kconfig_compiler"
-
- # Sometimes it doesn't get the include and library paths right,
- # so hints them.
- if [[ -z ${PREFIX} || ${PREFIX} != ${KDEDIR} ]]; then
- myconf="${myconf} --with-extra-includes=${KDEDIR}/include
- --with-extra-libs=${KDEDIR}/$(get_libdir)"
- fi
-
- if grep "cope with newer libtools" "${KDE_S}/admin/ltconfig" &> /dev/null; then
- einfo "Removing the dummy ltconfig file."
- rm "${KDE_S}/admin/ltconfig"
- fi
-
- use elibc_FreeBSD && myconf="${myconf} --disable-pie"
-
- elibtoolize
- econf ${myconf}
-
- # Seems ./configure add -O2 by default but hppa don't want that but we need -ffunction-sections
- if [[ "${ARCH}" = "hppa" ]]
- then
- einfo "Fixing Makefiles"
- find "${KDE_S}" -name Makefile -print0 | xargs -0 sed -i -e \
- 's:-O2:-ffunction-sections:g'
- fi
- ;;
- all)
- debug-print-section all
- kde_src_configure myconf configure
- ;;
- esac
-
- shift
- done
-
-}
-# @FUNCTION: kde_src_compile
-# @USAGE: [ myconf ] [ configure ] [ make ] [ all ]
-# @DESCRIPTION:
-# This function compiles the sources. It takes care of "cannot write to .kde
-# or .qt"-problem due to sandbox and some other sandbox issues.
-#
-# If no argument is given, all is assumed.
-kde_src_compile() {
- debug-print-function $FUNCNAME "$@"
-
- [[ -z "$1" ]] && kde_src_compile all
-
- [[ -z "${KDE_S}" ]] && KDE_S="${S}"
- cd "${KDE_S}"
- while [[ "$1" ]]; do
- case $1 in
- make)
- debug-print-section make
- emake || die "died running emake, $FUNCNAME:make"
- ;;
- all)
- case ${EAPI:-0} in
- 0|1) kde_src_configure all ;;
- esac
- kde_src_compile make
- ;;
- *)
- case ${EAPI:-0} in
- 0|1) kde_src_configure $1 ;;
- esac
- ;;
- esac
-
- shift
- done
-}
-
-# @FUNCTION: kde_src_install
-# @USAGE: [ make ] [ dodoc ] [ all ]
-# @DESCRIPTION:
-# This installs the software, including the right handling of the
-# "/usr/share/doc/kde"-dir, but it only installs AUTHORS, ChangeLog*, README*,
-# NEWS, and TODO (if available) as docs.
-#
-# If no argument is given, all is assumed
-kde_src_install() {
- debug-print-function $FUNCNAME "$@"
-
- [[ -z "$1" ]] && kde_src_install all
-
- [[ -z ${KDE_S} ]] && KDE_S="${S}"
- cd "${KDE_S}"
-
- # Ensure that KDE binaries take precedence
- export PATH="${KDEDIR}/bin:${PATH}"
-
- while [[ "$1" ]]; do
-
- case $1 in
- make)
- debug-print-section make
- emake install DESTDIR="${D}" destdir="${D}" || die "died running make install, $FUNCNAME:make"
- ;;
- dodoc)
- debug-print-section dodoc
- for doc in AUTHORS ChangeLog* README* NEWS TODO; do
- [[ -s "$doc" ]] && dodoc $doc
- done
- ;;
- all)
- debug-print-section all
- kde_src_install make dodoc
- ;;
- esac
-
- shift
- done
-
- if [[ ${KDEBASE} == "true" && "${PN}" != "arts" && -d "${D}"/usr/share/doc/${PF} ]]; then
- # work around bug #97196
- dodir /usr/share/doc/kde && \
- mv "${D}"/usr/share/doc/${PF} "${D}"/usr/share/doc/kde/ || \
- die "Failed to move docs to kde/ failed."
- fi
-}
-
-# @FUNCTION: slot_rebuild
-# @USAGE: [ list_of_packages_to_check ]
-# @RETURN: False, if no rebuild is required
-# @DESCRIPTION:
-# Unneeded and therefore deprecated for a long, long time now. Ebuilds are still
-# referencing it, so replacing with a stub.
-# Looks for packages in the supplied list of packages which have not been linked
-# against this kde SLOT. It does this by looking for lib*.la files that doesn't
-# contain the current ${KDEDIR}. If it finds any thus broken packages it prints
-# eerrors and return True.
-#
-# Thanks to Carsten Lohrke in bug 98425.
-slot_rebuild() {
- :
-}
-
-# @FUNCTION: kde_pkg_preinst
-# @DESCRIPTION:
-# Calls postprocess_desktop_entries
-kde_pkg_preinst() {
- postprocess_desktop_entries
-}
-
-# @FUNCTION: kde_pkg_postinst
-# @DESCRIPTION:
-# Calls buildsycoca
-kde_pkg_postinst() {
- buildsycoca
-}
-
-# @FUNCTION: kde_pkg_postrm
-# @DESCRIPTION:
-# Calls buildsycoca
-kde_pkg_postrm() {
- buildsycoca
-}
-
-case ${EAPI:-0} in
- 0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_postrm pkg_preinst;;
- 2|3|4|5) EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_postinst pkg_postrm pkg_preinst;;
-esac
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-11-30 2:19 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-11-30 2:19 UTC (permalink / raw
To: gentoo-commits
commit: 942b00d6540855fb49858f2d983ce5c6b5535b14
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 30 02:15:31 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Nov 30 02:19:18 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=942b00d6
poppler.eclass: Remove unused eclass
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/poppler.eclass | 197 --------------------------------------------------
1 file changed, 197 deletions(-)
diff --git a/eclass/poppler.eclass b/eclass/poppler.eclass
deleted file mode 100644
index 5ca760e1..00000000
--- a/eclass/poppler.eclass
+++ /dev/null
@@ -1,197 +0,0 @@
-# Copyright 1999-2009 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/Attic/poppler.eclass,v 1.6 2010/01/03 19:10:49 scarabeus Exp $
-
-# @ECLASS: poppler.eclass
-# @MAINTAINER:
-# Peter Alfredsen <loki_val@gentoo.org>
-# @BLURB: Reduces code duplication in the modularized poppler ebuilds.
-# @DESCRIPTION:
-# Provides an easy template for making modularized poppler-based ebuilds.
-
-inherit base multilib libtool
-
-has 2 ${EAPI} || DEPEND="EAPI-TOO-OLD"
-
-EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
-
-RDEPEND="
- !app-text/poppler
- !app-text/poppler-bindings
- "
-DEPEND="
- virtual/pkgconfig
- userland_GNU? ( >=sys-apps/findutils-4.4.0 )
- "
-
-
-# @ECLASS-VARIABLE: HOMEPAGE
-# @DESCRIPTION:
-# Default HOMEPAGE
-HOMEPAGE="http://poppler.freedesktop.org/"
-
-# @ECLASS-VARIABLE: SRC_URI
-# @DESCRIPTION:
-# Default SRC_URI
-SRC_URI="http://poppler.freedesktop.org/poppler-${PV}.tar.gz"
-
-# @ECLASS-VARIABLE: S
-# @DESCRIPTION:
-# Default working directory
-S=${WORKDIR}/poppler-${PV}
-
-# @ECLASS-VARIABLE: POPPLER_MODULE
-# @DESCRIPTION:
-# The name of the poppler module. Must be set by the ebuild before inheriting
-# the poppler eclass.
-POPPLER_MODULE=${POPPLER_MODULE}
-
-# @ECLASS-VARIABLE: POPPLER_MODULE_S
-# @DESCRIPTION:
-# The working directory of the poppler module.
-POPPLER_MODULE_S=${S}/${POPPLER_MODULE}
-
-# @FUNCTION: pkg_check_modules_override
-# @USAGE: <GROUP> [package1] [package2]
-# @DESCRIPTION:
-# Will export the appropriate variables to override PKG_CHECK_MODULES autoconf
-# macros, with the string " " by default. If packages are specified, they will
-# be looked up with pkg-config and the appropriate LIBS and CFLAGS substituted.
-# LIBS and CFLAGS can also be specified per-package with the following syntax:
-# @CODE
-# package=LIBS%CFLAGS
-# @CODE
-# = and % have no effect unless both are specified.
-# Here is an example:
-# @CODE
-# pkg_check_modules_override GASH "gtk+-2.0=-jule%" gobject-2.0
-# @CODE
-# The above example will do:
-# @CODE
-# export GASH_CFLAGS+=" -jule"
-# export GASH_LIBS+=" "
-# export GASH_CFLAGS+=" $(pkg-config --cflags gobject-2.0)"
-# export GASH_LIBS+=" $(pkg-config --libs gobject-2.0)"
-# @CODE
-#
-# NOTE: If a package is not found, the string " " will be inserted in place of
-# <GROUP>_CFLAGS and <GROUP>_LIBS
-pkg_check_modules_override() {
- local package
- local group="${1}"
- local packages="${*:2}"
- export ${group}_CFLAGS=" "
- export ${group}_LIBS=" "
-
- if [[ ${#@} -lt 1 ]]
- then
- eerror "${FUNCNAME[0]} requires at least one parameter: GROUP"
- eerror "PKG_CHECK_MODULES(GROUP, package1 package2 etc)"
- die "${FUNCNAME[0]} requires at least one parameter: GROUP"
- fi
-
- for package in $packages
- do
- if [[ ${package/=} != ${package} && ${package/\%} != ${package} ]]
- then
- package_cflag_libs=${package##*=}
- export ${group}_CFLAGS+=" ${package_cflag_libs%%\%*}"
- export ${group}_LIBS+=" ${package_cflag_libs##*\%}"
- else
- if pkg-config --exists $package
- then
- export ${group}_CFLAGS+=" $(pkg-config --cflags $package)"
- export ${group}_LIBS+=" $(pkg-config --libs $package)"
- else
- export ${group}_CFLAGS+=" "
- export ${group}_LIBS+=" "
- fi
- fi
- done
-}
-# @FUNCTION: poppler_src_unpack
-# @USAGE:
-# @DESCRIPTION:
-# Runs unpack ${A}
-poppler_src_unpack() {
- unpack ${A}
-}
-
-# @FUNCTION: poppler_src_prepare
-# @USAGE:
-# @DESCRIPTION:
-# Runs autopatch from base.eclass.
-# Uses sed to replace libpoppler.la references with -lpoppler
-poppler_src_prepare() {
- base_src_prepare
- sed -i \
- -e 's#$(top_builddir)/poppler/libpoppler.la#-lpoppler#' \
- $(find . -type f -name 'Makefile.in') || die "Failed to sed proper lib into Makefile.am"
- elibtoolize
-}
-
-# @FUNCTION: poppler_src_configure
-# @USAGE:
-# @DESCRIPTION:
-# Makes sure we get a uniform Makefile environment by using pkg_check_modules_override to
-# fill out some blanks that configure wants filled. Probably not really needed, but
-# insures against future breakage.
-# Calls econf with some defaults.
-poppler_src_configure() {
- pkg_check_modules_override CAIRO cairo
- pkg_check_modules_override POPPLER_GLIB glib-2.0
- pkg_check_modules_override POPPLER_QT4 QtCore QtGui QtXml
- pkg_check_modules_override POPPLER_QT4_TEST QtTest
- pkg_check_modules_override ABIWORD libxml-2.0
- pkg_check_modules_override GTK_TEST gtk+-2.0 gdk-pixbuf-2.0 libglade-2.0 gthread-2.0
- pkg_check_modules_override POPPLER_GLIB glib-2.0 gobject-2.0
-
- econf --disable-static \
- --enable-poppler-qt4 \
- --enable-poppler-glib \
- --enable-xpdf-headers \
- --enable-libjpeg \
- --enable-libopenjpeg \
- --enable-zlib \
- --enable-splash-output \
- ${POPPLER_CONF}
-}
-
-# @FUNCTION: poppler_src_compile
-# @USAGE:
-# @DESCRIPTION:
-# Removes top_srcdir Makefile to ensure that no accidental recursion happens. The build
-# will just die if it tries to go through top_srcdir.
-# Runs emake "$@" in POPPLER_MODULE_S
-poppler_src_compile() {
- rm -f "${S}"/Makefile* &> /dev/null
- cd "${POPPLER_MODULE_S}" || die "POPPLER_MODULE_S=${POPPLER_MODULE_S} - cd failed"
- einfo "Now in $POPPLER_MODULE_S"
- emake "$@" || die "emake failed"
-}
-
-# @FUNCTION: poppler_src_install
-# @USAGE:
-# @DESCRIPTION:
-# Runs emake DESTDIR="${D}" ${@:-install} in POPPLER_MODULE_S
-# Removes .la files.
-poppler_src_install() {
- cd "${POPPLER_MODULE_S}"
- emake DESTDIR="${D}" ${@:-install} || die "make install failed"
- for pfile in "${POPPLER_PKGCONFIG[@]}"
- do
- insinto /usr/$(get_libdir)/pkgconfig
- if [[ ${pfile/=} != ${pfile} ]]
- then
- if use ${pfile%=*}
- then
- pfile=${pfile#*=}
- else
- pfile=false
- fi
- fi
- [[ ${pfile} != "false" ]] && doins "${S}/${pfile}"
- done
-
- find "${D}" -type f -name '*.la' -exec rm -rf '{}' '+' || die "la removal failed"
-}
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-11-30 2:19 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-11-30 2:19 UTC (permalink / raw
To: gentoo-commits
commit: 8122eeeaf6dc061b64eb41f64ebfcce1e3a2a6db
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 30 02:15:58 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Nov 30 02:19:18 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=8122eeea
sgml-catalog.eclass: Remove unused eclass
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/sgml-catalog.eclass | 106 ---------------------------------------------
1 file changed, 106 deletions(-)
diff --git a/eclass/sgml-catalog.eclass b/eclass/sgml-catalog.eclass
deleted file mode 100644
index 17940767..00000000
--- a/eclass/sgml-catalog.eclass
+++ /dev/null
@@ -1,106 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @DEAD
-# All consumers are gone. Removal in 14 days
-
-# @ECLASS: sgml-catalog.eclass
-# @MAINTAINER:
-# kde-sunset overlay maintainers
-# @AUTHOR:
-# Author Matthew Turk <satai@gentoo.org>
-# @BLURB: Functions for installing SGML catalogs
-
-case ${EAPI:-0} in
- 0|1|2|3|4|5) inherit base ;;
- *) ;;
-esac
-
-DEPEND=">=app-text/sgml-common-0.6.3-r2"
-
-# @ECLASS-VARIABLE: SGML_TOINSTALL
-# @DESCRIPTION:
-# An array of catalogs, arranged in pairs.
-# Each pair consists of a centralized catalog followed by an ordinary catalog.
-SGML_TOINSTALL=()
-
-# @FUNCTION: sgml-catalog_cat_include
-# @USAGE: <centralized catalog> <ordinary catalog>
-# @DESCRIPTION:
-# Appends a catalog pair to the SGML_TOINSTALL array.
-sgml-catalog_cat_include() {
- debug-print function $FUNCNAME $*
- SGML_TOINSTALL+=("$1" "$2")
-}
-
-# @FUNCTION: sgml-catalog_cat_doinstall
-# @USAGE: <centralized catalog> <ordinary catalog>
-# @DESCRIPTION:
-# Adds an ordinary catalog to a centralized catalog.
-sgml-catalog_cat_doinstall() {
- debug-print function $FUNCNAME $*
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
- "${EPREFIX}"/usr/bin/install-catalog --add "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
-}
-
-# @FUNCTION: sgml-catalog_cat_doremove
-# @USAGE: <centralized catalog> <ordinary catalog>
-# @DESCRIPTION:
-# Removes an ordinary catalog from a centralized catalog.
-sgml-catalog_cat_doremove() {
- debug-print function $FUNCNAME $*
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
- "${EPREFIX}"/usr/bin/install-catalog --remove "${EPREFIX}$1" "${EPREFIX}$2" &>/dev/null
-}
-
-sgml-catalog_pkg_postinst() {
- debug-print function $FUNCNAME $*
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
-
- set -- "${SGML_TOINSTALL[@]}"
-
- while (( $# )); do
- if [[ ! -e "${EPREFIX}$2" ]]; then
- ewarn "${EPREFIX}$2 doesn't appear to exist, although it ought to!"
- shift 2
- continue
- fi
- einfo "Now adding ${EPREFIX}$2 to ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
- sgml-catalog_cat_doinstall "$1" "$2"
- shift 2
- done
- sgml-catalog_cleanup
-}
-
-sgml-catalog_pkg_prerm() {
- sgml-catalog_cleanup
-}
-
-sgml-catalog_pkg_postrm() {
- debug-print function $FUNCNAME $*
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
-
- set -- "${SGML_TOINSTALL[@]}"
-
- while (( $# )); do
- einfo "Now removing ${EPREFIX}$2 from ${EPREFIX}$1 and ${EPREFIX}/etc/sgml/catalog"
- sgml-catalog_cat_doremove "$1" "$2"
- shift 2
- done
-}
-
-sgml-catalog_cleanup() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
- if [ -e "${EPREFIX}/usr/bin/gensgmlenv" ]
- then
- einfo Regenerating SGML environment variables ...
- gensgmlenv
- grep -v export "${EPREFIX}/etc/sgml/sgml.env" > "${EPREFIX}/etc/env.d/93sgmltools-lite"
- fi
-}
-
-sgml-catalog_src_compile() {
- return
-}
-
-EXPORT_FUNCTIONS pkg_postrm pkg_postinst src_compile pkg_prerm
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-11-30 2:19 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-11-30 2:19 UTC (permalink / raw
To: gentoo-commits
commit: 6d7881369e19832193b6cb62474e75ddc2aff764
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 30 02:15:46 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Nov 30 02:19:18 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=6d788136
perl-app.eclass: Remove unused eclass
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/perl-app.eclass | 53 --------------------------------------------------
1 file changed, 53 deletions(-)
diff --git a/eclass/perl-app.eclass b/eclass/perl-app.eclass
deleted file mode 100644
index e0131cca..00000000
--- a/eclass/perl-app.eclass
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @DEAD
-# This eclass is dead and all its consumers have been removed from
-# the tree.
-# Please use perl-module.eclass if you need phase functions, and
-# perl-functions.eclass if you don't.
-# In overlays, perl-app.eclass usage can be replaced by
-# perl-module.eclass without further changes.
-# Bug 637836. Removal in 14 days.
-
-# Author: Michael Cummings <mcummings@gentoo.org>
-# @MAINTAINER:
-# kde-sunset overlay maintainers
-# @SUPPORTED_EAPIS: 5
-
-# If the ebuild doesn't override this, ensure we do not depend on the perl subslot value
-: ${GENTOO_DEPEND_ON_PERL_SUBSLOT:="no"}
-inherit perl-module
-
-case "${EAPI:-0}" in
- 5)
- ;;
- 6)
- die "EAPI=${EAPI} is not supported by perl-app.eclass. Please use perl-module.eclass instead."
- ;;
- *)
- die "EAPI=${EAPI} is not supported by perl-app.eclass"
- ;;
-esac
-
-# @FUNCTION: perl-app_src_prep
-# @DESCRIPTION:
-# This is a wrapper function to perl-app_src_configure().
-perl-app_src_prep() {
- perl-app_src_configure
-}
-
-# @FUNCTION: perl-app_src_configure
-# @DESCRIPTION:
-# This is a wrapper function to perl-module_src_configure().
-perl-app_src_configure() {
- perl-module_src_configure
-}
-
-# @FUNCTION: perl-app_src_compile
-# @DESCRIPTION:
-# This is a wrapper function to perl-module_src_compile().
-perl-app_src_compile() {
- has "${EAPI:-0}" 0 1 && perl-app_src_prep
- perl-module_src_compile
-}
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2020-12-07 20:53 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2020-12-07 20:53 UTC (permalink / raw
To: gentoo-commits
commit: 1f5df4ea9a033075140bf03eab94489dc44f5b2c
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 7 20:38:07 2020 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Dec 7 20:52:47 2020 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=1f5df4ea
qt4-r2.eclass: Remove unused eclass
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/qt4-r2.eclass | 139 ---------------------------------------------------
1 file changed, 139 deletions(-)
diff --git a/eclass/qt4-r2.eclass b/eclass/qt4-r2.eclass
deleted file mode 100644
index d8a72529..00000000
--- a/eclass/qt4-r2.eclass
+++ /dev/null
@@ -1,139 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: qt4-r2.eclass
-# @MAINTAINER:
-# qt@gentoo.org
-# @BLURB: Eclass for Qt4-based packages, second edition.
-# @DESCRIPTION:
-# This eclass contains various functions that may be useful when
-# dealing with packages using Qt4 libraries. Supports only EAPIs
-# 2, 3, 4, and 5. Use qmake-utils.eclass in EAPI 6 and later.
-
-case ${EAPI} in
- 2|3|4|5) : ;;
- 6) die "qt4-r2.eclass is banned in EAPI 6 and later" ;;
- *) die "qt4-r2.eclass: unsupported EAPI=${EAPI:-0}" ;;
-esac
-
-inherit base eutils qmake-utils
-
-export XDG_CONFIG_HOME="${T}"
-
-# @ECLASS-VARIABLE: DOCS
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Array containing documents passed to dodoc command.
-# Paths can be absolute or relative to ${S}.
-#
-# Example: DOCS=( ChangeLog README "${WORKDIR}/doc_folder/" )
-
-# @ECLASS-VARIABLE: HTML_DOCS
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Array containing documents passed to dohtml command.
-# Paths can be absolute or relative to ${S}.
-#
-# Example: HTML_DOCS=( "doc/document.html" "${WORKDIR}/html_folder/" )
-
-# @ECLASS-VARIABLE: LANGS
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# In case your Qt4 application provides various translations, use this variable
-# to specify them in order to populate "linguas_*" IUSE automatically. Make sure
-# that you set this variable before inheriting qt4-r2 eclass.
-#
-# Example: LANGS="de el it ja"
-for x in ${LANGS}; do
- IUSE+=" linguas_${x}"
-done
-
-# @ECLASS-VARIABLE: LANGSLONG
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Same as LANGS, but this variable is for LINGUAS that must be in long format.
-# Remember to set this variable before inheriting qt4-r2 eclass.
-# Look at ${PORTDIR}/profiles/desc/linguas.desc for details.
-#
-# Example: LANGSLONG="en_GB ru_RU"
-for x in ${LANGSLONG}; do
- IUSE+=" linguas_${x%_*}"
-done
-unset x
-
-# @ECLASS-VARIABLE: PATCHES
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Array variable containing all the patches to be applied. This variable
-# is expected to be defined in the global scope of ebuilds. Make sure to
-# specify the full path. This variable is used in src_prepare phase.
-#
-# Example:
-# @CODE
-# PATCHES=(
-# "${FILESDIR}/mypatch.patch"
-# "${FILESDIR}/mypatch2.patch"
-# )
-# @CODE
-
-# @FUNCTION: qt4-r2_src_unpack
-# @DESCRIPTION:
-# Default src_unpack function for packages that depend on qt4. If you have to
-# override src_unpack in your ebuild (probably you don't need to), call
-# qt4-r2_src_unpack in it.
-qt4-r2_src_unpack() {
- debug-print-function $FUNCNAME "$@"
-
- base_src_unpack "$@"
-}
-
-# @FUNCTION: qt4-r2_src_prepare
-# @DESCRIPTION:
-# Default src_prepare function for packages that depend on qt4. If you have to
-# override src_prepare in your ebuild, you should call qt4-r2_src_prepare in it,
-# otherwise autopatcher will not work!
-qt4-r2_src_prepare() {
- debug-print-function $FUNCNAME "$@"
-
- base_src_prepare "$@"
-}
-
-# @FUNCTION: qt4-r2_src_configure
-# @DESCRIPTION:
-# Default src_configure function for packages that depend on qt4. If you have to
-# override src_configure in your ebuild, call qt4-r2_src_configure in it.
-qt4-r2_src_configure() {
- debug-print-function $FUNCNAME "$@"
-
- local project_file=$(qmake-utils_find_pro_file)
-
- if [[ -n ${project_file} ]]; then
- eqmake4 "${project_file}"
- else
- base_src_configure "$@"
- fi
-}
-
-# @FUNCTION: qt4-r2_src_compile
-# @DESCRIPTION:
-# Default src_compile function for packages that depend on qt4. If you have to
-# override src_compile in your ebuild (probably you don't need to), call
-# qt4-r2_src_compile in it.
-qt4-r2_src_compile() {
- debug-print-function $FUNCNAME "$@"
-
- base_src_compile "$@"
-}
-
-# @FUNCTION: qt4-r2_src_install
-# @DESCRIPTION:
-# Default src_install function for qt4-based packages. Installs compiled code,
-# and documentation (via DOCS and HTML_DOCS variables).
-qt4-r2_src_install() {
- debug-print-function $FUNCNAME "$@"
-
- base_src_install INSTALL_ROOT="${D}" "$@"
- einstalldocs
-}
-
-EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2021-04-27 15:48 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2021-04-27 15:48 UTC (permalink / raw
To: gentoo-commits
commit: 338dea7d22df497b7cba8a1b13f1f30ae6ac9b84
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 27 14:40:31 2021 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Apr 27 15:09:24 2021 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=338dea7d
python.eclass: Drop unused eclass
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/python.eclass | 3167 --------------------------------------------------
1 file changed, 3167 deletions(-)
diff --git a/eclass/python.eclass b/eclass/python.eclass
deleted file mode 100644
index 718c040a..00000000
--- a/eclass/python.eclass
+++ /dev/null
@@ -1,3167 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# @DEAD
-# Removal on 2017-03-21.
-
-# @ECLASS: python.eclass
-# @MAINTAINER:
-# kde-sunset overlay maintainers
-# @BLURB: Eclass for Python packages
-# @DESCRIPTION:
-# The python eclass contains miscellaneous, useful functions for Python packages.
-#
-# This eclass is DEPRECATED. Please use python-r1, python-single-r1
-# or python-any-r1 instead.
-
-if [[ ${EAPI} == 6 ]]; then
- die "${ECLASS}.eclass is banned in EAPI ${EAPI}"
-fi
-
-if [[ ${_PYTHON_UTILS_R1} ]]; then
- die 'python.eclass can not be used with python-r1 suite eclasses.'
-fi
-
-# Must call inherit before EXPORT_FUNCTIONS to avoid QA warning.
-if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
- inherit multilib
-fi
-
-# Export pkg_setup every time to avoid issues with eclass inheritance order.
-if ! has "${EAPI:-0}" 0 1 2 3 || { has "${EAPI:-0}" 2 3 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; }; then
- EXPORT_FUNCTIONS pkg_setup
-fi
-
-# Avoid processing this eclass more than once.
-if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
-_PYTHON_ECLASS_INHERITED="1"
-
-if ! has "${EAPI:-0}" 0 1 2 3 4 5; then
- die "API of python.eclass in EAPI=\"${EAPI}\" not established"
-fi
-
-# Please do not add any new versions of Python here! Instead, please
-# focus on converting packages to use the new eclasses.
-
-_CPYTHON2_GLOBALLY_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7)
-_CPYTHON3_GLOBALLY_SUPPORTED_ABIS=(3.1 3.2 3.3)
-_JYTHON_GLOBALLY_SUPPORTED_ABIS=(2.5-jython 2.7-jython)
-_PYPY_GLOBALLY_SUPPORTED_ABIS=(2.7-pypy-1.7 2.7-pypy-1.8 2.7-pypy-1.9 2.7-pypy-2.0)
-_PYTHON_GLOBALLY_SUPPORTED_ABIS=(${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]} ${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]} ${_JYTHON_GLOBALLY_SUPPORTED_ABIS[@]} ${_PYPY_GLOBALLY_SUPPORTED_ABIS[@]})
-
-# ================================================================================================
-# ===================================== HANDLING OF METADATA =====================================
-# ================================================================================================
-
-_PYTHON_ABI_PATTERN_REGEX="([[:alnum:]]|\.|-|\*|\[|\])+"
-
-_python_check_python_abi_matching() {
- local pattern patterns patterns_list="0" PYTHON_ABI
-
- while (($#)); do
- case "$1" in
- --patterns-list)
- patterns_list="1"
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- if [[ "$#" -ne 2 ]]; then
- die "${FUNCNAME}() requires 2 arguments"
- fi
-
- PYTHON_ABI="$1"
-
- if [[ "${patterns_list}" == "0" ]]; then
- pattern="$2"
-
- if [[ "${pattern}" == *"-cpython" ]]; then
- [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ && "${PYTHON_ABI}" == ${pattern%-cpython} ]]
- elif [[ "${pattern}" == *"-jython" ]]; then
- [[ "${PYTHON_ABI}" == ${pattern} ]]
- elif [[ "${pattern}" == *"-pypy-"* ]]; then
- [[ "${PYTHON_ABI}" == ${pattern} ]]
- else
- if [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
- [[ "${PYTHON_ABI}" == ${pattern} ]]
- elif [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
- [[ "${PYTHON_ABI%-jython}" == ${pattern} ]]
- elif [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-pypy-[[:digit:]]+\.[[:digit:]]+$ ]]; then
- [[ "${PYTHON_ABI%-pypy-*}" == ${pattern} ]]
- else
- die "${FUNCNAME}(): Unrecognized Python ABI '${PYTHON_ABI}'"
- fi
- fi
- else
- patterns="${2// /$'\n'}"
-
- while read pattern; do
- if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
- return 0
- fi
- done <<< "${patterns}"
-
- return 1
- fi
-}
-
-_python_implementation() {
- if [[ "${CATEGORY}/${PN}" == "dev-lang/python" ]]; then
- return 0
- elif [[ "${CATEGORY}/${PN}" == "dev-java/jython" ]]; then
- return 0
- elif [[ "${CATEGORY}/${PN}" == "virtual/pypy" ]]; then
- return 0
- else
- return 1
- fi
-}
-
-_python_package_supporting_installation_for_multiple_python_abis() {
- [[ -n "${SUPPORT_PYTHON_ABIS}" ]]
-}
-
-# @ECLASS-VARIABLE: PYTHON_DEPEND
-# @DESCRIPTION:
-# Specification of dependency on dev-lang/python.
-# Syntax:
-# PYTHON_DEPEND: [[!]USE_flag? ]<version_components_group>[ version_components_group]
-# version_components_group: <major_version[:[minimal_version][:maximal_version]]>
-# major_version: <2|3|*>
-# minimal_version: <minimal_major_version.minimal_minor_version>
-# maximal_version: <maximal_major_version.maximal_minor_version>
-
-_python_parse_PYTHON_DEPEND() {
- local major_version maximal_version minimal_version python_all="0" python_maximal_version python_minimal_version python_versions=() python2="0" python2_maximal_version python2_minimal_version python3="0" python3_maximal_version python3_minimal_version USE_flag= version_components_group version_components_group_regex version_components_groups
-
- version_components_group_regex="(2|3|\*)(:([[:digit:]]+\.[[:digit:]]+)?(:([[:digit:]]+\.[[:digit:]]+)?)?)?"
- version_components_groups="${PYTHON_DEPEND}"
-
- if [[ "${version_components_groups}" =~ ^((\!)?[[:alnum:]_-]+\?\ )?${version_components_group_regex}(\ ${version_components_group_regex})?$ ]]; then
- if [[ "${version_components_groups}" =~ ^(\!)?[[:alnum:]_-]+\? ]]; then
- USE_flag="${version_components_groups%\? *}"
- version_components_groups="${version_components_groups#* }"
- fi
- if [[ "${version_components_groups}" =~ ("*".*" "|" *"|^2.*\ (2|\*)|^3.*\ (3|\*)) ]]; then
- die "Invalid syntax of PYTHON_DEPEND: Incorrectly specified groups of versions"
- fi
-
- version_components_groups="${version_components_groups// /$'\n'}"
- while read version_components_group; do
- major_version="${version_components_group:0:1}"
- minimal_version="${version_components_group:2}"
- minimal_version="${minimal_version%:*}"
- maximal_version="${version_components_group:$((3 + ${#minimal_version}))}"
-
- if [[ "${major_version}" =~ ^(2|3)$ ]]; then
- if [[ -n "${minimal_version}" && "${major_version}" != "${minimal_version:0:1}" ]]; then
- die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' not in specified group of versions"
- fi
- if [[ -n "${maximal_version}" && "${major_version}" != "${maximal_version:0:1}" ]]; then
- die "Invalid syntax of PYTHON_DEPEND: Maximal version '${maximal_version}' not in specified group of versions"
- fi
- fi
-
- if [[ "${major_version}" == "2" ]]; then
- python2="1"
- python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}")
- python2_minimal_version="${minimal_version}"
- python2_maximal_version="${maximal_version}"
- elif [[ "${major_version}" == "3" ]]; then
- python3="1"
- python_versions=("${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
- python3_minimal_version="${minimal_version}"
- python3_maximal_version="${maximal_version}"
- else
- python_all="1"
- python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
- python_minimal_version="${minimal_version}"
- python_maximal_version="${maximal_version}"
- fi
-
- if [[ -n "${minimal_version}" ]] && ! has "${minimal_version}" "${python_versions[@]}"; then
- die "Invalid syntax of PYTHON_DEPEND: Unrecognized minimal version '${minimal_version}'"
- fi
- if [[ -n "${maximal_version}" ]] && ! has "${maximal_version}" "${python_versions[@]}"; then
- die "Invalid syntax of PYTHON_DEPEND: Unrecognized maximal version '${maximal_version}'"
- fi
-
- if [[ -n "${minimal_version}" && -n "${maximal_version}" && "${minimal_version}" > "${maximal_version}" ]]; then
- die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' greater than maximal version '${maximal_version}'"
- fi
- done <<< "${version_components_groups}"
-
- _PYTHON_ATOMS=()
-
- _append_accepted_versions_range() {
- local accepted_version="0" i
- for ((i = "${#python_versions[@]}"; i >= 0; i--)); do
- if [[ "${python_versions[${i}]}" == "${python_maximal_version}" ]]; then
- accepted_version="1"
- fi
- if [[ "${accepted_version}" == "1" ]]; then
- _PYTHON_ATOMS+=("=dev-lang/python-${python_versions[${i}]}*")
- fi
- if [[ "${python_versions[${i}]}" == "${python_minimal_version}" ]]; then
- accepted_version="0"
- fi
- done
- }
-
- if [[ "${python_all}" == "1" ]]; then
- if [[ -z "${python_minimal_version}" && -z "${python_maximal_version}" ]]; then
- _PYTHON_ATOMS+=("dev-lang/python")
- else
- python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
- python_minimal_version="${python_minimal_version:-${python_versions[0]}}"
- python_maximal_version="${python_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
- _append_accepted_versions_range
- fi
- else
- if [[ "${python3}" == "1" ]]; then
- if [[ -z "${python3_minimal_version}" && -z "${python3_maximal_version}" ]]; then
- _PYTHON_ATOMS+=("=dev-lang/python-3*")
- else
- python_versions=("${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}")
- python_minimal_version="${python3_minimal_version:-${python_versions[0]}}"
- python_maximal_version="${python3_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
- _append_accepted_versions_range
- fi
- fi
- if [[ "${python2}" == "1" ]]; then
- if [[ -z "${python2_minimal_version}" && -z "${python2_maximal_version}" ]]; then
- _PYTHON_ATOMS+=("=dev-lang/python-2*")
- else
- python_versions=("${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}")
- python_minimal_version="${python2_minimal_version:-${python_versions[0]}}"
- python_maximal_version="${python2_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
- _append_accepted_versions_range
- fi
- fi
- fi
-
- unset -f _append_accepted_versions_range
-
- if [[ "${#_PYTHON_ATOMS[@]}" -gt 1 ]]; then
- DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}"
- RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}"
- else
- DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}"
- RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}"
- fi
- else
- die "Invalid syntax of PYTHON_DEPEND"
- fi
-}
-
-if _python_implementation; then
- DEPEND=">=app-eselect/eselect-python-20091230"
- RDEPEND="${DEPEND}"
- PDEPEND="app-admin/python-updater"
-fi
-
-if [[ -n "${PYTHON_DEPEND}" ]]; then
- _python_parse_PYTHON_DEPEND
-else
- _PYTHON_ATOMS=("dev-lang/python")
-fi
-unset -f _python_parse_PYTHON_DEPEND
-
-if [[ -n "${NEED_PYTHON}" ]]; then
- eerror "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
- die "NEED_PYTHON variable is banned"
-fi
-
-# @ECLASS-VARIABLE: PYTHON_USE_WITH
-# @DESCRIPTION:
-# Set this to a space separated list of USE flags the Python slot in use must be built with.
-
-# @ECLASS-VARIABLE: PYTHON_USE_WITH_OR
-# @DESCRIPTION:
-# Set this to a space separated list of USE flags of which one must be turned on for the slot in use.
-
-# @ECLASS-VARIABLE: PYTHON_USE_WITH_OPT
-# @DESCRIPTION:
-# Set this to a name of a USE flag if you need to make either PYTHON_USE_WITH or
-# PYTHON_USE_WITH_OR atoms conditional under a USE flag.
-
-if ! has "${EAPI:-0}" 0 1 && [[ -n ${PYTHON_USE_WITH} || -n ${PYTHON_USE_WITH_OR} ]]; then
- _PYTHON_USE_WITH_ATOMS_ARRAY=()
- if [[ -n "${PYTHON_USE_WITH}" ]]; then
- for _PYTHON_ATOM in "${_PYTHON_ATOMS[@]}"; do
- _PYTHON_USE_WITH_ATOMS_ARRAY+=("${_PYTHON_ATOM}[${PYTHON_USE_WITH// /,}]")
- done
- elif [[ -n "${PYTHON_USE_WITH_OR}" ]]; then
- for _USE_flag in ${PYTHON_USE_WITH_OR}; do
- for _PYTHON_ATOM in "${_PYTHON_ATOMS[@]}"; do
- _PYTHON_USE_WITH_ATOMS_ARRAY+=("${_PYTHON_ATOM}[${_USE_flag}]")
- done
- done
- unset _USE_flag
- fi
- if [[ "${#_PYTHON_USE_WITH_ATOMS_ARRAY[@]}" -gt 1 ]]; then
- _PYTHON_USE_WITH_ATOMS="|| ( ${_PYTHON_USE_WITH_ATOMS_ARRAY[@]} )"
- else
- _PYTHON_USE_WITH_ATOMS="${_PYTHON_USE_WITH_ATOMS_ARRAY[@]}"
- fi
- if [[ -n "${PYTHON_USE_WITH_OPT}" ]]; then
- _PYTHON_USE_WITH_ATOMS="${PYTHON_USE_WITH_OPT}? ( ${_PYTHON_USE_WITH_ATOMS} )"
- fi
- DEPEND+="${DEPEND:+ }${_PYTHON_USE_WITH_ATOMS}"
- RDEPEND+="${RDEPEND:+ }${_PYTHON_USE_WITH_ATOMS}"
- unset _PYTHON_ATOM _PYTHON_USE_WITH_ATOMS _PYTHON_USE_WITH_ATOMS_ARRAY
-fi
-
-unset _PYTHON_ATOMS
-
-# ================================================================================================
-# =================================== MISCELLANEOUS FUNCTIONS ====================================
-# ================================================================================================
-
-_python_abi-specific_local_scope() {
- [[ " ${FUNCNAME[@]:2} " =~ " "(_python_final_sanity_checks|python_execute_function|python_mod_optimize|python_mod_cleanup)" " ]]
-}
-
-_python_initialize_prefix_variables() {
- if has "${EAPI:-0}" 0 1 2; then
- if [[ -n "${ROOT}" && -z "${EROOT}" ]]; then
- EROOT="${ROOT%/}${EPREFIX}/"
- fi
- if [[ -n "${D}" && -z "${ED}" ]]; then
- ED="${D%/}${EPREFIX}/"
- fi
- fi
-}
-
-unset PYTHON_SANITY_CHECKS_EXECUTED PYTHON_SKIP_SANITY_CHECKS
-
-_python_initial_sanity_checks() {
- :
-}
-
-_python_final_sanity_checks() {
- if ! _python_implementation && [[ "$(declare -p PYTHON_SANITY_CHECKS_EXECUTED 2> /dev/null)" != "declare -- PYTHON_SANITY_CHECKS_EXECUTED="* || " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " && -z "${PYTHON_SKIP_SANITY_CHECKS}" ]]; then
- local PYTHON_ABI="${PYTHON_ABI}"
- for PYTHON_ABI in ${PYTHON_ABIS-${PYTHON_ABI}}; do
- # Ensure that appropriate version of Python is installed.
- if ! has_version "$(python_get_implementational_package)"; then
- die "$(python_get_implementational_package) is not installed"
- fi
-
- # Ensure that EPYTHON variable is respected.
- if [[ "$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")" != "${PYTHON_ABI}" ]]; then
- eerror "Path to 'python': '$(type -p python)'"
- eerror "ABI: '${ABI}'"
- eerror "DEFAULT_ABI: '${DEFAULT_ABI}'"
- eerror "EPYTHON: '$(PYTHON)'"
- eerror "PYTHON_ABI: '${PYTHON_ABI}'"
- eerror "Locally active version of Python: '$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")'"
- die "'python' does not respect EPYTHON variable"
- fi
- done
- fi
- PYTHON_SANITY_CHECKS_EXECUTED="1"
-}
-
-# @ECLASS-VARIABLE: PYTHON_COLORS
-# @DESCRIPTION:
-# User-configurable colored output.
-PYTHON_COLORS="${PYTHON_COLORS:-0}"
-
-_python_set_color_variables() {
- if [[ "${PYTHON_COLORS}" != "0" && "${NOCOLOR:-false}" =~ ^(false|no)$ ]]; then
- _BOLD=$'\e[1m'
- _RED=$'\e[1;31m'
- _GREEN=$'\e[1;32m'
- _BLUE=$'\e[1;34m'
- _CYAN=$'\e[1;36m'
- _NORMAL=$'\e[0m'
- else
- _BOLD=
- _RED=
- _GREEN=
- _BLUE=
- _CYAN=
- _NORMAL=
- fi
-}
-
-_python_check_python_pkg_setup_execution() {
- [[ " ${FUNCNAME[@]:1} " =~ " "(python_set_active_version|python_pkg_setup)" " ]] && return
-
- if ! has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_PKG_SETUP_EXECUTED}" ]]; then
- die "python_pkg_setup() not called"
- fi
-}
-
-# @FUNCTION: python_pkg_setup
-# @DESCRIPTION:
-# Perform sanity checks and initialize environment.
-#
-# This function is exported in EAPI 2 and 3 when PYTHON_USE_WITH or PYTHON_USE_WITH_OR variable
-# is set and always in EAPI >=4. Calling of this function is mandatory in EAPI >=4.
-python_pkg_setup() {
- if [[ "${EBUILD_PHASE}" != "setup" ]]; then
- die "${FUNCNAME}() can be used only in pkg_setup() phase"
- fi
-
- if [[ "$#" -ne 0 ]]; then
- die "${FUNCNAME}() does not accept arguments"
- fi
-
- export JYTHON_SYSTEM_CACHEDIR="1"
- addwrite "${EPREFIX}/var/cache/jython"
-
- if _python_package_supporting_installation_for_multiple_python_abis; then
- _python_calculate_PYTHON_ABIS
- export EPYTHON="$(PYTHON -f)"
- else
- PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
- fi
-
- if ! has "${EAPI:-0}" 0 1 && [[ -n "${PYTHON_USE_WITH}" || -n "${PYTHON_USE_WITH_OR}" ]]; then
- if [[ "${PYTHON_USE_WITH_OPT}" ]]; then
- if [[ "${PYTHON_USE_WITH_OPT}" == !* ]]; then
- use ${PYTHON_USE_WITH_OPT#!} && return
- else
- use !${PYTHON_USE_WITH_OPT} && return
- fi
- fi
-
- python_pkg_setup_check_USE_flags() {
- local python_atom USE_flag
- python_atom="$(python_get_implementational_package)"
-
- for USE_flag in ${PYTHON_USE_WITH}; do
- if ! has_version "${python_atom}[${USE_flag}]"; then
- eerror "Please rebuild ${python_atom} with the following USE flags enabled: ${PYTHON_USE_WITH}"
- die "Please rebuild ${python_atom} with the following USE flags enabled: ${PYTHON_USE_WITH}"
- fi
- done
-
- for USE_flag in ${PYTHON_USE_WITH_OR}; do
- if has_version "${python_atom}[${USE_flag}]"; then
- return
- fi
- done
-
- if [[ ${PYTHON_USE_WITH_OR} ]]; then
- eerror "Please rebuild ${python_atom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}"
- die "Please rebuild ${python_atom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}"
- fi
- }
-
- if _python_package_supporting_installation_for_multiple_python_abis; then
- PYTHON_SKIP_SANITY_CHECKS="1" python_execute_function -q python_pkg_setup_check_USE_flags
- else
- python_pkg_setup_check_USE_flags
- fi
-
- unset -f python_pkg_setup_check_USE_flags
- fi
-
- PYTHON_PKG_SETUP_EXECUTED="1"
-}
-
-_PYTHON_SHEBANG_BASE_PART_REGEX='^#![[:space:]]*([^[:space:]]*/usr/bin/env[[:space:]]+)?([^[:space:]]*/)?(jython|pypy-c|python)'
-
-# @FUNCTION: python_convert_shebangs
-# @USAGE: [-q|--quiet] [-r|--recursive] [-x|--only-executables] [--] <Python_ABI|Python_version> <file|directory> [files|directories]
-# @DESCRIPTION:
-# Convert shebangs in specified files. Directories can be specified only with --recursive option.
-python_convert_shebangs() {
- _python_check_python_pkg_setup_execution
-
- local argument file files=() only_executables="0" python_interpreter quiet="0" recursive="0" shebangs_converted="0"
-
- while (($#)); do
- case "$1" in
- -r|--recursive)
- recursive="1"
- ;;
- -q|--quiet)
- quiet="1"
- ;;
- -x|--only-executables)
- only_executables="1"
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- if [[ "$#" -eq 0 ]]; then
- die "${FUNCNAME}(): Missing Python version and files or directories"
- elif [[ "$#" -eq 1 ]]; then
- die "${FUNCNAME}(): Missing files or directories"
- fi
-
- if [[ -n "$(_python_get_implementation --ignore-invalid "$1")" ]]; then
- python_interpreter="$(PYTHON "$1")"
- else
- python_interpreter="python$1"
- fi
- shift
-
- for argument in "$@"; do
- if [[ ! -e "${argument}" ]]; then
- die "${FUNCNAME}(): '${argument}' does not exist"
- elif [[ -f "${argument}" ]]; then
- files+=("${argument}")
- elif [[ -d "${argument}" ]]; then
- if [[ "${recursive}" == "1" ]]; then
- while read -d $'\0' -r file; do
- files+=("${file}")
- done < <(find "${argument}" $([[ "${only_executables}" == "1" ]] && echo -perm /111) -type f -print0)
- else
- die "${FUNCNAME}(): '${argument}' is not a regular file"
- fi
- else
- die "${FUNCNAME}(): '${argument}' is not a regular file or a directory"
- fi
- done
-
- for file in "${files[@]}"; do
- file="${file#./}"
- [[ "${only_executables}" == "1" && ! -x "${file}" ]] && continue
-
- if [[ "$(head -n1 "${file}")" =~ ${_PYTHON_SHEBANG_BASE_PART_REGEX} ]]; then
- [[ "$(sed -ne "2p" "${file}")" =~ ^"# Gentoo '".*"' wrapper script generated by python_generate_wrapper_scripts()"$ ]] && continue
-
- shebangs_converted="1"
-
- if [[ "${quiet}" == "0" ]]; then
- einfo "Converting shebang in '${file}'"
- fi
-
- sed -e "1s:^#![[:space:]]*\([^[:space:]]*/usr/bin/env[[:space:]]\)\?[[:space:]]*\([^[:space:]]*/\)\?\(jython\|pypy-c\|python\)\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?\(\$\|[[:space:]].*\):#!\1\2${python_interpreter}\6:" -i "${file}" || die "Conversion of shebang in '${file}' failed"
- fi
- done
-
- if [[ "${shebangs_converted}" == "0" ]]; then
- ewarn "${FUNCNAME}(): Python scripts not found"
- fi
-}
-
-# @FUNCTION: python_clean_py-compile_files
-# @USAGE: [-q|--quiet]
-# @DESCRIPTION:
-# Clean py-compile files to disable byte-compilation.
-python_clean_py-compile_files() {
- _python_check_python_pkg_setup_execution
-
- local file files=() quiet="0"
-
- while (($#)); do
- case "$1" in
- -q|--quiet)
- quiet="1"
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- die "${FUNCNAME}(): Invalid usage"
- ;;
- esac
- shift
- done
-
- while read -d $'\0' -r file; do
- files+=("${file#./}")
- done < <(find -name py-compile -type f -print0)
-
- for file in "${files[@]}"; do
- if [[ "${quiet}" == "0" ]]; then
- einfo "Cleaning '${file}' file"
- fi
- echo "#!/bin/sh" > "${file}"
- done
-}
-
-# @FUNCTION: python_clean_installation_image
-# @USAGE: [-q|--quiet]
-# @DESCRIPTION:
-# Delete needless files in installation image.
-#
-# This function can be used only in src_install() phase.
-python_clean_installation_image() {
- if [[ "${EBUILD_PHASE}" != "install" ]]; then
- die "${FUNCNAME}() can be used only in src_install() phase"
- fi
-
- _python_check_python_pkg_setup_execution
- _python_initialize_prefix_variables
-
- local file files=() quiet="0"
-
- while (($#)); do
- case "$1" in
- -q|--quiet)
- quiet="1"
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- die "${FUNCNAME}(): Invalid usage"
- ;;
- esac
- shift
- done
-
- while read -d $'\0' -r file; do
- files+=("${file}")
- done < <(find "${ED}" "(" -name "*.py[co]" -o -name "*\$py.class" ")" -type f -print0)
-
- if [[ "${#files[@]}" -gt 0 ]]; then
- if [[ "${quiet}" == "0" ]]; then
- ewarn "Deleting byte-compiled Python modules needlessly generated by build system:"
- fi
- for file in "${files[@]}"; do
- if [[ "${quiet}" == "0" ]]; then
- ewarn " ${file}"
- fi
- rm -f "${file}"
-
- # Delete empty __pycache__ directories.
- if [[ "${file%/*}" == *"/__pycache__" ]]; then
- rmdir "${file%/*}" 2> /dev/null
- fi
- done
- fi
-
- python_clean_sitedirs() {
- if [[ -d "${ED}$(python_get_sitedir)" ]]; then
- find "${ED}$(python_get_sitedir)" "(" -name "*.c" -o -name "*.h" -o -name "*.la" ")" -type f -print0 | xargs -0 rm -f
- fi
- }
- if _python_package_supporting_installation_for_multiple_python_abis; then
- python_execute_function -q python_clean_sitedirs
- else
- python_clean_sitedirs
- fi
-
- unset -f python_clean_sitedirs
-}
-
-# ================================================================================================
-# =========== FUNCTIONS FOR PACKAGES SUPPORTING INSTALLATION FOR MULTIPLE PYTHON ABIS ============
-# ================================================================================================
-
-# @ECLASS-VARIABLE: SUPPORT_PYTHON_ABIS
-# @DESCRIPTION:
-# Set this in EAPI <= 4 to indicate that current package supports installation for
-# multiple Python ABIs.
-
-# @ECLASS-VARIABLE: PYTHON_TESTS_RESTRICTED_ABIS
-# @DESCRIPTION:
-# Space-separated list of Python ABI patterns. Testing in Python ABIs matching any Python ABI
-# patterns specified in this list is skipped.
-
-# @ECLASS-VARIABLE: PYTHON_EXPORT_PHASE_FUNCTIONS
-# @DESCRIPTION:
-# Set this to export phase functions for the following ebuild phases:
-# src_prepare(), src_configure(), src_compile(), src_test(), src_install().
-if ! has "${EAPI:-0}" 0 1; then
- python_src_prepare() {
- if [[ "${EBUILD_PHASE}" != "prepare" ]]; then
- die "${FUNCNAME}() can be used only in src_prepare() phase"
- fi
-
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
-
- _python_check_python_pkg_setup_execution
-
- if [[ "$#" -ne 0 ]]; then
- die "${FUNCNAME}() does not accept arguments"
- fi
-
- python_copy_sources
- }
-
- for python_default_function in src_configure src_compile src_test; do
- eval "python_${python_default_function}() {
- if [[ \"\${EBUILD_PHASE}\" != \"${python_default_function#src_}\" ]]; then
- die \"\${FUNCNAME}() can be used only in ${python_default_function}() phase\"
- fi
-
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die \"\${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs\"
- fi
-
- _python_check_python_pkg_setup_execution
-
- python_execute_function -d -s -- \"\$@\"
- }"
- done
- unset python_default_function
-
- python_src_install() {
- if [[ "${EBUILD_PHASE}" != "install" ]]; then
- die "${FUNCNAME}() can be used only in src_install() phase"
- fi
-
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
-
- _python_check_python_pkg_setup_execution
-
- if has "${EAPI:-0}" 0 1 2 3; then
- python_execute_function -d -s -- "$@"
- else
- python_installation() {
- emake DESTDIR="${T}/images/${PYTHON_ABI}" install "$@"
- }
- python_execute_function -s python_installation "$@"
- unset python_installation
-
- python_merge_intermediate_installation_images "${T}/images"
- fi
- }
-
- if [[ -n "${PYTHON_EXPORT_PHASE_FUNCTIONS}" ]]; then
- EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
- fi
-fi
-
-unset PYTHON_ABIS
-
-_python_calculate_PYTHON_ABIS() {
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
-
- _python_initial_sanity_checks
-
- if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]]; then
- local PYTHON_ABI
-
- if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then
- local cpython_enabled="0"
-
- if [[ -z "${USE_PYTHON}" ]]; then
- die "USE_PYTHON variable is empty"
- fi
-
- for PYTHON_ABI in ${USE_PYTHON}; do
- if ! has "${PYTHON_ABI}" "${_PYTHON_GLOBALLY_SUPPORTED_ABIS[@]}"; then
- die "USE_PYTHON variable contains invalid value '${PYTHON_ABI}'"
- fi
-
- if has "${PYTHON_ABI}" "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; then
- cpython_enabled="1"
- fi
-
- if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
- export PYTHON_ABIS+="${PYTHON_ABIS:+ }${PYTHON_ABI}"
- fi
- done
-
- if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then
- die "USE_PYTHON variable does not enable any Python ABI supported by ${CATEGORY}/${PF}"
- fi
-
- if [[ "${cpython_enabled}" == "0" ]]; then
- die "USE_PYTHON variable does not enable any CPython ABI"
- fi
- else
- local python_version python2_version python3_version support_python_major_version
-
- if ! has_version "dev-lang/python"; then
- die "${FUNCNAME}(): 'dev-lang/python' is not installed"
- fi
-
- python_version="$("${EPREFIX}/usr/bin/python" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
-
- if has_version "=dev-lang/python-2*"; then
- python2_version="$("${EPREFIX}/usr/bin/python2" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
-
- support_python_major_version="0"
- for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}"; do
- if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
- support_python_major_version="1"
- break
- fi
- done
- if [[ "${support_python_major_version}" == "1" ]]; then
- if _python_check_python_abi_matching --patterns-list "${python2_version}" "${RESTRICT_PYTHON_ABIS}"; then
- die "Active version of CPython 2 is not supported by ${CATEGORY}/${PF}"
- fi
- else
- python2_version=""
- fi
- fi
-
- if has_version "=dev-lang/python-3*"; then
- python3_version="$("${EPREFIX}/usr/bin/python3" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
-
- support_python_major_version="0"
- for PYTHON_ABI in "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do
- if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
- support_python_major_version="1"
- break
- fi
- done
- if [[ "${support_python_major_version}" == "1" ]]; then
- if _python_check_python_abi_matching --patterns-list "${python3_version}" "${RESTRICT_PYTHON_ABIS}"; then
- die "Active version of CPython 3 is not supported by ${CATEGORY}/${PF}"
- fi
- else
- python3_version=""
- fi
- fi
-
- if [[ -z "${python2_version}" && -z "${python3_version}" ]]; then
- eerror "${CATEGORY}/${PF} requires at least one of the following packages:"
- for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}" "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do
- if ! _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${RESTRICT_PYTHON_ABIS}"; then
- eerror " dev-lang/python:${PYTHON_ABI}"
- fi
- done
- die "No supported version of CPython installed"
- fi
-
- if [[ -n "${python2_version}" && "${python_version}" == "2."* && "${python_version}" != "${python2_version}" ]]; then
- eerror "Python wrapper is configured incorrectly or '${EPREFIX}/usr/bin/python2' symlink"
- eerror "is set incorrectly. Use \`eselect python\` to fix configuration."
- die "Incorrect configuration of Python"
- fi
- if [[ -n "${python3_version}" && "${python_version}" == "3."* && "${python_version}" != "${python3_version}" ]]; then
- eerror "Python wrapper is configured incorrectly or '${EPREFIX}/usr/bin/python3' symlink"
- eerror "is set incorrectly. Use \`eselect python\` to fix configuration."
- die "Incorrect configuration of Python"
- fi
-
- PYTHON_ABIS="${python2_version} ${python3_version}"
- PYTHON_ABIS="${PYTHON_ABIS# }"
- export PYTHON_ABIS="${PYTHON_ABIS% }"
- fi
- fi
-
- _python_final_sanity_checks
-}
-
-_python_prepare_flags() {
- local array=() deleted_flag element flags new_value old_flag old_value operator pattern prefix variable
-
- for variable in CPPFLAGS CFLAGS CXXFLAGS LDFLAGS; do
- eval "_PYTHON_SAVED_${variable}=\"\${!variable}\""
- for prefix in PYTHON_USER_ PYTHON_; do
- if [[ "$(declare -p ${prefix}${variable} 2> /dev/null)" == "declare -a ${prefix}${variable}="* ]]; then
- eval "array=(\"\${${prefix}${variable}[@]}\")"
- for element in "${array[@]}"; do
- if [[ "${element}" =~ ^${_PYTHON_ABI_PATTERN_REGEX}\ (\+|-)\ .+ ]]; then
- pattern="${element%% *}"
- element="${element#* }"
- operator="${element%% *}"
- flags="${element#* }"
- if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
- if [[ "${operator}" == "+" ]]; then
- eval "export ${variable}+=\"\${variable:+ }${flags}\""
- elif [[ "${operator}" == "-" ]]; then
- flags="${flags// /$'\n'}"
- old_value="${!variable// /$'\n'}"
- new_value=""
- while read old_flag; do
- while read deleted_flag; do
- if [[ "${old_flag}" == ${deleted_flag} ]]; then
- continue 2
- fi
- done <<< "${flags}"
- new_value+="${new_value:+ }${old_flag}"
- done <<< "${old_value}"
- eval "export ${variable}=\"\${new_value}\""
- fi
- fi
- else
- die "Element '${element}' of ${prefix}${variable} array has invalid syntax"
- fi
- done
- elif [[ -n "$(declare -p ${prefix}${variable} 2> /dev/null)" ]]; then
- die "${prefix}${variable} should be indexed array"
- fi
- done
- done
-}
-
-_python_restore_flags() {
- local variable
-
- for variable in CPPFLAGS CFLAGS CXXFLAGS LDFLAGS; do
- eval "${variable}=\"\${_PYTHON_SAVED_${variable}}\""
- unset _PYTHON_SAVED_${variable}
- done
-}
-
-# @FUNCTION: python_execute_function
-# @USAGE: [--action-message message] [-d|--default-function] [--failure-message message] [-f|--final-ABI] [--nonfatal] [-q|--quiet] [-s|--separate-build-dirs] [--source-dir source_directory] [--] <function> [arguments]
-# @DESCRIPTION:
-# Execute specified function for each value of PYTHON_ABIS, optionally passing additional
-# arguments. The specified function can use PYTHON_ABI and BUILDDIR variables.
-python_execute_function() {
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
-
- _python_check_python_pkg_setup_execution
- _python_set_color_variables
-
- local action action_message action_message_template default_function="0" failure_message failure_message_template final_ABI="0" function iterated_PYTHON_ABIS nonfatal="0" previous_directory previous_directory_stack previous_directory_stack_length PYTHON_ABI quiet="0" return_code separate_build_dirs="0" source_dir
-
- while (($#)); do
- case "$1" in
- --action-message)
- action_message_template="$2"
- shift
- ;;
- -d|--default-function)
- default_function="1"
- ;;
- --failure-message)
- failure_message_template="$2"
- shift
- ;;
- -f|--final-ABI)
- final_ABI="1"
- ;;
- --nonfatal)
- nonfatal="1"
- ;;
- -q|--quiet)
- quiet="1"
- ;;
- -s|--separate-build-dirs)
- separate_build_dirs="1"
- ;;
- --source-dir)
- source_dir="$2"
- shift
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- if [[ -n "${source_dir}" && "${separate_build_dirs}" == 0 ]]; then
- die "${FUNCNAME}(): '--source-dir' option can be specified only with '--separate-build-dirs' option"
- fi
-
- if [[ "${default_function}" == "0" ]]; then
- if [[ "$#" -eq 0 ]]; then
- die "${FUNCNAME}(): Missing function name"
- fi
- function="$1"
- shift
-
- if [[ -z "$(type -t "${function}")" ]]; then
- die "${FUNCNAME}(): '${function}' function is not defined"
- fi
- else
- if has "${EAPI:-0}" 0 1; then
- die "${FUNCNAME}(): '--default-function' option cannot be used in this EAPI"
- fi
-
- if [[ "${EBUILD_PHASE}" == "configure" ]]; then
- if has "${EAPI}" 2 3; then
- python_default_function() {
- econf "$@"
- }
- else
- python_default_function() {
- nonfatal econf "$@"
- }
- fi
- elif [[ "${EBUILD_PHASE}" == "compile" ]]; then
- python_default_function() {
- emake "$@"
- }
- elif [[ "${EBUILD_PHASE}" == "test" ]]; then
- python_default_function() {
- # Stolen from portage's _eapi0_src_test()
- local emake_cmd="${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE}"
- if ${emake_cmd} -j1 -n check &> /dev/null; then
- ${emake_cmd} -j1 check "$@"
- elif ${emake_cmd} -j1 -n test &> /dev/null; then
- ${emake_cmd} -j1 test "$@"
- fi
- }
- elif [[ "${EBUILD_PHASE}" == "install" ]]; then
- python_default_function() {
- emake DESTDIR="${D}" install "$@"
- }
- else
- die "${FUNCNAME}(): '--default-function' option cannot be used in this ebuild phase"
- fi
- function="python_default_function"
- fi
-
- # Ensure that python_execute_function() cannot be directly or indirectly called by python_execute_function().
- if _python_abi-specific_local_scope; then
- die "${FUNCNAME}(): Invalid call stack"
- fi
-
- if [[ "${quiet}" == "0" ]]; then
- [[ "${EBUILD_PHASE}" == "setup" ]] && action="Setting up"
- [[ "${EBUILD_PHASE}" == "unpack" ]] && action="Unpacking"
- [[ "${EBUILD_PHASE}" == "prepare" ]] && action="Preparation"
- [[ "${EBUILD_PHASE}" == "configure" ]] && action="Configuration"
- [[ "${EBUILD_PHASE}" == "compile" ]] && action="Building"
- [[ "${EBUILD_PHASE}" == "test" ]] && action="Testing"
- [[ "${EBUILD_PHASE}" == "install" ]] && action="Installation"
- [[ "${EBUILD_PHASE}" == "preinst" ]] && action="Preinstallation"
- [[ "${EBUILD_PHASE}" == "postinst" ]] && action="Postinstallation"
- [[ "${EBUILD_PHASE}" == "prerm" ]] && action="Preuninstallation"
- [[ "${EBUILD_PHASE}" == "postrm" ]] && action="Postuninstallation"
- fi
-
- _python_calculate_PYTHON_ABIS
- if [[ "${final_ABI}" == "1" ]]; then
- iterated_PYTHON_ABIS="$(PYTHON -f --ABI)"
- else
- iterated_PYTHON_ABIS="${PYTHON_ABIS}"
- fi
- for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
- if [[ "${EBUILD_PHASE}" == "test" ]] && _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${PYTHON_TESTS_RESTRICTED_ABIS}"; then
- if [[ "${quiet}" == "0" ]]; then
- echo " ${_GREEN}*${_NORMAL} ${_BLUE}Testing of ${CATEGORY}/${PF} with $(python_get_implementation_and_version) skipped${_NORMAL}"
- fi
- continue
- fi
-
- _python_prepare_flags
-
- if [[ "${quiet}" == "0" ]]; then
- if [[ -n "${action_message_template}" ]]; then
- eval "action_message=\"${action_message_template}\""
- else
- action_message="${action} of ${CATEGORY}/${PF} with $(python_get_implementation_and_version)..."
- fi
- echo " ${_GREEN}*${_NORMAL} ${_BLUE}${action_message}${_NORMAL}"
- fi
-
- if [[ "${separate_build_dirs}" == "1" ]]; then
- if [[ -n "${source_dir}" ]]; then
- export BUILDDIR="${S}/${source_dir}-${PYTHON_ABI}"
- else
- export BUILDDIR="${S}-${PYTHON_ABI}"
- fi
- pushd "${BUILDDIR}" > /dev/null || die "pushd failed"
- else
- export BUILDDIR="${S}"
- fi
-
- previous_directory="$(pwd)"
- previous_directory_stack="$(dirs -p)"
- previous_directory_stack_length="$(dirs -p | wc -l)"
-
- if ! has "${EAPI}" 0 1 2 3 && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then
- EPYTHON="$(PYTHON)" nonfatal "${function}" "$@"
- else
- EPYTHON="$(PYTHON)" "${function}" "$@"
- fi
-
- return_code="$?"
-
- _python_restore_flags
-
- if [[ "${return_code}" -ne 0 ]]; then
- if [[ -n "${failure_message_template}" ]]; then
- eval "failure_message=\"${failure_message_template}\""
- else
- failure_message="${action} failed with $(python_get_implementation_and_version) in ${function}() function"
- fi
-
- if [[ "${nonfatal}" == "1" ]]; then
- if [[ "${quiet}" == "0" ]]; then
- ewarn "${failure_message}"
- fi
- elif [[ "${final_ABI}" == "0" ]] && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then
- if [[ "${EBUILD_PHASE}" != "test" ]] || ! has test-fail-continue ${FEATURES}; then
- local enabled_PYTHON_ABIS= other_PYTHON_ABI
- for other_PYTHON_ABI in ${PYTHON_ABIS}; do
- [[ "${other_PYTHON_ABI}" != "${PYTHON_ABI}" ]] && enabled_PYTHON_ABIS+="${enabled_PYTHON_ABIS:+ }${other_PYTHON_ABI}"
- done
- export PYTHON_ABIS="${enabled_PYTHON_ABIS}"
- fi
- if [[ "${quiet}" == "0" ]]; then
- ewarn "${failure_message}"
- fi
- if [[ -z "${PYTHON_ABIS}" ]]; then
- die "${function}() function failed with all enabled Python ABIs"
- fi
- else
- die "${failure_message}"
- fi
- fi
-
- # Ensure that directory stack has not been decreased.
- if [[ "$(dirs -p | wc -l)" -lt "${previous_directory_stack_length}" ]]; then
- die "Directory stack decreased illegally"
- fi
-
- # Avoid side effects of earlier returning from the specified function.
- while [[ "$(dirs -p | wc -l)" -gt "${previous_directory_stack_length}" ]]; do
- popd > /dev/null || die "popd failed"
- done
-
- # Ensure that the bottom part of directory stack has not been changed. Restore
- # previous directory (from before running of the specified function) before
- # comparison of directory stacks to avoid mismatch of directory stacks after
- # potential using of 'cd' to change current directory. Restoration of previous
- # directory allows to safely use 'cd' to change current directory in the
- # specified function without changing it back to original directory.
- cd "${previous_directory}"
- if [[ "$(dirs -p)" != "${previous_directory_stack}" ]]; then
- die "Directory stack changed illegally"
- fi
-
- if [[ "${separate_build_dirs}" == "1" ]]; then
- popd > /dev/null || die "popd failed"
- fi
- unset BUILDDIR
- done
-
- if [[ "${default_function}" == "1" ]]; then
- unset -f python_default_function
- fi
-}
-
-# @FUNCTION: python_copy_sources
-# @USAGE: <directory="${S}"> [directory]
-# @DESCRIPTION:
-# Copy unpacked sources of current package to separate build directory for each Python ABI.
-python_copy_sources() {
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
-
- _python_check_python_pkg_setup_execution
-
- local dir dirs=() PYTHON_ABI
-
- if [[ "$#" -eq 0 ]]; then
- if [[ "${WORKDIR}" == "${S}" ]]; then
- die "${FUNCNAME}() cannot be used with current value of S variable"
- fi
- dirs=("${S%/}")
- else
- dirs=("$@")
- fi
-
- _python_calculate_PYTHON_ABIS
- for PYTHON_ABI in ${PYTHON_ABIS}; do
- for dir in "${dirs[@]}"; do
- cp -pr "${dir}" "${dir}-${PYTHON_ABI}" > /dev/null || die "Copying of sources failed"
- done
- done
-}
-
-# @FUNCTION: python_generate_wrapper_scripts
-# @USAGE: [-E|--respect-EPYTHON] [-f|--force] [-q|--quiet] [--] <file> [files]
-# @DESCRIPTION:
-# Generate wrapper scripts. Existing files are overwritten only with --force option.
-# If --respect-EPYTHON option is specified, then generated wrapper scripts will
-# respect EPYTHON variable at run time.
-#
-# This function can be used only in src_install() phase.
-python_generate_wrapper_scripts() {
- if [[ "${EBUILD_PHASE}" != "install" ]]; then
- die "${FUNCNAME}() can be used only in src_install() phase"
- fi
-
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
-
- _python_check_python_pkg_setup_execution
- _python_initialize_prefix_variables
-
- local eselect_python_option file force="0" quiet="0" PYTHON_ABI PYTHON_ABIS_list python2_enabled="0" python3_enabled="0" respect_EPYTHON="0"
-
- while (($#)); do
- case "$1" in
- -E|--respect-EPYTHON)
- respect_EPYTHON="1"
- ;;
- -f|--force)
- force="1"
- ;;
- -q|--quiet)
- quiet="1"
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- if [[ "$#" -eq 0 ]]; then
- die "${FUNCNAME}(): Missing arguments"
- fi
-
- _python_calculate_PYTHON_ABIS
- for PYTHON_ABI in "${_CPYTHON2_GLOBALLY_SUPPORTED_ABIS[@]}"; do
- if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then
- python2_enabled="1"
- fi
- done
- for PYTHON_ABI in "${_CPYTHON3_GLOBALLY_SUPPORTED_ABIS[@]}"; do
- if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then
- python3_enabled="1"
- fi
- done
-
- if [[ "${python2_enabled}" == "1" && "${python3_enabled}" == "1" ]]; then
- eselect_python_option=
- elif [[ "${python2_enabled}" == "1" && "${python3_enabled}" == "0" ]]; then
- eselect_python_option="--python2"
- elif [[ "${python2_enabled}" == "0" && "${python3_enabled}" == "1" ]]; then
- eselect_python_option="--python3"
- else
- die "${FUNCNAME}(): Unsupported environment"
- fi
-
- PYTHON_ABIS_list="$("$(PYTHON -f)" -c "print(', '.join('\"%s\"' % x for x in reversed('${PYTHON_ABIS}'.split())))")"
-
- for file in "$@"; do
- if [[ -f "${file}" && "${force}" == "0" ]]; then
- die "${FUNCNAME}(): '${file}' already exists"
- fi
-
- if [[ "${quiet}" == "0" ]]; then
- einfo "Generating '${file#${ED%/}}' wrapper script"
- fi
-
- cat << EOF > "${file}"
-#!/usr/bin/env python
-# Gentoo '${file##*/}' wrapper script generated by python_generate_wrapper_scripts()
-
-import os
-import re
-import subprocess
-import sys
-
-cpython_ABI_re = re.compile(r"^(\d+\.\d+)$")
-jython_ABI_re = re.compile(r"^(\d+\.\d+)-jython$")
-pypy_ABI_re = re.compile(r"^\d+\.\d+-pypy-(\d+\.\d+)$")
-cpython_interpreter_re = re.compile(r"^python(\d+\.\d+)$")
-jython_interpreter_re = re.compile(r"^jython(\d+\.\d+)$")
-pypy_interpreter_re = re.compile(r"^pypy-c(\d+\.\d+)$")
-cpython_shebang_re = re.compile(r"^#![ \t]*(?:${EPREFIX}/usr/bin/python|(?:${EPREFIX})?/usr/bin/env[ \t]+(?:${EPREFIX}/usr/bin/)?python)")
-python_shebang_options_re = re.compile(r"^#![ \t]*${EPREFIX}/usr/bin/(?:jython|pypy-c|python)(?:\d+(?:\.\d+)?)?[ \t]+(-\S)")
-python_verification_output_re = re.compile("^GENTOO_PYTHON_TARGET_SCRIPT_PATH supported\n$")
-
-#pypy_versions_mapping = {
-# "1.5": "2.7",
-# "1.6": "2.7",
-# "1.7": "2.7",
-# "1.8": "2.7",
-# "1.9": "2.7",
-# "2.0": "2.7",
-#}
-
-def get_PYTHON_ABI(python_interpreter):
- cpython_matched = cpython_interpreter_re.match(python_interpreter)
- jython_matched = jython_interpreter_re.match(python_interpreter)
- pypy_matched = pypy_interpreter_re.match(python_interpreter)
- if cpython_matched is not None:
- PYTHON_ABI = cpython_matched.group(1)
- elif jython_matched is not None:
- PYTHON_ABI = jython_matched.group(1) + "-jython"
- elif pypy_matched is not None:
- #PYTHON_ABI = pypy_versions_mapping[pypy_matched.group(1)] + "-pypy-" + pypy_matched.group(1)
- PYTHON_ABI = "2.7-pypy-" + pypy_matched.group(1)
- else:
- PYTHON_ABI = None
- return PYTHON_ABI
-
-def get_python_interpreter(PYTHON_ABI):
- cpython_matched = cpython_ABI_re.match(PYTHON_ABI)
- jython_matched = jython_ABI_re.match(PYTHON_ABI)
- pypy_matched = pypy_ABI_re.match(PYTHON_ABI)
- if cpython_matched is not None:
- python_interpreter = "python" + cpython_matched.group(1)
- elif jython_matched is not None:
- python_interpreter = "jython" + jython_matched.group(1)
- elif pypy_matched is not None:
- python_interpreter = "pypy-c" + pypy_matched.group(1)
- else:
- python_interpreter = None
- return python_interpreter
-
-EOF
- if [[ "$?" != "0" ]]; then
- die "${FUNCNAME}(): Generation of '$1' failed"
- fi
- if [[ "${respect_EPYTHON}" == "1" ]]; then
- cat << EOF >> "${file}"
-python_interpreter = os.environ.get("EPYTHON")
-if python_interpreter:
- PYTHON_ABI = get_PYTHON_ABI(python_interpreter)
- if PYTHON_ABI is None:
- sys.stderr.write("%s: EPYTHON variable has unrecognized value '%s'\n" % (sys.argv[0], python_interpreter))
- sys.exit(1)
-else:
- try:
- environment = os.environ.copy()
- environment["ROOT"] = "/"
- eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], env=environment, stdout=subprocess.PIPE)
- if eselect_process.wait() != 0:
- raise ValueError
- except (OSError, ValueError):
- sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0])
- sys.exit(1)
-
- python_interpreter = eselect_process.stdout.read()
- if not isinstance(python_interpreter, str):
- # Python 3
- python_interpreter = python_interpreter.decode()
- python_interpreter = python_interpreter.rstrip("\n")
-
- PYTHON_ABI = get_PYTHON_ABI(python_interpreter)
- if PYTHON_ABI is None:
- sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], python_interpreter))
- sys.exit(1)
-
-wrapper_script_path = os.path.realpath(sys.argv[0])
-target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI)
-if not os.path.exists(target_executable_path):
- sys.stderr.write("%s: '%s' does not exist\n" % (sys.argv[0], target_executable_path))
- sys.exit(1)
-EOF
- if [[ "$?" != "0" ]]; then
- die "${FUNCNAME}(): Generation of '$1' failed"
- fi
- else
- cat << EOF >> "${file}"
-try:
- environment = os.environ.copy()
- environment["ROOT"] = "/"
- eselect_process = subprocess.Popen(["${EPREFIX}/usr/bin/eselect", "python", "show"${eselect_python_option:+, $(echo "\"")}${eselect_python_option}${eselect_python_option:+$(echo "\"")}], env=environment, stdout=subprocess.PIPE)
- if eselect_process.wait() != 0:
- raise ValueError
-except (OSError, ValueError):
- sys.stderr.write("%s: Execution of 'eselect python show${eselect_python_option:+ }${eselect_python_option}' failed\n" % sys.argv[0])
- sys.exit(1)
-
-python_interpreter = eselect_process.stdout.read()
-if not isinstance(python_interpreter, str):
- # Python 3
- python_interpreter = python_interpreter.decode()
-python_interpreter = python_interpreter.rstrip("\n")
-
-PYTHON_ABI = get_PYTHON_ABI(python_interpreter)
-if PYTHON_ABI is None:
- sys.stderr.write("%s: 'eselect python show${eselect_python_option:+ }${eselect_python_option}' printed unrecognized value '%s'\n" % (sys.argv[0], python_interpreter))
- sys.exit(1)
-
-wrapper_script_path = os.path.realpath(sys.argv[0])
-for PYTHON_ABI in [PYTHON_ABI, ${PYTHON_ABIS_list}]:
- target_executable_path = "%s-%s" % (wrapper_script_path, PYTHON_ABI)
- if os.path.exists(target_executable_path):
- break
-else:
- sys.stderr.write("%s: No target script exists for '%s'\n" % (sys.argv[0], wrapper_script_path))
- sys.exit(1)
-
-python_interpreter = get_python_interpreter(PYTHON_ABI)
-if python_interpreter is None:
- sys.stderr.write("%s: Unrecognized Python ABI '%s'\n" % (sys.argv[0], PYTHON_ABI))
- sys.exit(1)
-EOF
- if [[ "$?" != "0" ]]; then
- die "${FUNCNAME}(): Generation of '$1' failed"
- fi
- fi
- cat << EOF >> "${file}"
-
-target_executable = open(target_executable_path, "rb")
-target_executable_first_line = target_executable.readline()
-target_executable.close()
-if not isinstance(target_executable_first_line, str):
- # Python 3
- target_executable_first_line = target_executable_first_line.decode("utf_8", "replace")
-
-options = []
-python_shebang_options_matched = python_shebang_options_re.match(target_executable_first_line)
-if python_shebang_options_matched is not None:
- options = [python_shebang_options_matched.group(1)]
-
-cpython_shebang_matched = cpython_shebang_re.match(target_executable_first_line)
-
-if cpython_shebang_matched is not None:
- try:
- python_interpreter_path = "${EPREFIX}/usr/bin/%s" % python_interpreter
- os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"] = "1"
- python_verification_process = subprocess.Popen([python_interpreter_path, "-c", "pass"], stdout=subprocess.PIPE)
- del os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"]
- if python_verification_process.wait() != 0:
- raise ValueError
-
- python_verification_output = python_verification_process.stdout.read()
- if not isinstance(python_verification_output, str):
- # Python 3
- python_verification_output = python_verification_output.decode()
-
- if not python_verification_output_re.match(python_verification_output):
- raise ValueError
-
- if cpython_interpreter_re.match(python_interpreter) is not None:
- os.environ["GENTOO_PYTHON_PROCESS_NAME"] = os.path.basename(sys.argv[0])
- os.environ["GENTOO_PYTHON_WRAPPER_SCRIPT_PATH"] = sys.argv[0]
- os.environ["GENTOO_PYTHON_TARGET_SCRIPT_PATH"] = target_executable_path
-
- if hasattr(os, "execv"):
- os.execv(python_interpreter_path, [python_interpreter_path] + options + sys.argv)
- else:
- sys.exit(subprocess.Popen([python_interpreter_path] + options + sys.argv).wait())
- except (KeyboardInterrupt, SystemExit):
- raise
- except:
- pass
- for variable in ("GENTOO_PYTHON_PROCESS_NAME", "GENTOO_PYTHON_WRAPPER_SCRIPT_PATH", "GENTOO_PYTHON_TARGET_SCRIPT_PATH", "GENTOO_PYTHON_TARGET_SCRIPT_PATH_VERIFICATION"):
- if variable in os.environ:
- del os.environ[variable]
-
-if hasattr(os, "execv"):
- os.execv(target_executable_path, sys.argv)
-else:
- sys.exit(subprocess.Popen([target_executable_path] + sys.argv[1:]).wait())
-EOF
- if [[ "$?" != "0" ]]; then
- die "${FUNCNAME}(): Generation of '$1' failed"
- fi
- fperms +x "${file#${ED%/}}" || die "fperms '${file}' failed"
- done
-}
-
-# @ECLASS-VARIABLE: PYTHON_VERSIONED_SCRIPTS
-# @DESCRIPTION:
-# Array of regular expressions of paths to versioned Python scripts.
-# Python scripts in /usr/bin and /usr/sbin are versioned by default.
-
-# @ECLASS-VARIABLE: PYTHON_VERSIONED_EXECUTABLES
-# @DESCRIPTION:
-# Array of regular expressions of paths to versioned executables (including Python scripts).
-
-# @ECLASS-VARIABLE: PYTHON_NONVERSIONED_EXECUTABLES
-# @DESCRIPTION:
-# Array of regular expressions of paths to nonversioned executables (including Python scripts).
-
-# @FUNCTION: python_merge_intermediate_installation_images
-# @USAGE: [-q|--quiet] [--] <intermediate_installation_images_directory>
-# @DESCRIPTION:
-# Merge intermediate installation images into installation image.
-#
-# This function can be used only in src_install() phase.
-python_merge_intermediate_installation_images() {
- if [[ "${EBUILD_PHASE}" != "install" ]]; then
- die "${FUNCNAME}() can be used only in src_install() phase"
- fi
-
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
-
- _python_check_python_pkg_setup_execution
- _python_initialize_prefix_variables
-
- local absolute_file b file files=() intermediate_installation_images_directory PYTHON_ABI quiet="0" regex shebang version_executable wrapper_scripts=() wrapper_scripts_set=()
-
- while (($#)); do
- case "$1" in
- -q|--quiet)
- quiet="1"
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- if [[ "$#" -ne 1 ]]; then
- die "${FUNCNAME}() requires 1 argument"
- fi
-
- intermediate_installation_images_directory="$1"
-
- if [[ ! -d "${intermediate_installation_images_directory}" ]]; then
- die "${FUNCNAME}(): Intermediate installation images directory '${intermediate_installation_images_directory}' does not exist"
- fi
-
- _python_calculate_PYTHON_ABIS
- if [[ "$(PYTHON -f --ABI)" == 3.* ]]; then
- b="b"
- fi
-
- while read -d $'\0' -r file; do
- files+=("${file}")
- done < <("$(PYTHON -f)" -c \
-"import os
-import sys
-
-if hasattr(sys.stdout, 'buffer'):
- # Python 3
- stdout = sys.stdout.buffer
-else:
- # Python 2
- stdout = sys.stdout
-
-files_set = set()
-
-os.chdir(${b}'${intermediate_installation_images_directory}')
-
-for PYTHON_ABI in ${b}'${PYTHON_ABIS}'.split():
- for root, dirs, files in os.walk(PYTHON_ABI + ${b}'${EPREFIX}'):
- root = root[len(PYTHON_ABI + ${b}'${EPREFIX}')+1:]
- files_set.update(root + ${b}'/' + file for file in files)
-
-for file in sorted(files_set):
- stdout.write(file)
- stdout.write(${b}'\x00')" || die "${FUNCNAME}(): Failure of extraction of files in intermediate installation images")
-
- for PYTHON_ABI in ${PYTHON_ABIS}; do
- if [[ ! -d "${intermediate_installation_images_directory}/${PYTHON_ABI}" ]]; then
- die "${FUNCNAME}(): Intermediate installation image for Python ABI '${PYTHON_ABI}' does not exist"
- fi
-
- pushd "${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}" > /dev/null || die "pushd failed"
-
- for file in "${files[@]}"; do
- version_executable="0"
- for regex in "/usr/bin/.*" "/usr/sbin/.*" "${PYTHON_VERSIONED_SCRIPTS[@]}"; do
- if [[ "/${file}" =~ ^${regex}$ ]]; then
- version_executable="1"
- break
- fi
- done
- for regex in "${PYTHON_VERSIONED_EXECUTABLES[@]}"; do
- if [[ "/${file}" =~ ^${regex}$ ]]; then
- version_executable="2"
- break
- fi
- done
- if [[ "${version_executable}" != "0" ]]; then
- for regex in "${PYTHON_NONVERSIONED_EXECUTABLES[@]}"; do
- if [[ "/${file}" =~ ^${regex}$ ]]; then
- version_executable="0"
- break
- fi
- done
- fi
-
- [[ "${version_executable}" == "0" ]] && continue
-
- if [[ -L "${file}" ]]; then
- absolute_file="$(readlink "${file}")"
- if [[ "${absolute_file}" == /* ]]; then
- absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${absolute_file##/}"
- else
- if [[ "${file}" == */* ]]; then
- absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${file%/*}/${absolute_file}"
- else
- absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${absolute_file}"
- fi
- fi
- else
- absolute_file="${intermediate_installation_images_directory}/${PYTHON_ABI}${EPREFIX}/${file}"
- fi
-
- [[ ! -x "${absolute_file}" ]] && continue
-
- shebang="$(head -n1 "${absolute_file}")" || die "Extraction of shebang from '${absolute_file}' failed"
-
- if [[ "${version_executable}" == "2" ]]; then
- wrapper_scripts+=("${ED}${file}")
- elif [[ "${version_executable}" == "1" ]]; then
- if [[ "${shebang}" =~ ${_PYTHON_SHEBANG_BASE_PART_REGEX}([[:digit:]]+(\.[[:digit:]]+)?)?($|[[:space:]]+) ]]; then
- wrapper_scripts+=("${ED}${file}")
- else
- version_executable="0"
- fi
- fi
-
- [[ "${version_executable}" == "0" ]] && continue
-
- if [[ -e "${file}-${PYTHON_ABI}" ]]; then
- die "${FUNCNAME}(): '${EPREFIX}/${file}-${PYTHON_ABI}' already exists"
- fi
-
- mv "${file}" "${file}-${PYTHON_ABI}" || die "Renaming of '${file}' failed"
-
- if [[ "${shebang}" =~ ${_PYTHON_SHEBANG_BASE_PART_REGEX}[[:digit:]]*($|[[:space:]]+) ]]; then
- if [[ -L "${file}-${PYTHON_ABI}" ]]; then
- python_convert_shebangs $([[ "${quiet}" == "1" ]] && echo --quiet) "${PYTHON_ABI}" "${absolute_file}"
- else
- python_convert_shebangs $([[ "${quiet}" == "1" ]] && echo --quiet) "${PYTHON_ABI}" "${file}-${PYTHON_ABI}"
- fi
- fi
- done
-
- popd > /dev/null || die "popd failed"
-
- # This is per bug #390691, without the duplication refactor, and with
- # the 3-way structure per comment #6. This enable users with old
- # coreutils to upgrade a lot easier (you need to upgrade python+portage
- # before coreutils can be upgraded).
- if ROOT="/" has_version '>=sys-apps/coreutils-6.9.90'; then
- cp -fr --preserve=all --no-preserve=context "${intermediate_installation_images_directory}/${PYTHON_ABI}/"* "${D}" || die "Merging of intermediate installation image for Python ABI '${PYTHON_ABI} into installation image failed"
- elif ROOT="/" has_version sys-apps/coreutils; then
- cp -fr --preserve=all "${intermediate_installation_images_directory}/${PYTHON_ABI}/"* "${D}" || die "Merging of intermediate installation image for Python ABI '${PYTHON_ABI} into installation image failed"
- else
- cp -fpr "${intermediate_installation_images_directory}/${PYTHON_ABI}/"* "${D}" || die "Merging of intermediate installation image for Python ABI '${PYTHON_ABI} into installation image failed"
- fi
- done
-
- rm -fr "${intermediate_installation_images_directory}"
-
- if [[ "${#wrapper_scripts[@]}" -ge 1 ]]; then
- rm -f "${T}/python_wrapper_scripts"
-
- for file in "${wrapper_scripts[@]}"; do
- echo -n "${file}" >> "${T}/python_wrapper_scripts"
- echo -en "\x00" >> "${T}/python_wrapper_scripts"
- done
-
- while read -d $'\0' -r file; do
- wrapper_scripts_set+=("${file}")
- done < <("$(PYTHON -f)" -c \
-"import sys
-
-if hasattr(sys.stdout, 'buffer'):
- # Python 3
- stdout = sys.stdout.buffer
-else:
- # Python 2
- stdout = sys.stdout
-
-python_wrapper_scripts_file = open('${T}/python_wrapper_scripts', 'rb')
-files = set(python_wrapper_scripts_file.read().rstrip(${b}'\x00').split(${b}'\x00'))
-python_wrapper_scripts_file.close()
-
-for file in sorted(files):
- stdout.write(file)
- stdout.write(${b}'\x00')" || die "${FUNCNAME}(): Failure of extraction of set of wrapper scripts")
-
- python_generate_wrapper_scripts $([[ "${quiet}" == "1" ]] && echo --quiet) "${wrapper_scripts_set[@]}"
- fi
-}
-
-# ================================================================================================
-# ========= FUNCTIONS FOR PACKAGES NOT SUPPORTING INSTALLATION FOR MULTIPLE PYTHON ABIS ==========
-# ================================================================================================
-
-unset EPYTHON PYTHON_ABI
-
-# @FUNCTION: python_set_active_version
-# @USAGE: <Python_ABI|2|3>
-# @DESCRIPTION:
-# Set locally active version of Python.
-# If Python_ABI argument is specified, then version of Python corresponding to Python_ABI is used.
-# If 2 argument is specified, then active version of CPython 2 is used.
-# If 3 argument is specified, then active version of CPython 3 is used.
-#
-# This function can be used only in pkg_setup() phase.
-python_set_active_version() {
- if [[ "${EBUILD_PHASE}" != "setup" ]]; then
- die "${FUNCNAME}() can be used only in pkg_setup() phase"
- fi
-
- if _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
- fi
-
- if [[ "$#" -ne 1 ]]; then
- die "${FUNCNAME}() requires 1 argument"
- fi
-
- _python_initial_sanity_checks
-
- if [[ -z "${PYTHON_ABI}" ]]; then
- if [[ -n "$(_python_get_implementation --ignore-invalid "$1")" ]]; then
- # PYTHON_ABI variable is intended to be used only in ebuilds/eclasses,
- # so it does not need to be exported to subprocesses.
- PYTHON_ABI="$1"
- if ! _python_implementation && ! has_version "$(python_get_implementational_package)"; then
- die "${FUNCNAME}(): '$(python_get_implementational_package)' is not installed"
- fi
- export EPYTHON="$(PYTHON "$1")"
- elif [[ "$1" == "2" ]]; then
- if ! _python_implementation && ! has_version "=dev-lang/python-2*"; then
- die "${FUNCNAME}(): '=dev-lang/python-2*' is not installed"
- fi
- export EPYTHON="$(PYTHON -2)"
- PYTHON_ABI="${EPYTHON#python}"
- PYTHON_ABI="${PYTHON_ABI%%-*}"
- elif [[ "$1" == "3" ]]; then
- if ! _python_implementation && ! has_version "=dev-lang/python-3*"; then
- die "${FUNCNAME}(): '=dev-lang/python-3*' is not installed"
- fi
- export EPYTHON="$(PYTHON -3)"
- PYTHON_ABI="${EPYTHON#python}"
- PYTHON_ABI="${PYTHON_ABI%%-*}"
- else
- die "${FUNCNAME}(): Unrecognized argument '$1'"
- fi
- fi
-
- _python_final_sanity_checks
-
- # python-updater checks PYTHON_REQUESTED_ACTIVE_VERSION variable.
- PYTHON_REQUESTED_ACTIVE_VERSION="$1"
-}
-
-# @FUNCTION: python_need_rebuild
-# @DESCRIPTION:
-# Mark current package for rebuilding by python-updater after
-# switching of active version of Python.
-python_need_rebuild() {
- if _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
- fi
-
- _python_check_python_pkg_setup_execution
-
- if [[ "$#" -ne 0 ]]; then
- die "${FUNCNAME}() does not accept arguments"
- fi
-
- export PYTHON_NEED_REBUILD="$(PYTHON --ABI)"
-}
-
-# ================================================================================================
-# ======================================= GETTER FUNCTIONS =======================================
-# ================================================================================================
-
-_PYTHON_ABI_EXTRACTION_COMMAND=\
-'import platform
-import sys
-sys.stdout.write(".".join(str(x) for x in sys.version_info[:2]))
-if platform.system()[:4] == "Java":
- sys.stdout.write("-jython")
-elif hasattr(platform, "python_implementation") and platform.python_implementation() == "PyPy":
- sys.stdout.write("-pypy-" + ".".join(str(x) for x in sys.pypy_version_info[:2]))'
-
-_python_get_implementation() {
- local ignore_invalid="0"
-
- while (($#)); do
- case "$1" in
- --ignore-invalid)
- ignore_invalid="1"
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- if [[ "$#" -ne 1 ]]; then
- die "${FUNCNAME}() requires 1 argument"
- fi
-
- if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
- echo "CPython"
- elif [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
- echo "Jython"
- elif [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+-pypy-[[:digit:]]+\.[[:digit:]]+$ ]]; then
- echo "PyPy"
- else
- if [[ "${ignore_invalid}" == "0" ]]; then
- die "${FUNCNAME}(): Unrecognized Python ABI '$1'"
- fi
- fi
-}
-
-# @FUNCTION: PYTHON
-# @USAGE: [-2] [-3] [--ABI] [-a|--absolute-path] [-f|--final-ABI] [--] <Python_ABI="${PYTHON_ABI}">
-# @DESCRIPTION:
-# Print filename of Python interpreter for specified Python ABI. If Python_ABI argument
-# is ommitted, then PYTHON_ABI environment variable must be set and is used.
-# If -2 option is specified, then active version of CPython 2 is used.
-# If -3 option is specified, then active version of CPython 3 is used.
-# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
-# -2, -3 and --final-ABI options and Python_ABI argument cannot be specified simultaneously.
-# If --ABI option is specified, then only specified Python ABI is printed instead of
-# filename of Python interpreter.
-# If --absolute-path option is specified, then absolute path to Python interpreter is printed.
-# --ABI and --absolute-path options cannot be specified simultaneously.
-PYTHON() {
- _python_check_python_pkg_setup_execution
-
- local ABI_output="0" absolute_path_output="0" final_ABI="0" PYTHON_ABI="${PYTHON_ABI}" python_interpreter python2="0" python3="0"
-
- while (($#)); do
- case "$1" in
- -2)
- python2="1"
- ;;
- -3)
- python3="1"
- ;;
- --ABI)
- ABI_output="1"
- ;;
- -a|--absolute-path)
- absolute_path_output="1"
- ;;
- -f|--final-ABI)
- final_ABI="1"
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- if [[ "${ABI_output}" == "1" && "${absolute_path_output}" == "1" ]]; then
- die "${FUNCNAME}(): '--ABI' and '--absolute-path' options cannot be specified simultaneously"
- fi
-
- if [[ "$((${python2} + ${python3} + ${final_ABI}))" -gt 1 ]]; then
- die "${FUNCNAME}(): '-2', '-3' or '--final-ABI' options cannot be specified simultaneously"
- fi
-
- if [[ "$#" -eq 0 ]]; then
- if [[ "${final_ABI}" == "1" ]]; then
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
- _python_calculate_PYTHON_ABIS
- PYTHON_ABI="${PYTHON_ABIS##* }"
- elif [[ "${python2}" == "1" ]]; then
- PYTHON_ABI="$(ROOT="/" eselect python show --python2 --ABI)"
- if [[ -z "${PYTHON_ABI}" ]]; then
- die "${FUNCNAME}(): Active version of CPython 2 not set"
- elif [[ "${PYTHON_ABI}" != "2."* ]]; then
- die "${FUNCNAME}(): Internal error in \`eselect python show --python2\`"
- fi
- elif [[ "${python3}" == "1" ]]; then
- PYTHON_ABI="$(ROOT="/" eselect python show --python3 --ABI)"
- if [[ -z "${PYTHON_ABI}" ]]; then
- die "${FUNCNAME}(): Active version of CPython 3 not set"
- elif [[ "${PYTHON_ABI}" != "3."* ]]; then
- die "${FUNCNAME}(): Internal error in \`eselect python show --python3\`"
- fi
- elif _python_package_supporting_installation_for_multiple_python_abis; then
- if ! _python_abi-specific_local_scope; then
- die "${FUNCNAME}() should be used in ABI-specific local scope"
- fi
- else
- PYTHON_ABI="$("${EPREFIX}/usr/bin/python" -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")"
- if [[ -z "${PYTHON_ABI}" ]]; then
- die "${FUNCNAME}(): Failure of extraction of locally active version of Python"
- fi
- fi
- elif [[ "$#" -eq 1 ]]; then
- if [[ "${final_ABI}" == "1" ]]; then
- die "${FUNCNAME}(): '--final-ABI' option and Python ABI cannot be specified simultaneously"
- fi
- if [[ "${python2}" == "1" ]]; then
- die "${FUNCNAME}(): '-2' option and Python ABI cannot be specified simultaneously"
- fi
- if [[ "${python3}" == "1" ]]; then
- die "${FUNCNAME}(): '-3' option and Python ABI cannot be specified simultaneously"
- fi
- PYTHON_ABI="$1"
- else
- die "${FUNCNAME}(): Invalid usage"
- fi
-
- if [[ "${ABI_output}" == "1" ]]; then
- echo -n "${PYTHON_ABI}"
- return
- else
- if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
- python_interpreter="python${PYTHON_ABI}"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
- python_interpreter="jython${PYTHON_ABI%-jython}"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
- python_interpreter="pypy-c${PYTHON_ABI#*-pypy-}"
- fi
-
- if [[ "${absolute_path_output}" == "1" ]]; then
- echo -n "${EPREFIX}/usr/bin/${python_interpreter}"
- else
- echo -n "${python_interpreter}"
- fi
- fi
-
- if [[ -n "${ABI}" && "${ABI}" != "${DEFAULT_ABI}" && "${DEFAULT_ABI}" != "default" ]]; then
- echo -n "-${ABI}"
- fi
-}
-
-# @FUNCTION: python_get_implementation
-# @USAGE: [-f|--final-ABI]
-# @DESCRIPTION:
-# Print name of Python implementation.
-# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
-python_get_implementation() {
- _python_check_python_pkg_setup_execution
-
- local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"
-
- while (($#)); do
- case "$1" in
- -f|--final-ABI)
- final_ABI="1"
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- die "${FUNCNAME}(): Invalid usage"
- ;;
- esac
- shift
- done
-
- if [[ "${final_ABI}" == "1" ]]; then
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
- PYTHON_ABI="$(PYTHON -f --ABI)"
- else
- if _python_package_supporting_installation_for_multiple_python_abis; then
- if ! _python_abi-specific_local_scope; then
- die "${FUNCNAME}() should be used in ABI-specific local scope"
- fi
- else
- PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
- fi
- fi
-
- echo "$(_python_get_implementation "${PYTHON_ABI}")"
-}
-
-# @FUNCTION: python_get_implementational_package
-# @USAGE: [-f|--final-ABI]
-# @DESCRIPTION:
-# Print category, name and slot of package providing Python implementation.
-# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
-python_get_implementational_package() {
- _python_check_python_pkg_setup_execution
-
- local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"
-
- while (($#)); do
- case "$1" in
- -f|--final-ABI)
- final_ABI="1"
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- die "${FUNCNAME}(): Invalid usage"
- ;;
- esac
- shift
- done
-
- if [[ "${final_ABI}" == "1" ]]; then
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
- PYTHON_ABI="$(PYTHON -f --ABI)"
- else
- if _python_package_supporting_installation_for_multiple_python_abis; then
- if ! _python_abi-specific_local_scope; then
- die "${FUNCNAME}() should be used in ABI-specific local scope"
- fi
- else
- PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
- fi
- fi
-
- if [[ "${EAPI:-0}" == "0" ]]; then
- if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
- echo "=dev-lang/python-${PYTHON_ABI}*"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
- echo "=dev-java/jython-${PYTHON_ABI%-jython}*"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
- echo "=virtual/pypy-${PYTHON_ABI#*-pypy-}*"
- fi
- else
- if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
- echo "dev-lang/python:${PYTHON_ABI}"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
- echo "dev-java/jython:${PYTHON_ABI%-jython}"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
- echo "virtual/pypy:${PYTHON_ABI#*-pypy-}"
- fi
- fi
-}
-
-# @FUNCTION: python_get_includedir
-# @USAGE: [-b|--base-path] [-f|--final-ABI]
-# @DESCRIPTION:
-# Print path to Python include directory.
-# If --base-path option is specified, then path not prefixed with "/" is printed.
-# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
-python_get_includedir() {
- _python_check_python_pkg_setup_execution
-
- local base_path="0" final_ABI="0" prefix PYTHON_ABI="${PYTHON_ABI}"
-
- while (($#)); do
- case "$1" in
- -b|--base-path)
- base_path="1"
- ;;
- -f|--final-ABI)
- final_ABI="1"
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- die "${FUNCNAME}(): Invalid usage"
- ;;
- esac
- shift
- done
-
- if [[ "${base_path}" == "0" ]]; then
- prefix="/"
- fi
-
- if [[ "${final_ABI}" == "1" ]]; then
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
- PYTHON_ABI="$(PYTHON -f --ABI)"
- else
- if _python_package_supporting_installation_for_multiple_python_abis; then
- if ! _python_abi-specific_local_scope; then
- die "${FUNCNAME}() should be used in ABI-specific local scope"
- fi
- else
- PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
- fi
- fi
-
- if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
- echo "${prefix}usr/include/python${PYTHON_ABI}"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
- echo "${prefix}usr/share/jython-${PYTHON_ABI%-jython}/Include"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
- echo "${prefix}usr/$(get_libdir)/pypy${PYTHON_ABI#*-pypy-}/include"
- fi
-}
-
-# @FUNCTION: python_get_libdir
-# @USAGE: [-b|--base-path] [-f|--final-ABI]
-# @DESCRIPTION:
-# Print path to Python standard library directory.
-# If --base-path option is specified, then path not prefixed with "/" is printed.
-# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
-python_get_libdir() {
- _python_check_python_pkg_setup_execution
-
- local base_path="0" final_ABI="0" prefix PYTHON_ABI="${PYTHON_ABI}"
-
- while (($#)); do
- case "$1" in
- -b|--base-path)
- base_path="1"
- ;;
- -f|--final-ABI)
- final_ABI="1"
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- die "${FUNCNAME}(): Invalid usage"
- ;;
- esac
- shift
- done
-
- if [[ "${base_path}" == "0" ]]; then
- prefix="/"
- fi
-
- if [[ "${final_ABI}" == "1" ]]; then
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
- PYTHON_ABI="$(PYTHON -f --ABI)"
- else
- if _python_package_supporting_installation_for_multiple_python_abis; then
- if ! _python_abi-specific_local_scope; then
- die "${FUNCNAME}() should be used in ABI-specific local scope"
- fi
- else
- PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
- fi
- fi
-
- if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
- echo "${prefix}usr/$(get_libdir)/python${PYTHON_ABI}"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
- echo "${prefix}usr/share/jython-${PYTHON_ABI%-jython}/Lib"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
- die "${FUNCNAME}(): PyPy has multiple standard library directories"
- fi
-}
-
-# @FUNCTION: python_get_sitedir
-# @USAGE: [-b|--base-path] [-f|--final-ABI]
-# @DESCRIPTION:
-# Print path to Python site-packages directory.
-# If --base-path option is specified, then path not prefixed with "/" is printed.
-# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
-python_get_sitedir() {
- _python_check_python_pkg_setup_execution
-
- local base_path="0" final_ABI="0" prefix PYTHON_ABI="${PYTHON_ABI}"
-
- while (($#)); do
- case "$1" in
- -b|--base-path)
- base_path="1"
- ;;
- -f|--final-ABI)
- final_ABI="1"
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- die "${FUNCNAME}(): Invalid usage"
- ;;
- esac
- shift
- done
-
- if [[ "${base_path}" == "0" ]]; then
- prefix="/"
- fi
-
- if [[ "${final_ABI}" == "1" ]]; then
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
- PYTHON_ABI="$(PYTHON -f --ABI)"
- else
- if _python_package_supporting_installation_for_multiple_python_abis; then
- if ! _python_abi-specific_local_scope; then
- die "${FUNCNAME}() should be used in ABI-specific local scope"
- fi
- else
- PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
- fi
- fi
-
- if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
- echo "${prefix}usr/$(get_libdir)/python${PYTHON_ABI}/site-packages"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
- echo "${prefix}usr/share/jython-${PYTHON_ABI%-jython}/Lib/site-packages"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
- echo "${prefix}usr/$(get_libdir)/pypy${PYTHON_ABI#*-pypy-}/site-packages"
- fi
-}
-
-# @FUNCTION: python_get_library
-# @USAGE: [-b|--base-path] [-f|--final-ABI] [-l|--linker-option]
-# @DESCRIPTION:
-# Print path to Python library.
-# If --base-path option is specified, then path not prefixed with "/" is printed.
-# If --linker-option is specified, then "-l${library}" linker option is printed.
-# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
-python_get_library() {
- _python_check_python_pkg_setup_execution
-
- local base_path="0" final_ABI="0" linker_option="0" prefix PYTHON_ABI="${PYTHON_ABI}"
-
- while (($#)); do
- case "$1" in
- -b|--base-path)
- base_path="1"
- ;;
- -f|--final-ABI)
- final_ABI="1"
- ;;
- -l|--linker-option)
- linker_option="1"
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- die "${FUNCNAME}(): Invalid usage"
- ;;
- esac
- shift
- done
-
- if [[ "${base_path}" == "0" ]]; then
- prefix="/"
- fi
-
- if [[ "${base_path}" == "1" && "${linker_option}" == "1" ]]; then
- die "${FUNCNAME}(): '--base-path' and '--linker-option' options cannot be specified simultaneously"
- fi
-
- if [[ "${final_ABI}" == "1" ]]; then
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
- PYTHON_ABI="$(PYTHON -f --ABI)"
- else
- if _python_package_supporting_installation_for_multiple_python_abis; then
- if ! _python_abi-specific_local_scope; then
- die "${FUNCNAME}() should be used in ABI-specific local scope"
- fi
- else
- PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
- fi
- fi
-
- if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
- if [[ "${linker_option}" == "1" ]]; then
- echo "-lpython${PYTHON_ABI}"
- else
- echo "${prefix}usr/$(get_libdir)/libpython${PYTHON_ABI}$(get_libname)"
- fi
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
- die "${FUNCNAME}(): Jython does not have shared library"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
- die "${FUNCNAME}(): PyPy does not have shared library"
- fi
-}
-
-# @FUNCTION: python_get_version
-# @USAGE: [-f|--final-ABI] [-l|--language] [--full] [--major] [--minor] [--micro]
-# @DESCRIPTION:
-# Print version of Python implementation.
-# --full, --major, --minor and --micro options cannot be specified simultaneously.
-# If --full, --major, --minor and --micro options are not specified, then "${major_version}.${minor_version}" is printed.
-# If --language option is specified, then version of Python language is printed.
-# --language and --full options cannot be specified simultaneously.
-# --language and --micro options cannot be specified simultaneously.
-# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
-python_get_version() {
- _python_check_python_pkg_setup_execution
-
- local final_ABI="0" language="0" language_version full="0" major="0" minor="0" micro="0" PYTHON_ABI="${PYTHON_ABI}" python_command
-
- while (($#)); do
- case "$1" in
- -f|--final-ABI)
- final_ABI="1"
- ;;
- -l|--language)
- language="1"
- ;;
- --full)
- full="1"
- ;;
- --major)
- major="1"
- ;;
- --minor)
- minor="1"
- ;;
- --micro)
- micro="1"
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- die "${FUNCNAME}(): Invalid usage"
- ;;
- esac
- shift
- done
-
- if [[ "${final_ABI}" == "1" ]]; then
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
- else
- if _python_package_supporting_installation_for_multiple_python_abis && ! _python_abi-specific_local_scope; then
- die "${FUNCNAME}() should be used in ABI-specific local scope"
- fi
- fi
-
- if [[ "$((${full} + ${major} + ${minor} + ${micro}))" -gt 1 ]]; then
- die "${FUNCNAME}(): '--full', '--major', '--minor' or '--micro' options cannot be specified simultaneously"
- fi
-
- if [[ "${language}" == "1" ]]; then
- if [[ "${final_ABI}" == "1" ]]; then
- PYTHON_ABI="$(PYTHON -f --ABI)"
- elif [[ -z "${PYTHON_ABI}" ]]; then
- PYTHON_ABI="$(PYTHON --ABI)"
- fi
- language_version="${PYTHON_ABI%%-*}"
- if [[ "${full}" == "1" ]]; then
- die "${FUNCNAME}(): '--language' and '--full' options cannot be specified simultaneously"
- elif [[ "${major}" == "1" ]]; then
- echo "${language_version%.*}"
- elif [[ "${minor}" == "1" ]]; then
- echo "${language_version#*.}"
- elif [[ "${micro}" == "1" ]]; then
- die "${FUNCNAME}(): '--language' and '--micro' options cannot be specified simultaneously"
- else
- echo "${language_version}"
- fi
- else
- if [[ "${full}" == "1" ]]; then
- python_command="import sys; print('.'.join(str(x) for x in getattr(sys, 'pypy_version_info', sys.version_info)[:3]))"
- elif [[ "${major}" == "1" ]]; then
- python_command="import sys; print(getattr(sys, 'pypy_version_info', sys.version_info)[0])"
- elif [[ "${minor}" == "1" ]]; then
- python_command="import sys; print(getattr(sys, 'pypy_version_info', sys.version_info)[1])"
- elif [[ "${micro}" == "1" ]]; then
- python_command="import sys; print(getattr(sys, 'pypy_version_info', sys.version_info)[2])"
- else
- if [[ -n "${PYTHON_ABI}" && "${final_ABI}" == "0" ]]; then
- if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
- echo "${PYTHON_ABI}"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
- echo "${PYTHON_ABI%-jython}"
- elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
- echo "${PYTHON_ABI#*-pypy-}"
- fi
- return
- fi
- python_command="from sys import version_info; print('.'.join(str(x) for x in version_info[:2]))"
- fi
-
- if [[ "${final_ABI}" == "1" ]]; then
- "$(PYTHON -f)" -c "${python_command}"
- else
- "$(PYTHON ${PYTHON_ABI})" -c "${python_command}"
- fi
- fi
-}
-
-# @FUNCTION: python_get_implementation_and_version
-# @USAGE: [-f|--final-ABI]
-# @DESCRIPTION:
-# Print name and version of Python implementation.
-# If version of Python implementation is not bound to version of Python language, then
-# version of Python language is additionally printed.
-# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
-python_get_implementation_and_version() {
- _python_check_python_pkg_setup_execution
-
- local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"
-
- while (($#)); do
- case "$1" in
- -f|--final-ABI)
- final_ABI="1"
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- die "${FUNCNAME}(): Invalid usage"
- ;;
- esac
- shift
- done
-
- if [[ "${final_ABI}" == "1" ]]; then
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
- PYTHON_ABI="$(PYTHON -f --ABI)"
- else
- if _python_package_supporting_installation_for_multiple_python_abis; then
- if ! _python_abi-specific_local_scope; then
- die "${FUNCNAME}() should be used in ABI-specific local scope"
- fi
- else
- PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
- fi
- fi
-
- if [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-[[:alnum:]]+-[[:digit:]]+\.[[:digit:]]+$ ]]; then
- echo "$(_python_get_implementation "${PYTHON_ABI}") ${PYTHON_ABI##*-} (Python ${PYTHON_ABI%%-*})"
- else
- echo "$(_python_get_implementation "${PYTHON_ABI}") ${PYTHON_ABI%%-*}"
- fi
-}
-
-# ================================================================================================
-# ================================ FUNCTIONS FOR RUNNING OF TESTS ================================
-# ================================================================================================
-
-# @ECLASS-VARIABLE: PYTHON_TEST_VERBOSITY
-# @DESCRIPTION:
-# User-configurable verbosity of tests of Python modules.
-# Supported values: 0, 1, 2, 3, 4.
-PYTHON_TEST_VERBOSITY="${PYTHON_TEST_VERBOSITY:-1}"
-
-_python_test_hook() {
- if [[ "$#" -ne 1 ]]; then
- die "${FUNCNAME}() requires 1 argument"
- fi
-
- if _python_package_supporting_installation_for_multiple_python_abis && [[ "$(type -t "${_PYTHON_TEST_FUNCTION}_$1_hook")" == "function" ]]; then
- "${_PYTHON_TEST_FUNCTION}_$1_hook"
- fi
-}
-
-# @FUNCTION: python_execute_nosetests
-# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
-# @DESCRIPTION:
-# Execute nosetests for all enabled Python ABIs.
-# In ebuilds of packages supporting installation for multiple Python ABIs, this function calls
-# python_execute_nosetests_pre_hook() and python_execute_nosetests_post_hook(), if they are defined.
-python_execute_nosetests() {
- _python_check_python_pkg_setup_execution
- _python_set_color_variables
-
- local PYTHONPATH_template separate_build_dirs
-
- while (($#)); do
- case "$1" in
- -P|--PYTHONPATH)
- PYTHONPATH_template="$2"
- shift
- ;;
- -s|--separate-build-dirs)
- separate_build_dirs="1"
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- python_test_function() {
- local evaluated_PYTHONPATH
-
- eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
-
- _PYTHON_TEST_FUNCTION="python_execute_nosetests" _python_test_hook pre
-
- if [[ -n "${evaluated_PYTHONPATH}" ]]; then
- echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL}
- PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?"
- else
- echo ${_BOLD}nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL}
- nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?"
- fi
-
- _PYTHON_TEST_FUNCTION="python_execute_nosetests" _python_test_hook post
- }
- if _python_package_supporting_installation_for_multiple_python_abis; then
- python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
- else
- if [[ -n "${separate_build_dirs}" ]]; then
- die "${FUNCNAME}(): Invalid usage"
- fi
- python_test_function "$@" || die "Testing failed"
- fi
-
- unset -f python_test_function
-}
-
-# @FUNCTION: python_execute_py.test
-# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
-# @DESCRIPTION:
-# Execute py.test for all enabled Python ABIs.
-# In ebuilds of packages supporting installation for multiple Python ABIs, this function calls
-# python_execute_py.test_pre_hook() and python_execute_py.test_post_hook(), if they are defined.
-python_execute_py.test() {
- _python_check_python_pkg_setup_execution
- _python_set_color_variables
-
- local PYTHONPATH_template separate_build_dirs
-
- while (($#)); do
- case "$1" in
- -P|--PYTHONPATH)
- PYTHONPATH_template="$2"
- shift
- ;;
- -s|--separate-build-dirs)
- separate_build_dirs="1"
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- python_test_function() {
- local evaluated_PYTHONPATH
-
- eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
-
- _PYTHON_TEST_FUNCTION="python_execute_py.test" _python_test_hook pre
-
- if [[ -n "${evaluated_PYTHONPATH}" ]]; then
- echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@"${_NORMAL}
- PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@" || return "$?"
- else
- echo ${_BOLD}py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@"${_NORMAL}
- py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@" || return "$?"
- fi
-
- _PYTHON_TEST_FUNCTION="python_execute_py.test" _python_test_hook post
- }
- if _python_package_supporting_installation_for_multiple_python_abis; then
- python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
- else
- if [[ -n "${separate_build_dirs}" ]]; then
- die "${FUNCNAME}(): Invalid usage"
- fi
- python_test_function "$@" || die "Testing failed"
- fi
-
- unset -f python_test_function
-}
-
-# @FUNCTION: python_execute_trial
-# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
-# @DESCRIPTION:
-# Execute trial for all enabled Python ABIs.
-# In ebuilds of packages supporting installation for multiple Python ABIs, this function
-# calls python_execute_trial_pre_hook() and python_execute_trial_post_hook(), if they are defined.
-python_execute_trial() {
- _python_check_python_pkg_setup_execution
- _python_set_color_variables
-
- local PYTHONPATH_template separate_build_dirs
-
- while (($#)); do
- case "$1" in
- -P|--PYTHONPATH)
- PYTHONPATH_template="$2"
- shift
- ;;
- -s|--separate-build-dirs)
- separate_build_dirs="1"
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- python_test_function() {
- local evaluated_PYTHONPATH
-
- eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
-
- _PYTHON_TEST_FUNCTION="python_execute_trial" _python_test_hook pre
-
- if [[ -n "${evaluated_PYTHONPATH}" ]]; then
- echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL}
- PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?"
- else
- echo ${_BOLD}trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL}
- trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?"
- fi
-
- _PYTHON_TEST_FUNCTION="python_execute_trial" _python_test_hook post
- }
- if _python_package_supporting_installation_for_multiple_python_abis; then
- python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
- else
- if [[ -n "${separate_build_dirs}" ]]; then
- die "${FUNCNAME}(): Invalid usage"
- fi
- python_test_function "$@" || die "Testing failed"
- fi
-
- unset -f python_test_function
-}
-
-# ================================================================================================
-# ======================= FUNCTIONS FOR HANDLING OF BYTE-COMPILED MODULES ========================
-# ================================================================================================
-
-# @FUNCTION: python_enable_pyc
-# @DESCRIPTION:
-# Tell Python to automatically recompile modules to .pyc/.pyo if the
-# timestamps/version stamps have changed.
-python_enable_pyc() {
- _python_check_python_pkg_setup_execution
-
- if [[ "$#" -ne 0 ]]; then
- die "${FUNCNAME}() does not accept arguments"
- fi
-
- unset PYTHONDONTWRITEBYTECODE
-}
-
-# @FUNCTION: python_disable_pyc
-# @DESCRIPTION:
-# Tell Python not to automatically recompile modules to .pyc/.pyo
-# even if the timestamps/version stamps do not match. This is done
-# to protect sandbox.
-python_disable_pyc() {
- _python_check_python_pkg_setup_execution
-
- if [[ "$#" -ne 0 ]]; then
- die "${FUNCNAME}() does not accept arguments"
- fi
-
- export PYTHONDONTWRITEBYTECODE="1"
-}
-
-_python_vecho() {
- [[ -z ${PORTAGE_VERBOSE} ]] || echo "$@"
-}
-
-_python_clean_compiled_modules() {
- _python_initialize_prefix_variables
- _python_set_color_variables
-
- [[ "${FUNCNAME[1]}" =~ ^(python_mod_optimize|python_mod_cleanup)$ ]] || die "${FUNCNAME}(): Invalid usage"
-
- local base_module_name compiled_file compiled_files=() dir path py_file root
-
- # Strip trailing slash from EROOT.
- root="${EROOT%/}"
-
- for path in "$@"; do
- compiled_files=()
- if [[ -d "${path}" ]]; then
- while read -d $'\0' -r compiled_file; do
- compiled_files+=("${compiled_file}")
- done < <(find "${path}" "(" -name "*.py[co]" -o -name "*\$py.class" ")" -print0)
-
- if [[ "${EBUILD_PHASE}" == "postrm" ]]; then
- # Delete empty child directories.
- find "${path}" -type d | sort -r | while read -r dir; do
- if rmdir "${dir}" 2> /dev/null; then
- _python_vecho "<<< ${dir}"
- fi
- done
- fi
- elif [[ "${path}" == *.py ]]; then
- base_module_name="${path##*/}"
- base_module_name="${base_module_name%.py}"
- if [[ -d "${path%/*}/__pycache__" ]]; then
- while read -d $'\0' -r compiled_file; do
- compiled_files+=("${compiled_file}")
- done < <(find "${path%/*}/__pycache__" "(" -name "${base_module_name}.*.py[co]" -o -name "${base_module_name}\$py.class" ")" -print0)
- fi
- compiled_files+=("${path}c" "${path}o" "${path%.py}\$py.class")
- fi
-
- for compiled_file in "${compiled_files[@]}"; do
- [[ ! -f "${compiled_file}" ]] && continue
- dir="${compiled_file%/*}"
- dir="${dir##*/}"
- if [[ "${compiled_file}" == *.py[co] ]]; then
- if [[ "${dir}" == "__pycache__" ]]; then
- base_module_name="${compiled_file##*/}"
- base_module_name="${base_module_name%.*py[co]}"
- base_module_name="${base_module_name%.*}"
- py_file="${compiled_file%__pycache__/*}${base_module_name}.py"
- else
- py_file="${compiled_file%[co]}"
- fi
- if [[ "${EBUILD_PHASE}" == "postinst" ]]; then
- [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue
- else
- [[ -f "${py_file}" ]] && continue
- fi
- _python_vecho "<<< ${compiled_file%[co]}[co]"
- rm -f "${compiled_file%[co]}"[co]
- elif [[ "${compiled_file}" == *\$py.class ]]; then
- if [[ "${dir}" == "__pycache__" ]]; then
- base_module_name="${compiled_file##*/}"
- base_module_name="${base_module_name%\$py.class}"
- py_file="${compiled_file%__pycache__/*}${base_module_name}.py"
- else
- py_file="${compiled_file%\$py.class}.py"
- fi
- if [[ "${EBUILD_PHASE}" == "postinst" ]]; then
- [[ -f "${py_file}" && "${compiled_file}" -nt "${py_file}" ]] && continue
- else
- [[ -f "${py_file}" ]] && continue
- fi
- _python_vecho "<<< ${compiled_file}"
- rm -f "${compiled_file}"
- else
- die "${FUNCNAME}(): Unrecognized file type: '${compiled_file}'"
- fi
-
- # Delete empty parent directories.
- dir="${compiled_file%/*}"
- while [[ "${dir}" != "${root}" ]]; do
- if rmdir "${dir}" 2> /dev/null; then
- _python_vecho "<<< ${dir}"
- else
- break
- fi
- dir="${dir%/*}"
- done
- done
- done
-}
-
-# @FUNCTION: python_mod_optimize
-# @USAGE: [--allow-evaluated-non-sitedir-paths] [-d directory] [-f] [-l] [-q] [-x regular_expression] [--] <file|directory> [files|directories]
-# @DESCRIPTION:
-# Byte-compile specified Python modules.
-# -d, -f, -l, -q and -x options passed to this function are passed to compileall.py.
-#
-# This function can be used only in pkg_postinst() phase.
-python_mod_optimize() {
- if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
- die "${FUNCNAME}() can be used only in pkg_postinst() phase"
- fi
-
- _python_check_python_pkg_setup_execution
- _python_initialize_prefix_variables
-
- if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
- # PYTHON_ABI variable cannot be local in packages not supporting installation for multiple Python ABIs.
- local allow_evaluated_non_sitedir_paths="0" dir dirs=() evaluated_dirs=() evaluated_files=() file files=() iterated_PYTHON_ABIS options=() other_dirs=() other_files=() previous_PYTHON_ABI="${PYTHON_ABI}" return_code root site_packages_dirs=() site_packages_files=() stderr stderr_line
-
- if _python_package_supporting_installation_for_multiple_python_abis; then
- if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then
- die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called"
- fi
- iterated_PYTHON_ABIS="${PYTHON_ABIS}"
- else
- if has "${EAPI:-0}" 0 1 2 3; then
- iterated_PYTHON_ABIS="${PYTHON_ABI:=$(PYTHON --ABI)}"
- else
- iterated_PYTHON_ABIS="${PYTHON_ABI}"
- fi
- fi
-
- # Strip trailing slash from EROOT.
- root="${EROOT%/}"
-
- while (($#)); do
- case "$1" in
- --allow-evaluated-non-sitedir-paths)
- allow_evaluated_non_sitedir_paths="1"
- ;;
- -l|-f|-q)
- options+=("$1")
- ;;
- -d|-x)
- options+=("$1" "$2")
- shift
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- if [[ "${allow_evaluated_non_sitedir_paths}" == "1" ]] && ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
-
- if [[ "$#" -eq 0 ]]; then
- die "${FUNCNAME}(): Missing files or directories"
- fi
-
- while (($#)); do
- if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
- die "${FUNCNAME}(): Invalid argument '$1'"
- elif ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then
- die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
- elif [[ "$1" =~ ^/ ]]; then
- if _python_package_supporting_installation_for_multiple_python_abis; then
- if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
- die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
- fi
- if [[ "$1" != *\$* ]]; then
- die "${FUNCNAME}(): '$1' has invalid syntax"
- fi
- if [[ "$1" == *.py ]]; then
- evaluated_files+=("$1")
- else
- evaluated_dirs+=("$1")
- fi
- else
- if [[ -d "${root}$1" ]]; then
- other_dirs+=("${root}$1")
- elif [[ -f "${root}$1" ]]; then
- other_files+=("${root}$1")
- elif [[ -e "${root}$1" ]]; then
- eerror "${FUNCNAME}(): '${root}$1' is not a regular file or a directory"
- else
- eerror "${FUNCNAME}(): '${root}$1' does not exist"
- fi
- fi
- else
- for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
- if [[ -d "${root}$(python_get_sitedir)/$1" ]]; then
- site_packages_dirs+=("$1")
- break
- elif [[ -f "${root}$(python_get_sitedir)/$1" ]]; then
- site_packages_files+=("$1")
- break
- elif [[ -e "${root}$(python_get_sitedir)/$1" ]]; then
- eerror "${FUNCNAME}(): '$1' is not a regular file or a directory"
- else
- eerror "${FUNCNAME}(): '$1' does not exist"
- fi
- done
- fi
- shift
- done
-
- # Set additional options.
- options+=("-q")
-
- for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
- if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})) || ((${#evaluated_dirs[@]})) || ((${#evaluated_files[@]})); then
- return_code="0"
- stderr=""
- ebegin "Compilation and optimization of Python modules for $(python_get_implementation_and_version)"
- if ((${#site_packages_dirs[@]})) || ((${#evaluated_dirs[@]})); then
- for dir in "${site_packages_dirs[@]}"; do
- dirs+=("${root}$(python_get_sitedir)/${dir}")
- done
- for dir in "${evaluated_dirs[@]}"; do
- eval "dirs+=(\"\${root}${dir}\")"
- done
- stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m compileall "${options[@]}" "${dirs[@]}" 2>&1)" || return_code="1"
- if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
- "$(PYTHON)" -O -m compileall "${options[@]}" "${dirs[@]}" &> /dev/null || return_code="1"
- fi
- _python_clean_compiled_modules "${dirs[@]}"
- fi
- if ((${#site_packages_files[@]})) || ((${#evaluated_files[@]})); then
- for file in "${site_packages_files[@]}"; do
- files+=("${root}$(python_get_sitedir)/${file}")
- done
- for file in "${evaluated_files[@]}"; do
- eval "files+=(\"\${root}${file}\")"
- done
- stderr+="${stderr:+$'\n'}$("$(PYTHON)" -m py_compile "${files[@]}" 2>&1)" || return_code="1"
- if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
- "$(PYTHON)" -O -m py_compile "${files[@]}" &> /dev/null || return_code="1"
- fi
- _python_clean_compiled_modules "${files[@]}"
- fi
- eend "${return_code}"
- if [[ -n "${stderr}" ]]; then
- eerror "Syntax errors / warnings in Python modules for $(python_get_implementation_and_version):" &> /dev/null
- while read stderr_line; do
- eerror " ${stderr_line}"
- done <<< "${stderr}"
- fi
- fi
- unset dirs files
- done
-
- if _python_package_supporting_installation_for_multiple_python_abis; then
- # Restore previous value of PYTHON_ABI.
- if [[ -n "${previous_PYTHON_ABI}" ]]; then
- PYTHON_ABI="${previous_PYTHON_ABI}"
- else
- unset PYTHON_ABI
- fi
- fi
-
- if ((${#other_dirs[@]})) || ((${#other_files[@]})); then
- return_code="0"
- stderr=""
- ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for $(python_get_implementation_and_version)"
- if ((${#other_dirs[@]})); then
- stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m compileall "${options[@]}" "${other_dirs[@]}" 2>&1)" || return_code="1"
- if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
- "$(PYTHON ${PYTHON_ABI})" -O -m compileall "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1"
- fi
- _python_clean_compiled_modules "${other_dirs[@]}"
- fi
- if ((${#other_files[@]})); then
- stderr+="${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" -m py_compile "${other_files[@]}" 2>&1)" || return_code="1"
- if ! has "$(_python_get_implementation "${PYTHON_ABI}")" Jython PyPy; then
- "$(PYTHON ${PYTHON_ABI})" -O -m py_compile "${other_files[@]}" &> /dev/null || return_code="1"
- fi
- _python_clean_compiled_modules "${other_files[@]}"
- fi
- eend "${return_code}"
- if [[ -n "${stderr}" ]]; then
- eerror "Syntax errors / warnings in Python modules placed outside of site-packages directories for $(python_get_implementation_and_version):" &> /dev/null
- while read stderr_line; do
- eerror " ${stderr_line}"
- done <<< "${stderr}"
- fi
- fi
- else
- # Deprecated part of python_mod_optimize()
-
- local myroot mydirs=() myfiles=() myopts=() return_code="0"
-
- # strip trailing slash
- myroot="${EROOT%/}"
-
- # respect EROOT and options passed to compileall.py
- while (($#)); do
- case "$1" in
- -l|-f|-q)
- myopts+=("$1")
- ;;
- -d|-x)
- myopts+=("$1" "$2")
- shift
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- if [[ "$#" -eq 0 ]]; then
- die "${FUNCNAME}(): Missing files or directories"
- fi
-
- while (($#)); do
- if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
- die "${FUNCNAME}(): Invalid argument '$1'"
- elif [[ -d "${myroot}/${1#/}" ]]; then
- mydirs+=("${myroot}/${1#/}")
- elif [[ -f "${myroot}/${1#/}" ]]; then
- myfiles+=("${myroot}/${1#/}")
- elif [[ -e "${myroot}/${1#/}" ]]; then
- eerror "${FUNCNAME}(): ${myroot}/${1#/} is not a regular file or directory"
- else
- eerror "${FUNCNAME}(): ${myroot}/${1#/} does not exist"
- fi
- shift
- done
-
- # set additional opts
- myopts+=(-q)
-
- PYTHON_ABI="${PYTHON_ABI:-$(PYTHON --ABI)}"
-
- ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)"
- if ((${#mydirs[@]})); then
- "$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" || return_code="1"
- "$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/compileall.py" "${myopts[@]}" "${mydirs[@]}" &> /dev/null || return_code="1"
- _python_clean_compiled_modules "${mydirs[@]}"
- fi
-
- if ((${#myfiles[@]})); then
- "$(PYTHON ${PYTHON_ABI})" "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" || return_code="1"
- "$(PYTHON ${PYTHON_ABI})" -O "${myroot}$(python_get_libdir)/py_compile.py" "${myfiles[@]}" &> /dev/null || return_code="1"
- _python_clean_compiled_modules "${myfiles[@]}"
- fi
-
- eend "${return_code}"
- fi
-}
-
-# @FUNCTION: python_mod_cleanup
-# @USAGE: [--allow-evaluated-non-sitedir-paths] [--] <file|directory> [files|directories]
-# @DESCRIPTION:
-# Delete orphaned byte-compiled Python modules corresponding to specified Python modules.
-#
-# This function can be used only in pkg_postrm() phase.
-python_mod_cleanup() {
- if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
- die "${FUNCNAME}() can be used only in pkg_postrm() phase"
- fi
-
- _python_check_python_pkg_setup_execution
- _python_initialize_prefix_variables
-
- local allow_evaluated_non_sitedir_paths="0" dir iterated_PYTHON_ABIS PYTHON_ABI="${PYTHON_ABI}" root search_paths=() sitedir
-
- if _python_package_supporting_installation_for_multiple_python_abis; then
- if has "${EAPI:-0}" 0 1 2 3 && [[ -z "${PYTHON_ABIS}" ]]; then
- die "${FUNCNAME}(): python_pkg_setup() or python_execute_function() not called"
- fi
- iterated_PYTHON_ABIS="${PYTHON_ABIS}"
- else
- if has "${EAPI:-0}" 0 1 2 3; then
- iterated_PYTHON_ABIS="${PYTHON_ABI:-$(PYTHON --ABI)}"
- else
- iterated_PYTHON_ABIS="${PYTHON_ABI}"
- fi
- fi
-
- # Strip trailing slash from EROOT.
- root="${EROOT%/}"
-
- while (($#)); do
- case "$1" in
- --allow-evaluated-non-sitedir-paths)
- allow_evaluated_non_sitedir_paths="1"
- ;;
- --)
- shift
- break
- ;;
- -*)
- die "${FUNCNAME}(): Unrecognized option '$1'"
- ;;
- *)
- break
- ;;
- esac
- shift
- done
-
- if [[ "${allow_evaluated_non_sitedir_paths}" == "1" ]] && ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}(): '--allow-evaluated-non-sitedir-paths' option cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
-
- if [[ "$#" -eq 0 ]]; then
- die "${FUNCNAME}(): Missing files or directories"
- fi
-
- if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis || _python_implementation || [[ "${CATEGORY}/${PN}" == "sys-apps/portage" ]]; then
- while (($#)); do
- if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
- die "${FUNCNAME}(): Invalid argument '$1'"
- elif ! _python_implementation && [[ "$1" =~ ^/usr/lib(32|64)?/python[[:digit:]]+\.[[:digit:]]+ ]]; then
- die "${FUNCNAME}(): Paths of directories / files in site-packages directories must be relative to site-packages directories"
- elif [[ "$1" =~ ^/ ]]; then
- if _python_package_supporting_installation_for_multiple_python_abis; then
- if [[ "${allow_evaluated_non_sitedir_paths}" != "1" ]]; then
- die "${FUNCNAME}(): Absolute paths cannot be used in ebuilds of packages supporting installation for multiple Python ABIs"
- fi
- if [[ "$1" != *\$* ]]; then
- die "${FUNCNAME}(): '$1' has invalid syntax"
- fi
- for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
- eval "search_paths+=(\"\${root}$1\")"
- done
- else
- search_paths+=("${root}$1")
- fi
- else
- for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
- search_paths+=("${root}$(python_get_sitedir)/$1")
- done
- fi
- shift
- done
- else
- # Deprecated part of python_mod_cleanup()
-
- search_paths=("${@#/}")
- search_paths=("${search_paths[@]/#/${root}/}")
- fi
-
- _python_clean_compiled_modules "${search_paths[@]}"
-}
-
-# ================================================================================================
-# ===================================== DEPRECATED FUNCTIONS =====================================
-# ================================================================================================
-
-fi # _PYTHON_ECLASS_INHERITED
^ permalink raw reply related [flat|nested] 33+ messages in thread
* [gentoo-commits] proj/kde-sunset:master commit in: eclass/
@ 2021-04-27 15:48 Andreas Sturmlechner
0 siblings, 0 replies; 33+ messages in thread
From: Andreas Sturmlechner @ 2021-04-27 15:48 UTC (permalink / raw
To: gentoo-commits
commit: 1e7efa77984fe1641798e4bb079c59faf7499a49
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 27 14:40:14 2021 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Tue Apr 27 15:09:24 2021 +0000
URL: https://gitweb.gentoo.org/proj/kde-sunset.git/commit/?id=1e7efa77
distutils.eclass: Drop unused eclass
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
eclass/distutils.eclass | 599 ------------------------------------------------
1 file changed, 599 deletions(-)
diff --git a/eclass/distutils.eclass b/eclass/distutils.eclass
deleted file mode 100644
index 9e0b0b51..00000000
--- a/eclass/distutils.eclass
+++ /dev/null
@@ -1,599 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# @DEAD
-# Removal on 2017-03-18.
-
-# @ECLASS: distutils.eclass
-# @MAINTAINER:
-# kde-sunset overlay maintainers
-# @BLURB: Eclass for packages with build systems using Distutils
-# @DESCRIPTION:
-# The distutils eclass defines phase functions for packages with build systems using Distutils.
-#
-# This eclass is DEPRECATED. Please use distutils-r1 instead.
-
-if [[ -z "${_PYTHON_ECLASS_INHERITED}" ]]; then
- inherit python
-fi
-
-inherit multilib
-
-case "${EAPI:-0}" in
- 6)
- die "${ECLASS}.eclass is banned in EAPI ${EAPI}"
- ;;
- 0|1)
- EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_postinst pkg_postrm
- ;;
- *)
- EXPORT_FUNCTIONS src_prepare src_compile src_install pkg_postinst pkg_postrm
- ;;
-esac
-
-if [[ -z "$(declare -p PYTHON_DEPEND 2> /dev/null)" ]]; then
- DEPEND="dev-lang/python"
- RDEPEND="${DEPEND}"
-fi
-
- if has "${EAPI:-0}" 0 1 && [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
- ewarn
- ewarn "\"${EBUILD}\":"
- ewarn "Deprecation Warning: Usage of distutils.eclass in packages supporting installation"
- ewarn "for multiple Python ABIs in EAPI <=1 is deprecated."
- ewarn "The ebuild should to be fixed. Please report a bug, if it has not been already reported."
- ewarn
- elif has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
- ewarn
- ewarn "\"${EBUILD}\":"
- ewarn "Deprecation Warning: Usage of distutils.eclass in packages not supporting installation"
- ewarn "for multiple Python ABIs in EAPI <=2 is deprecated."
- ewarn "The ebuild should to be fixed. Please report a bug, if it has not been already reported."
- ewarn
- fi
-
-# 'python' variable is deprecated. Use PYTHON() instead.
-if has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
- python="python"
-else
- python="die"
-fi
-
-# @ECLASS-VARIABLE: DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES
-# @DESCRIPTION:
-# Set this to use separate source directories for each enabled version of Python.
-
-# @ECLASS-VARIABLE: DISTUTILS_SETUP_FILES
-# @DESCRIPTION:
-# Array of paths to setup files.
-# Syntax:
-# [current_working_directory|]path_to_setup_file
-
-# @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS
-# @DESCRIPTION:
-# Array of global options passed to setup files.
-# Syntax in EAPI <4:
-# global_option
-# Syntax in EAPI >=4:
-# Python_ABI_pattern global_option
-
-# @ECLASS-VARIABLE: DISTUTILS_SRC_TEST
-# @DESCRIPTION:
-# Type of test command used by distutils_src_test().
-# IUSE and DEPEND are automatically adjusted, unless DISTUTILS_DISABLE_TEST_DEPENDENCY is set.
-# Valid values:
-# setup.py
-# nosetests
-# py.test
-# trial [arguments]
-
-# @ECLASS-VARIABLE: DISTUTILS_DISABLE_TEST_DEPENDENCY
-# @DESCRIPTION:
-# Disable modification of IUSE and DEPEND caused by setting of DISTUTILS_SRC_TEST.
-
-if [[ -n "${DISTUTILS_SRC_TEST}" && ! "${DISTUTILS_SRC_TEST}" =~ ^(setup\.py|nosetests|py\.test|trial(\ .*)?)$ ]]; then
- die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
-fi
-
-if [[ -z "${DISTUTILS_DISABLE_TEST_DEPENDENCY}" ]]; then
- if [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
- IUSE="test"
- DEPEND+="${DEPEND:+ }test? ( dev-python/nose )"
- elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
- IUSE="test"
- DEPEND+="${DEPEND:+ }test? ( dev-python/pytest )"
- # trial requires an argument, which is usually equal to "${PN}".
- elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
- IUSE="test"
- DEPEND+="${DEPEND:+ }test? ( dev-python/twisted-core )"
- fi
-fi
-
-if [[ -n "${DISTUTILS_SRC_TEST}" ]]; then
- EXPORT_FUNCTIONS src_test
-fi
-
-# Scheduled for deletion on 2011-06-01.
-if [[ -n "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" ]]; then
- eerror "Use PYTHON_NONVERSIONED_EXECUTABLES=(\".*\") instead of DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable."
- die "DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable is banned"
-fi
-
-# @ECLASS-VARIABLE: DOCS
-# @DESCRIPTION:
-# Additional documentation files installed by distutils_src_install().
-
-_distutils_get_build_dir() {
- if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
- echo "build-${PYTHON_ABI}"
- else
- echo "build"
- fi
-}
-
-_distutils_get_PYTHONPATH() {
- if _python_package_supporting_installation_for_multiple_python_abis && [[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
- ls -d build-${PYTHON_ABI}/lib* 2> /dev/null
- else
- ls -d build/lib* 2> /dev/null
- fi
-}
-
-_distutils_hook() {
- if [[ "$#" -ne 1 ]]; then
- die "${FUNCNAME}() requires 1 argument"
- fi
- if [[ "$(type -t "distutils_src_${EBUILD_PHASE}_$1_hook")" == "function" ]]; then
- "distutils_src_${EBUILD_PHASE}_$1_hook"
- fi
-}
-
-_distutils_prepare_global_options() {
- local element option pattern
-
- if [[ -n "$(declare -p DISTUTILS_GLOBAL_OPTIONS 2> /dev/null)" && "$(declare -p DISTUTILS_GLOBAL_OPTIONS)" != "declare -a DISTUTILS_GLOBAL_OPTIONS="* ]]; then
- die "DISTUTILS_GLOBAL_OPTIONS should be indexed array"
- fi
-
- if has "${EAPI:-0}" 0 1 2 3; then
- _DISTUTILS_GLOBAL_OPTIONS=("${DISTUTILS_GLOBAL_OPTIONS[@]}")
- else
- _DISTUTILS_GLOBAL_OPTIONS=()
-
- for element in "${DISTUTILS_GLOBAL_OPTIONS[@]}"; do
- if [[ ! "${element}" =~ ^[^[:space:]]+\ . ]]; then
- die "Element '${element}' of DISTUTILS_GLOBAL_OPTIONS array has invalid syntax"
- fi
- pattern="${element%% *}"
- option="${element#* }"
- if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
- _DISTUTILS_GLOBAL_OPTIONS+=("${option}")
- fi
- done
- fi
-}
-
-_distutils_prepare_current_working_directory() {
- if [[ "$1" == *"|"*"|"* ]]; then
- die "Element '$1' of DISTUTILS_SETUP_FILES array has invalid syntax"
- fi
-
- if [[ "$1" == *"|"* ]]; then
- echo "${_BOLD}[${1%|*}]${_NORMAL}"
- pushd "${1%|*}" > /dev/null || die "Entering directory '${1%|*}' failed"
- fi
-}
-
-_distutils_restore_current_working_directory() {
- if [[ "$1" == *"|"* ]]; then
- popd > /dev/null || die "Leaving directory '${1%|*}' failed"
- fi
-}
-
-# @FUNCTION: distutils_src_unpack
-# @DESCRIPTION:
-# The distutils src_unpack function. This function is exported.
-distutils_src_unpack() {
- if ! has "${EAPI:-0}" 0 1; then
- die "${FUNCNAME}() cannot be used in this EAPI"
- fi
-
- if [[ "${EBUILD_PHASE}" != "unpack" ]]; then
- die "${FUNCNAME}() can be used only in src_unpack() phase"
- fi
-
- unpack ${A}
- cd "${S}"
-
- distutils_src_prepare
-}
-
-# @FUNCTION: distutils_src_prepare
-# @DESCRIPTION:
-# The distutils src_prepare function. This function is exported.
-distutils_src_prepare() {
- if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then
- die "${FUNCNAME}() can be used only in src_prepare() phase"
- fi
-
- _python_check_python_pkg_setup_execution
-
- local distribute_setup_existence="0" ez_setup_existence="0"
-
- if [[ "$#" -ne 0 ]]; then
- die "${FUNCNAME}() does not accept arguments"
- fi
-
- # Delete ez_setup files to prevent packages from installing Setuptools on their own.
- [[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence="1"
- rm -fr ez_setup*
- if [[ "${ez_setup_existence}" == "1" ]]; then
- echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py
- fi
-
- # Delete distribute_setup files to prevent packages from installing Distribute on their own.
- [[ -d distribute_setup || -f distribute_setup.py ]] && distribute_setup_existence="1"
- rm -fr distribute_setup*
- if [[ "${distribute_setup_existence}" == "1" ]]; then
- echo "def use_setuptools(*args, **kwargs): pass" > distribute_setup.py
- fi
-
- if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
- python_copy_sources
- fi
-}
-
-# @FUNCTION: distutils_src_compile
-# @DESCRIPTION:
-# The distutils src_compile function. This function is exported.
-# In ebuilds of packages supporting installation for multiple versions of Python, this function
-# calls distutils_src_compile_pre_hook() and distutils_src_compile_post_hook(), if they are defined.
-distutils_src_compile() {
- if [[ "${EBUILD_PHASE}" != "compile" ]]; then
- die "${FUNCNAME}() can be used only in src_compile() phase"
- fi
-
- _python_check_python_pkg_setup_execution
- _python_set_color_variables
-
- local setup_file
-
- if _python_package_supporting_installation_for_multiple_python_abis; then
- distutils_building() {
- _distutils_hook pre
-
- _distutils_prepare_global_options
-
- for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
- _distutils_prepare_current_working_directory "${setup_file}"
-
- echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL}
- "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "$(_distutils_get_build_dir)" "$@" || return "$?"
-
- _distutils_restore_current_working_directory "${setup_file}"
- done
-
- _distutils_hook post
- }
- python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_building "$@"
- unset -f distutils_building
- else
- _distutils_prepare_global_options
-
- for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
- _distutils_prepare_current_working_directory "${setup_file}"
-
- echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"${_NORMAL}
- "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
-
- _distutils_restore_current_working_directory "${setup_file}"
- done
- fi
-}
-
-_distutils_src_test_hook() {
- if [[ "$#" -ne 1 ]]; then
- die "${FUNCNAME}() requires 1 arguments"
- fi
-
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- return
- fi
-
- if [[ "$(type -t "distutils_src_test_pre_hook")" == "function" ]]; then
- eval "python_execute_$1_pre_hook() {
- distutils_src_test_pre_hook
- }"
- fi
-
- if [[ "$(type -t "distutils_src_test_post_hook")" == "function" ]]; then
- eval "python_execute_$1_post_hook() {
- distutils_src_test_post_hook
- }"
- fi
-}
-
-# @FUNCTION: distutils_src_test
-# @DESCRIPTION:
-# The distutils src_test function. This function is exported, when DISTUTILS_SRC_TEST variable is set.
-# In ebuilds of packages supporting installation for multiple versions of Python, this function
-# calls distutils_src_test_pre_hook() and distutils_src_test_post_hook(), if they are defined.
-distutils_src_test() {
- if [[ "${EBUILD_PHASE}" != "test" ]]; then
- die "${FUNCNAME}() can be used only in src_test() phase"
- fi
-
- _python_check_python_pkg_setup_execution
- _python_set_color_variables
-
- local arguments setup_file
-
- if [[ "${DISTUTILS_SRC_TEST}" == "setup.py" ]]; then
- if _python_package_supporting_installation_for_multiple_python_abis; then
- distutils_testing() {
- _distutils_hook pre
-
- _distutils_prepare_global_options
-
- for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
- _distutils_prepare_current_working_directory "${setup_file}"
-
- echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@"${_NORMAL}
- PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$@" || return "$?"
-
- _distutils_restore_current_working_directory "${setup_file}"
- done
-
- _distutils_hook post
- }
- python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_testing "$@"
- unset -f distutils_testing
- else
- _distutils_prepare_global_options
-
- for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
- _distutils_prepare_current_working_directory "${setup_file}"
-
- echo ${_BOLD}PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL}
- PYTHONPATH="$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed"
-
- _distutils_restore_current_working_directory "${setup_file}"
- done
- fi
- elif [[ "${DISTUTILS_SRC_TEST}" == "nosetests" ]]; then
- _distutils_src_test_hook nosetests
-
- python_execute_nosetests -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
- elif [[ "${DISTUTILS_SRC_TEST}" == "py.test" ]]; then
- _distutils_src_test_hook py.test
-
- python_execute_py.test -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@"
- # trial requires an argument, which is usually equal to "${PN}".
- elif [[ "${DISTUTILS_SRC_TEST}" =~ ^trial(\ .*)?$ ]]; then
- if [[ "${DISTUTILS_SRC_TEST}" == "trial "* ]]; then
- arguments="${DISTUTILS_SRC_TEST#trial }"
- else
- arguments="${PN}"
- fi
-
- _distutils_src_test_hook trial
-
- python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} -- ${arguments} "$@"
- else
- die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SRC_TEST}'"
- fi
-}
-
-# @FUNCTION: distutils_src_install
-# @DESCRIPTION:
-# The distutils src_install function. This function is exported.
-# In ebuilds of packages supporting installation for multiple versions of Python, this function
-# calls distutils_src_install_pre_hook() and distutils_src_install_post_hook(), if they are defined.
-# It also installs some standard documentation files (AUTHORS, Change*, CHANGELOG, CONTRIBUTORS,
-# KNOWN_BUGS, MAINTAINERS, NEWS, README*, TODO).
-distutils_src_install() {
- if [[ "${EBUILD_PHASE}" != "install" ]]; then
- die "${FUNCNAME}() can be used only in src_install() phase"
- fi
-
- _python_check_python_pkg_setup_execution
- _python_initialize_prefix_variables
- _python_set_color_variables
-
- local default_docs doc line nspkg_pth_file nspkg_pth_files=() setup_file
-
- if _python_package_supporting_installation_for_multiple_python_abis; then
- distutils_installation() {
- _distutils_hook pre
-
- _distutils_prepare_global_options
-
- for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
- _distutils_prepare_current_working_directory "${setup_file}"
-
- echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --no-compile --root="${T}/images/${PYTHON_ABI}" "$@"${_NORMAL}
- "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") install --no-compile --root="${T}/images/${PYTHON_ABI}" "$@" || return "$?"
-
- _distutils_restore_current_working_directory "${setup_file}"
- done
-
- _distutils_hook post
- }
- python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s} distutils_installation "$@"
- unset -f distutils_installation
-
- python_merge_intermediate_installation_images "${T}/images"
- else
- # Mark the package to be rebuilt after a Python upgrade.
- python_need_rebuild
-
- _distutils_prepare_global_options
-
- for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do
- _distutils_prepare_current_working_directory "${setup_file}"
-
- echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"${_NORMAL}
- "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
-
- _distutils_restore_current_working_directory "${setup_file}"
- done
- fi
-
- while read -d $'\0' -r nspkg_pth_file; do
- nspkg_pth_files+=("${nspkg_pth_file}")
- done < <(find "${ED}" -name "*-nspkg.pth" -type f -print0)
-
- if [[ "${#nspkg_pth_files[@]}" -gt 0 ]]; then
- einfo
- einfo "Python namespaces:"
- for nspkg_pth_file in "${nspkg_pth_files[@]}"; do
- einfo " '${nspkg_pth_file#${ED%/}}':"
- while read -r line; do
- einfo " $(echo "${line}" | sed -e "s/.*types\.ModuleType('\([^']\+\)').*/\1/")"
- done < "${nspkg_pth_file}"
- #if ! has "${EAPI:-0}" 0 1 2 3; then
- # rm -f "${nspkg_pth_file}" || die "Deletion of '${nspkg_pth_file}' failed"
- #fi
- done
- einfo
- fi
-
- if [[ -e "${ED}usr/local" ]]; then
- die "Illegal installation into /usr/local"
- fi
-
- default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS NEWS README* TODO"
-
- for doc in ${default_docs}; do
- [[ -s "${doc}" ]] && dodoc "${doc}"
- done
-
- if has "${EAPI:-0}" 0 1 2 3; then
- if [[ -n "${DOCS}" ]]; then
- dodoc ${DOCS} || die "dodoc failed"
- fi
- else
- if [[ -n "${DOCS}" ]]; then
- dodoc -r ${DOCS} || die "dodoc failed"
- fi
- fi
-
- DISTUTILS_SRC_INSTALL_EXECUTED="1"
-}
-
-# @FUNCTION: distutils_pkg_postinst
-# @DESCRIPTION:
-# The distutils pkg_postinst function. This function is exported.
-# When PYTHON_MODNAME variable is set, then this function calls python_mod_optimize() with modules
-# specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_optimize() with module, whose
-# name is equal to name of current package, if this module exists.
-distutils_pkg_postinst() {
- if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
- die "${FUNCNAME}() can be used only in pkg_postinst() phase"
- fi
-
- _python_check_python_pkg_setup_execution
- _python_initialize_prefix_variables
-
- if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then
- die "${FUNCNAME}() called illegally"
- fi
-
- local pylibdir pymod
-
- if [[ "$#" -ne 0 ]]; then
- die "${FUNCNAME}() does not accept arguments"
- fi
-
- if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
- for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
- if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
- PYTHON_MODNAME="${PN}"
- fi
- done
- fi
-
- if [[ -n "${PYTHON_MODNAME}" ]]; then
- if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
- python_mod_optimize ${PYTHON_MODNAME}
- else
- for pymod in ${PYTHON_MODNAME}; do
- python_mod_optimize "$(python_get_sitedir)/${pymod}"
- done
- fi
- fi
-}
-
-# @FUNCTION: distutils_pkg_postrm
-# @DESCRIPTION:
-# The distutils pkg_postrm function. This function is exported.
-# When PYTHON_MODNAME variable is set, then this function calls python_mod_cleanup() with modules
-# specified in PYTHON_MODNAME variable. Otherwise it calls python_mod_cleanup() with module, whose
-# name is equal to name of current package, if this module exists.
-distutils_pkg_postrm() {
- if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
- die "${FUNCNAME}() can be used only in pkg_postrm() phase"
- fi
-
- _python_check_python_pkg_setup_execution
- _python_initialize_prefix_variables
-
- if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then
- die "${FUNCNAME}() called illegally"
- fi
-
- local pylibdir pymod
-
- if [[ "$#" -ne 0 ]]; then
- die "${FUNCNAME}() does not accept arguments"
- fi
-
- if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then
- for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/jython-*/Lib; do
- if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then
- PYTHON_MODNAME="${PN}"
- fi
- done
- fi
-
- if [[ -n "${PYTHON_MODNAME}" ]]; then
- if ! has "${EAPI:-0}" 0 1 2 || _python_package_supporting_installation_for_multiple_python_abis; then
- python_mod_cleanup ${PYTHON_MODNAME}
- else
- for pymod in ${PYTHON_MODNAME}; do
- for pylibdir in "${EROOT}"usr/$(get_libdir)/python*; do
- if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then
- python_mod_cleanup "${pylibdir#${EROOT%/}}/site-packages/${pymod}"
- fi
- done
- done
- fi
- fi
-}
-
-# @FUNCTION: distutils_get_intermediate_installation_image
-# @DESCRIPTION:
-# Print path to intermediate installation image.
-#
-# This function can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook().
-distutils_get_intermediate_installation_image() {
- if [[ "${EBUILD_PHASE}" != "install" ]]; then
- die "${FUNCNAME}() can be used only in src_install() phase"
- fi
-
- if ! _python_package_supporting_installation_for_multiple_python_abis; then
- die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs"
- fi
-
- _python_check_python_pkg_setup_execution
-
- if [[ ! "${FUNCNAME[1]}" =~ ^distutils_src_install_(pre|post)_hook$ ]]; then
- die "${FUNCNAME}() can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook()"
- fi
-
- if [[ "$#" -ne 0 ]]; then
- die "${FUNCNAME}() does not accept arguments"
- fi
-
- echo "${T}/images/${PYTHON_ABI}"
-}
^ permalink raw reply related [flat|nested] 33+ messages in thread
end of thread, other threads:[~2021-04-27 15:49 UTC | newest]
Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-20 12:06 [gentoo-commits] proj/kde-sunset:master commit in: eclass/ Andreas Sturmlechner
-- strict thread matches above, loose matches on Subject: below --
2021-04-27 15:48 Andreas Sturmlechner
2021-04-27 15:48 Andreas Sturmlechner
2020-12-07 20:53 Andreas Sturmlechner
2020-11-30 2:19 Andreas Sturmlechner
2020-11-30 2:19 Andreas Sturmlechner
2020-11-30 2:19 Andreas Sturmlechner
2020-11-30 2:19 Andreas Sturmlechner
2020-11-30 2:19 Andreas Sturmlechner
2020-08-25 14:59 Andreas Sturmlechner
2020-08-25 14:51 Andreas Sturmlechner
2020-08-23 19:46 Andreas Sturmlechner
2020-08-16 20:05 Andreas Sturmlechner
2020-08-13 14:50 Andreas Sturmlechner
2020-08-13 14:50 Andreas Sturmlechner
2020-08-13 14:50 Andreas Sturmlechner
2020-08-13 14:50 Andreas Sturmlechner
2018-09-12 20:41 Andreas Sturmlechner
2018-06-30 8:45 Andreas Sturmlechner
2018-06-30 8:45 Andreas Sturmlechner
2018-06-20 12:08 Andreas Sturmlechner
2018-05-31 20:31 Andreas Sturmlechner
2018-05-31 18:30 Andreas Sturmlechner
2018-05-31 18:30 Andreas Sturmlechner
2018-05-03 12:30 Andreas Sturmlechner
2018-04-10 13:32 Andreas Sturmlechner
2018-04-06 0:53 Andreas Sturmlechner
2016-12-17 19:08 Johannes Huber
2016-08-03 20:18 Johannes Huber
2016-04-24 7:07 Lars Wendler
2015-04-28 19:16 Ian Stakenvicius
2013-11-13 22:24 Lars Wendler
2011-05-05 21:11 Ladislav Láska
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox