diff --git a/dev-lang/python-exec/Manifest b/dev-lang/python-exec/Manifest
deleted file mode 100644
index 38525a6..0000000
--- a/dev-lang/python-exec/Manifest
+++ /dev/null
@@ -1,6 +0,0 @@
-DIST python-exec-2.4.6.tar.bz2 87634 BLAKE2B 7b6de8ad0e0603fafd3284e6e3c5247ad83f145ab4db6728914318ae8e6f5aaa3c0247f4e01238fca11519ef72fb1b11436aea7e2b8c988b8717b3f6a2a43c37 SHA512 e05eaf01b83de196a10933636ab6b1a5489a421592df49b8b58eabd0e732de970f902744cd3a06b5ab530a6d69fe6dfa8f270fbb09b9fe3df4ae04d516828050
-DIST python-exec-2.4.8.tar.bz2 82671 BLAKE2B ac85f3dd6da3d1c535ad56a25edbbcb1d0e75b91e3567b80f27fd01d32a199a713909a8552dffaacbe96c43bca491f31c3f0c7f1a618fb9144814365686715cf SHA512 d6dabab217dc2f1817e2f4d159102a9467f51b26b91f4ae7fb7e4930d30334f74bd8a5f37cc60d58c6e1e61e89a3b4d2e1bd17413493ba86f38fa71250cf5ac1
-EBUILD python-exec-2.4.6-r2.ebuild 4111 BLAKE2B c70a015b3c9bf6df3b8ad5ee1f27969d90be6648404c2f07b6f42bbb72ef28f35d16d753e7d1e36ab0b77e918c56101e9d9e72340a833fe74bd6730f1c5b8e32 SHA512 1e32339a0c067d75dbd6f258640db3561124f6dcda20c14e30e7936985c35a84dc2e5be4348f209eed22b17841047cf30f79869b38cec90d40a81b4ea951fa94
-EBUILD python-exec-2.4.6-r4.ebuild 1707 BLAKE2B 01a09d32da3497e4ff171b43c81eee667a6c0f5ebdfa230a342ab0ee3a5586a41de653f043fbc3dde12dd40e506e2a67467e23ab18e5d50504a900ceb422b3b3 SHA512 1c934b5eb453959130e0f8c490b767325d92ef412fb91d6a9f4fde90609a1e28c749d1e1dd25dc605503ea96fb19b614b47e16fb75dff78e23317fec6582201b
-EBUILD python-exec-2.4.8.ebuild 2006 BLAKE2B f4b4a241ab543def85a6b152b63768e875128028f04ed6436f7dca1448ffad6d595cfd8ada0475846f9fe97adda6938a03817d4573a874fb3b67aadba351d7a9 SHA512 5410833d99f03f3fe14de17f3ca8083a5ef7b427c7285f98c0ebc4efbab9a61e38210353bcde7661d7458755786991fedbe738479ca139966f3272d1b3cd3215
-MISC metadata.xml 791 BLAKE2B ba836a4142e78972a7a6b603749bb4df0fe99cf0f054e286d9ede512db5cdab18f18fa484036e9ef7e19c20afcf1c94b70d0f813e7790dbd9decda996dd53713 SHA512 be18445f875537d03532d2ab30241951c2abc0929b382c351eda05003fd84cd84c545018941117bec5a2f74e2e2a1dd17b60bb2dae99eb81909826947ceabba9
diff --git a/dev-lang/python-exec/metadata.xml b/dev-lang/python-exec/metadata.xml
deleted file mode 100644
index cef85cf..0000000
--- a/dev-lang/python-exec/metadata.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
- python@gentoo.org
- Python
-
-
-
- mgorny@gentoo.org
- Michał Górny
-
- https://github.com/mgorny/python-exec/issues/
- mgorny/python-exec
-
-
-
diff --git a/dev-lang/python-exec/python-exec-2.4.6-r2.ebuild b/dev-lang/python-exec/python-exec-2.4.6-r2.ebuild
deleted file mode 100644
index a7e6678..0000000
--- a/dev-lang/python-exec/python-exec-2.4.6-r2.ebuild
+++ /dev/null
@@ -1,126 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit xpython-utils-r1
-
-DESCRIPTION="Python script wrapper"
-HOMEPAGE="https://github.com/mgorny/python-exec/"
-SRC_URI="https://github.com/mgorny/python-exec/releases/download/v${PV}/${P}.tar.bz2"
-
-LICENSE="BSD-2"
-SLOT="2"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-# Internal Python project hack. Do not copy it. Ever.
-IUSE="${_PYTHON_ALL_IMPLS[@]/#/python_targets_}"
-
-RDEPEND="!<=dev-lang/python-2.7.18-r3:2.7"
-
-src_configure() {
- local pyimpls=() i EPYTHON
- for i in "${_PYTHON_ALL_IMPLS[@]}"; do
- if use "python_targets_${i}"; then
- _python_export "${i}" EPYTHON
- pyimpls+=( "${EPYTHON}" )
- fi
- done
-
- local myconf=(
- --with-fallback-path="${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin"
- --with-python-impls="${pyimpls[*]}"
- )
-
- econf "${myconf[@]}"
-}
-
-src_install() {
- default
-
- # Prepare and own the template
- insinto /etc/python-exec
- newins - python-exec.conf \
- < <(sed -n -e '/^#/p' config/python-exec.conf.example)
-
- local programs=( python python3 )
- local scripts=( python-config python3-config 2to3 idle pydoc pyvenv )
-
- local f
- for f in "${programs[@]}"; do
- # symlink the C wrapper for python to avoid shebang recursion
- # bug #568974
- dosym python-exec2c /usr/bin/"${f}"
- done
- for f in "${scripts[@]}"; do
- # those are python scripts (except for new python-configs)
- # so symlink them via the python wrapper
- dosym ../lib/python-exec/python-exec2 /usr/bin/"${f}"
- done
-}
-
-pkg_preinst() {
- if [[ -e ${EROOT}/etc/python-exec/python-exec.conf ]]; then
- # preserve current configuration
- cp "${EROOT}"/etc/python-exec/python-exec.conf \
- "${ED}"/etc/python-exec/python-exec.conf || die
- else
- # preserve previous Python version preference
- local py old_pythons=()
- local config_base=${EROOT}/etc/env.d/python
-
- # start with the 'global' preference (2 vs 3)
- if [[ -f ${config_base}/config ]]; then
- old_pythons+=( "$(<${config_base}/config)" )
- fi
-
- # then try specific py3 selection
- for py in 3; do
- local target=
-
- if [[ -f ${config_base}/python${py} ]]; then
- # try the newer config files
- target=$(<${config_base}/python${py})
- elif [[ -L ${EROOT}/usr/bin/python${py} ]]; then
- # check the older symlink format
- target=$(readlink "${EROOT}/usr/bin/python${py}")
-
- # check if it's actually old eselect symlink
- [[ ${target} == python?.? ]] || target=
- fi
-
- # add the extra target if found and != global
- if [[ ${target} && ${old_pythons[0]} != ${target} ]]; then
- old_pythons+=( "${target}" )
- fi
- done
-
- if [[ ${old_pythons[@]} ]]; then
- elog "You seem to have just upgraded into the new version of python-exec"
- elog "that uses python-exec.conf for configuration. The ebuild has attempted"
- elog "to convert your previous configuration to the new format, resulting"
- elog "in the following preferences (most preferred version first):"
- elog
- for py in "${old_pythons[@]}"; do
- elog " ${py}"
- done
- elog
- elog "Those interpreters will be preferred when running Python scripts or"
- elog "calling wrapped Python executables (python, python2, pydoc...)."
- elog "If none of the preferred interpreters are supported, python-exec will"
- elog "fall back to the newest supported Python version."
- elog
- elog "Please note that due to the ambiguous character of the old settings,"
- elog "you may want to modify the preference list yourself. In order to do so,"
- elog "open the following file in your favorite editor:"
- elog
- elog " ${EROOT}/etc/python-exec/python-exec.conf"
- elog
- elog "For more information on the new configuration format, please read"
- elog "the comment on top of the installed configuration file."
-
- local IFS=$'\n'
- echo "${old_pythons[*]}" \
- >> "${ED}"/etc/python-exec/python-exec.conf || die
- fi
- fi
-}
diff --git a/dev-lang/python-exec/python-exec-2.4.6-r4.ebuild b/dev-lang/python-exec/python-exec-2.4.6-r4.ebuild
deleted file mode 100644
index fd6f8c1..0000000
--- a/dev-lang/python-exec/python-exec-2.4.6-r4.ebuild
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit xpython-utils-r1
-
-DESCRIPTION="Python script wrapper"
-HOMEPAGE="https://github.com/mgorny/python-exec/"
-SRC_URI="https://github.com/mgorny/python-exec/releases/download/v${PV}/${P}.tar.bz2"
-
-LICENSE="BSD-2"
-SLOT="2"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-# Internal Python project hack. Do not copy it. Ever.
-IUSE="${_PYTHON_ALL_IMPLS[@]/#/python_targets_} +native-symlinks"
-
-RDEPEND="
- dev-lang/python-exec-conf
- !<=dev-lang/python-2.7.18-r3:2.7"
-
-src_configure() {
- local pyimpls=() i EPYTHON
- for i in "${_PYTHON_ALL_IMPLS[@]}"; do
- if use "python_targets_${i}"; then
- _python_export "${i}" EPYTHON
- pyimpls+=( "${EPYTHON}" )
- fi
- done
-
- local myconf=(
- --with-fallback-path="${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin"
- --with-python-impls="${pyimpls[*]}"
- )
-
- econf "${myconf[@]}"
-}
-
-src_install() {
- default
-
- if use native-symlinks; then
- local programs=( python python3 )
- local scripts=( python-config python3-config 2to3 idle pydoc pyvenv )
-
- local f
- for f in "${programs[@]}"; do
- # symlink the C wrapper for python to avoid shebang recursion
- # bug #568974
- dosym python-exec2c /usr/bin/"${f}"
- done
- for f in "${scripts[@]}"; do
- # those are python scripts (except for new python-configs)
- # so symlink them via the python wrapper
- dosym ../lib/python-exec/python-exec2 /usr/bin/"${f}"
- done
- fi
-}
diff --git a/dev-lang/python-exec/python-exec-2.4.8.ebuild b/dev-lang/python-exec/python-exec-2.4.8.ebuild
deleted file mode 100644
index bfd2316..0000000
--- a/dev-lang/python-exec/python-exec-2.4.8.ebuild
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-PYTHON_COMPAT=( python2_7 python3_{8..9} pypy3 )
-inherit xpython-any-r1
-
-DESCRIPTION="Python script wrapper"
-HOMEPAGE="https://github.com/mgorny/python-exec/"
-SRC_URI="https://github.com/mgorny/python-exec/releases/download/v${PV}/${P}.tar.bz2"
-
-LICENSE="BSD-2"
-SLOT="2"
-KEYWORDS="~alpha amd64 ~arm ~arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-# Internal Python project hack. Do not copy it. Ever.
-IUSE="${_PYTHON_ALL_IMPLS[@]/#/python_targets_} +native-symlinks test"
-RESTRICT="!test? ( test )"
-
-RDEPEND="
- dev-lang/python-exec-conf
- !<=dev-lang/python-2.7.18-r3:2.7"
-BDEPEND="
- test? (
- $(python_gen_any_dep 'dev-python/pytest[${PYTHON_USEDEP}]')
- )"
-
-python_check_deps() {
- has_version -b "dev-python/pytest[${PYTHON_USEDEP}]"
-}
-
-pkg_setup() {
- use test && python-any-r1_pkg_setup
-}
-
-src_configure() {
- local pyimpls=() i EPYTHON
- for i in "${_PYTHON_ALL_IMPLS[@]}"; do
- if use "python_targets_${i}"; then
- _python_export "${i}" EPYTHON
- pyimpls+=( "${EPYTHON}" )
- fi
- done
-
- local myconf=(
- --with-fallback-path="${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin"
- --with-python-impls="${pyimpls[*]}"
- )
-
- econf "${myconf[@]}"
-}
-
-src_install() {
- default
-
- if use native-symlinks; then
- local programs=( python python3 )
- local scripts=( python-config python3-config 2to3 idle pydoc pyvenv )
-
- local f
- for f in "${programs[@]}"; do
- # symlink the C wrapper for python to avoid shebang recursion
- # bug #568974
- dosym python-exec2c /usr/bin/"${f}"
- done
- for f in "${scripts[@]}"; do
- # those are python scripts (except for new python-configs)
- # so symlink them via the python wrapper
- dosym ../lib/python-exec/python-exec2 /usr/bin/"${f}"
- done
- fi
-}
diff --git a/dev-python/certifi/Manifest b/dev-python/certifi/Manifest
deleted file mode 100644
index c404ab3..0000000
--- a/dev-python/certifi/Manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-DIST certifi-shim-10001.tar.gz 4061 BLAKE2B 183c573b958921877b14e38e9e26842e8a4f1c1617979a30b65ef1e2bbf001e5ff0aab830e4399906a7d21fb3c71ac12b1e757e4d283aae16cced8e7de7c2a1d SHA512 93beea61e579b2b414bd37c63eba49365e0a1a62304e0c7ac920bedaf5d72cb095a4a46b2240b3c2e6ee31e5b91cd520ae8348b6a8033212d11bbca31db6750c
-EBUILD certifi-10001.ebuild 902 BLAKE2B 97f9a2e18780debd206c4abce55311973520b50c3a1789fc6c81abeba4a6c13a0bb0d86d59fd0666ffaf965d184ea80eaaa6eb89e359dcdb0f851f3472c244c5 SHA512 b32fcb211474a8639e15b54658dfaaf5136a1904e8d7d40558905de9cc02b7fde14a69d2ba7e73ff0ec17064fed98ac316b93a592f142a4e34e532b2631fbcea
-MISC metadata.xml 345 BLAKE2B 5cf437570a10505d4c41abd959ebea978c42c94d48bc28c83f6d8d707e71941ac74d6a9c11d95ff498eb0b1f6299ddc2d458da4cd1bb260c9854ed8e13d53e3e SHA512 27e9fe335402d355adbdad8adc1267903e8eed49a535cf00858b01f8ed05a07511038cdeb6841641d934b0fc5c8649d344dec7e2a5fade97d0b7fa38858cbae9
diff --git a/dev-python/certifi/certifi-10001.ebuild b/dev-python/certifi/certifi-10001.ebuild
deleted file mode 100644
index 595441d..0000000
--- a/dev-python/certifi/certifi-10001.ebuild
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-DISTUTILS_USE_SETUPTOOLS=no
-PYTHON_COMPAT=( python2_7 )
-
-inherit xdistutils-r1
-
-MY_P=certifi-shim-${PV}
-DESCRIPTION="Thin replacement for certifi using system certificate store"
-HOMEPAGE="
- https://github.com/mgorny/certifi-shim/
- https://pypi.org/project/certifi/"
-SRC_URI="
- https://github.com/mgorny/certifi-shim/archive/v${PV}.tar.gz
- -> ${MY_P}.tar.gz"
-S=${WORKDIR}/${MY_P}
-
-LICENSE="CC0-1.0"
-SLOT="2.7"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-
-RDEPEND="app-misc/ca-certificates"
-
-distutils_enable_tests unittest
-
-src_prepare() {
- sed -i -e "s^/etc^${EPREFIX}/etc^" certifi/core.py || die
- distutils-r1_src_prepare
-}
diff --git a/dev-python/certifi/metadata.xml b/dev-python/certifi/metadata.xml
deleted file mode 100644
index 2c9c847..0000000
--- a/dev-python/certifi/metadata.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
- python@gentoo.org
- Python
-
-
-
- certifi
-
-
diff --git a/dev-python/numpy/Manifest b/dev-python/numpy/Manifest
deleted file mode 100644
index 3c23540..0000000
--- a/dev-python/numpy/Manifest
+++ /dev/null
@@ -1,8 +0,0 @@
-AUX numpy-1.15.4-no-hardcode-blas.patch 3841 BLAKE2B 19ddde096b5b0b1d3c0a98e16c14b96cf9c16ec5d96736ec561f14535fe240eaa8fbe71f396d432ce557b78b18a98ad8684724614f201b1d6151c8edfd07f483 SHA512 8f870f8a52c096f6f0f614dc64ff6d5ed8d8805e14723c60c6e85b69cf915fc698e808f3fcafce75a6ea9e7eb728949dc56ef823d70963d25658e50aa8becaae
-AUX numpy-1.16.5-setup.py-install-skip-build-fails.patch 916 BLAKE2B 0745e076d4338b2591111c89183e6779c7461e73f4d9ec81b561fa6577da5840c268ce2ce5502d846d2a2e43ef74d4ce28be1dbd3fafee9ea955f81b8d3479db SHA512 f1708b76a7b1e308153b01f73bdf314d9a1fd7f57505bf0ed2da708097fdbc7735574520b99d32c76130e5bfef2bb74a45c683ef5f6b791dee153e29a8e87db2
-DIST numpy-1.16.5.zip 5138208 BLAKE2B f5511650e66939a6ce21cfad7874aecdeb6c07a70b32419a808956e42c7819d82bb364f1632da91b4d8a5237001c8ae3cbdcac10651fa0acca9558bdeafb5437 SHA512 6dd790ff57fdb7e7b0bddb47ea2b70b2667edefe632548ec68934e12a16af4a51bed9726e495c4993aad4c448dc4a204d0a087577d43dcfc9fa0164eb1d4b898
-DIST numpy-html-1.16.4.zip 12097069 BLAKE2B db1f897342fbc80a761fbaee7b0eee3761dbfa04ef6c46a137bb2392caaec8256580467ce06498cceeada2639151a1ec75dafab484d64cb897c008727d6d32a5 SHA512 c44c5e1e0cb22f9dd46fe9e302030292d85e567456178fee296746a414271634e906509fb6665ac63fbfebdd13c5383574f0aa47b4fbc639063da31addc3316a
-DIST numpy-ref-1.16.4.pdf 5176571 BLAKE2B 9a875ebd1473b241d463d810a6d191581aef961158f2f82959671b554ace3ad482795e4f3e1cb7dd4632cff926c1e864c675a7624fb0f4e4f297948bf50f0564 SHA512 983ba0f34a70c011886bdbc9fd8f3f75a3a967ca29217acc76fa46e7da391296a5628c9a557ac76efb393271abfb8ee4f376d401c1cc1e5c30622e54b9325d09
-DIST numpy-user-1.16.4.pdf 596203 BLAKE2B da3ad1f0ec1c965d20656f73a970911cbb58efa73a5df89e2e6485e0dd763f483e35eea1395ac919bf35d496fb216cee954fc5d31edebc1796a24a2a7a2d12b9 SHA512 3083008547213bfa98ffa5cd8e2cea13f6947f42d83aef61502a2a852b0d5f27d727c76b42d281d7a2f4f76c78e88b12ee3d9b164b39fe1f0213ace7097357d6
-EBUILD numpy-1.16.5-r1.ebuild 4452 BLAKE2B 28979efd08dcf36234cd17d443f2314e0b78c8cf8f700bf4613bc7eb21460c69dc0a95d3c462e2828d4e9fb1699b739adc6e507a48fd27972372547a420ab77e SHA512 17672cde0f70d2460d6c108b7df59ccaa971815d1ee9339b4eb47cc814fbd0dd0dda449725f7892755ae7251ee17f1082673496045ecc3eedda84add18bb7eea
-MISC metadata.xml 876 BLAKE2B 5e257d6ea3c59c5819d854db7b7db3ebff53b5c87b5ce9348786085f09db12aa6fc8fa86393b9e6c06760ac0d9f36a52fdfb1865c9d1d9ad5526d74d3d53e8b1 SHA512 d35d0954ff8f21e370edeab3ce3e5ab501bf216c93399e807ede6f1910ba0ea41359425bf894d813a39442fb92a724fe83ec8a5c64e6bd97de9422f67700d549
diff --git a/dev-python/numpy/files/numpy-1.15.4-no-hardcode-blas.patch b/dev-python/numpy/files/numpy-1.15.4-no-hardcode-blas.patch
deleted file mode 100644
index 979b56b..0000000
--- a/dev-python/numpy/files/numpy-1.15.4-no-hardcode-blas.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
-index 65d7de316..a85640d30 100644
---- a/numpy/distutils/system_info.py
-+++ b/numpy/distutils/system_info.py
-@@ -364,29 +364,7 @@ def get_info(name, notfound_action=0):
- 1 - display warning message
- 2 - raise error
- """
-- cl = {'atlas': atlas_info, # use lapack_opt or blas_opt instead
-- 'atlas_threads': atlas_threads_info, # ditto
-- 'atlas_blas': atlas_blas_info,
-- 'atlas_blas_threads': atlas_blas_threads_info,
-- 'lapack_atlas': lapack_atlas_info, # use lapack_opt instead
-- 'lapack_atlas_threads': lapack_atlas_threads_info, # ditto
-- 'atlas_3_10': atlas_3_10_info, # use lapack_opt or blas_opt instead
-- 'atlas_3_10_threads': atlas_3_10_threads_info, # ditto
-- 'atlas_3_10_blas': atlas_3_10_blas_info,
-- 'atlas_3_10_blas_threads': atlas_3_10_blas_threads_info,
-- 'lapack_atlas_3_10': lapack_atlas_3_10_info, # use lapack_opt instead
-- 'lapack_atlas_3_10_threads': lapack_atlas_3_10_threads_info, # ditto
-- 'mkl': mkl_info,
-- # openblas which may or may not have embedded lapack
-- 'openblas': openblas_info, # use blas_opt instead
-- # openblas with embedded lapack
-- 'openblas_lapack': openblas_lapack_info, # use blas_opt instead
-- 'openblas_clapack': openblas_clapack_info, # use blas_opt instead
-- 'blis': blis_info, # use blas_opt instead
-- 'lapack_mkl': lapack_mkl_info, # use lapack_opt instead
-- 'blas_mkl': blas_mkl_info, # use blas_opt instead
-- 'accelerate': accelerate_info, # use blas_opt instead
-- 'x11': x11_info,
-+ cl = {'x11': x11_info,
- 'fft_opt': fft_opt_info,
- 'fftw': fftw_info,
- 'fftw2': fftw2_info,
-@@ -731,10 +709,7 @@ class system_info(object):
- return [b for b in [a.strip() for a in libs.split(',')] if b]
-
- def get_libraries(self, key='libraries'):
-- if hasattr(self, '_lib_names'):
-- return self.get_libs(key, default=self._lib_names)
-- else:
-- return self.get_libs(key, '')
-+ return self.get_libs(key, '')
-
- def library_extensions(self):
- c = customized_ccompiler()
-@@ -1685,7 +1660,7 @@ class blas_info(system_info):
- lib = self.has_cblas(info)
- if lib is not None:
- info['language'] = 'c'
-- info['libraries'] = [lib]
-+ info['libraries'] = lib
- info['define_macros'] = [('HAVE_CBLAS', None)]
- self.set_info(**info)
-
-@@ -1717,16 +1692,16 @@ class blas_info(system_info):
- # check for cblas lib, and if not present check for blas lib.
- try:
- c.link_executable(obj, os.path.join(tmpdir, "a.out"),
-- libraries=["cblas"],
-+ libraries=info["libraries"],
- library_dirs=info['library_dirs'],
- extra_postargs=info.get('extra_link_args', []))
-- res = "cblas"
-+ res = info["libraries"]
- except distutils.ccompiler.LinkError:
- c.link_executable(obj, os.path.join(tmpdir, "a.out"),
- libraries=["blas"],
- library_dirs=info['library_dirs'],
- extra_postargs=info.get('extra_link_args', []))
-- res = "blas"
-+ res = ["blas"]
- except distutils.ccompiler.CompileError:
- res = None
- finally:
diff --git a/dev-python/numpy/files/numpy-1.16.5-setup.py-install-skip-build-fails.patch b/dev-python/numpy/files/numpy-1.16.5-setup.py-install-skip-build-fails.patch
deleted file mode 100644
index aa141de..0000000
--- a/dev-python/numpy/files/numpy-1.16.5-setup.py-install-skip-build-fails.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From b8e741c66f71071c3406e592e1537570731bcb35 Mon Sep 17 00:00:00 2001
-From: mattip
-Date: Sun, 26 May 2019 08:55:53 +0300
-Subject: [PATCH] BUG: setup.py install --skip-build fails
-
----
- numpy/distutils/command/install_clib.py | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/numpy/distutils/command/install_clib.py b/numpy/distutils/command/install_clib.py
-index 662aa00bda9..6a73f7e3308 100644
---- a/numpy/distutils/command/install_clib.py
-+++ b/numpy/distutils/command/install_clib.py
-@@ -19,6 +19,9 @@ def finalize_options(self):
-
- def run (self):
- build_clib_cmd = get_cmd("build_clib")
-+ if not build_clib_cmd.build_clib:
-+ # can happen if the user specified `--skip-build`
-+ build_clib_cmd.finalize_options()
- build_dir = build_clib_cmd.build_clib
-
- # We need the compiler to get the library name -> filename association
diff --git a/dev-python/numpy/metadata.xml b/dev-python/numpy/metadata.xml
deleted file mode 100644
index 2890261..0000000
--- a/dev-python/numpy/metadata.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
- sci@gentoo.org
- Gentoo Science Project
-
-
- python@gentoo.org
- Python
-
-
- NumPy is a general-purpose array-processing Python package designed to
- efficiently manipulate large multi-dimensional arrays of arbitrary
- records without sacrificing too much speed for small multi-dimensional
- arrays. There are also basic facilities for discrete fourier transform,
- basic linear algebra and random number generation.
- It is the successor of Numeric and numarray.
-
-
- numpy
-
-
diff --git a/dev-python/numpy/numpy-1.16.5-r1.ebuild b/dev-python/numpy/numpy-1.16.5-r1.ebuild
deleted file mode 100644
index c0f8c05..0000000
--- a/dev-python/numpy/numpy-1.16.5-r1.ebuild
+++ /dev/null
@@ -1,163 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI="7"
-
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="threads(+)"
-
-FORTRAN_NEEDED=lapack
-
-inherit xdistutils-r1 flag-o-matic fortran-2 multiprocessing toolchain-funcs
-
-DOC_PV="1.16.4"
-DESCRIPTION="Fast array and numerical python library"
-HOMEPAGE="https://www.numpy.org"
-SRC_URI="
- mirror://pypi/${PN:0:1}/${PN}/${P}.zip
- doc? (
- https://numpy.org/doc/$(ver_cut 1-2 ${DOC_PV})/numpy-html.zip -> numpy-html-${DOC_PV}.zip
- https://numpy.org/doc/$(ver_cut 1-2 ${DOC_PV})/numpy-ref.pdf -> numpy-ref-${DOC_PV}.pdf
- https://numpy.org/doc/$(ver_cut 1-2 ${DOC_PV})/numpy-user.pdf -> numpy-user-${DOC_PV}.pdf
- )"
-LICENSE="BSD"
-SLOT="2.7"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
-IUSE="doc lapack test"
-RESTRICT="!test? ( test )"
-
-RDEPEND="
- dev-python/setuptools[${PYTHON_USEDEP}]
- lapack? (
- virtual/cblas
- virtual/lapack
- )"
-DEPEND="${RDEPEND}"
-BDEPEND="app-arch/unzip
- lapack? ( virtual/pkgconfig )
- test? (
- dev-python/pytest[${PYTHON_USEDEP}]
- )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-1.15.4-no-hardcode-blas.patch
- "${FILESDIR}"/numpy-1.16.5-setup.py-install-skip-build-fails.patch
-)
-
-src_unpack() {
- default
- if use doc; then
- unzip -qo "${DISTDIR}"/numpy-html-${DOC_PV}.zip -d html || die
- fi
-}
-
-pc_incdir() {
- $(tc-getPKG_CONFIG) --cflags-only-I $@ | \
- sed -e 's/^-I//' -e 's/[ ]*-I/:/g' -e 's/[ ]*$//' -e 's|^:||'
-}
-
-pc_libdir() {
- $(tc-getPKG_CONFIG) --libs-only-L $@ | \
- sed -e 's/^-L//' -e 's/[ ]*-L/:/g' -e 's/[ ]*$//' -e 's|^:||'
-}
-
-pc_libs() {
- $(tc-getPKG_CONFIG) --libs-only-l $@ | \
- sed -e 's/[ ]-l*\(pthread\|m\)\([ ]\|$\)//g' \
- -e 's/^-l//' -e 's/[ ]*-l/,/g' -e 's/[ ]*$//' \
- | tr ',' '\n' | sort -u | tr '\n' ',' | sed -e 's|,$||'
-}
-
-python_prepare_all() {
- if use lapack; then
- append-ldflags "$($(tc-getPKG_CONFIG) --libs-only-other cblas lapack)"
- local incdir="${EPREFIX}"/usr/include
- local libdir="${EPREFIX}"/usr/$(get_libdir)
- cat >> site.cfg <<-EOF || die
- [blas]
- include_dirs = $(pc_incdir cblas):${incdir}
- library_dirs = $(pc_libdir cblas blas):${libdir}
- blas_libs = $(pc_libs cblas blas)
- [lapack]
- library_dirs = $(pc_libdir lapack):${libdir}
- lapack_libs = $(pc_libs lapack)
- EOF
- else
- export {ATLAS,PTATLAS,BLAS,LAPACK,MKL}=None
- fi
-
- export CC="$(tc-getCC) ${CFLAGS}"
-
- append-flags -fno-strict-aliasing
-
- # See progress in http://projects.scipy.org/scipy/numpy/ticket/573
- # with the subtle difference that we don't want to break Darwin where
- # -shared is not a valid linker argument
- if [[ ${CHOST} != *-darwin* ]]; then
- append-ldflags -shared
- fi
-
- # only one fortran to link with:
- # linking with cblas and lapack library will force
- # autodetecting and linking to all available fortran compilers
- append-fflags -fPIC
- if use lapack; then
- NUMPY_FCONFIG="config_fc --noopt --noarch"
- # workaround bug 335908
- [[ $(tc-getFC) == *gfortran* ]] && NUMPY_FCONFIG+=" --fcompiler=gnu95"
- fi
-
- # remove f2py
- cp setup.py setup.py.orig || die
- grep -v 'f2py = ' setup.py.orig > setup.py || die
-
- # don't version f2py, we will handle it.
- sed -i -e '/f2py_exe/s: + os\.path.*$::' numpy/f2py/setup.py || die
-
- # disable fuzzed tests
- find numpy/*/tests -name '*.py' -exec sed -i \
- -e 's:def \(.*_fuzz\):def _\1:' {} + || die
- # very memory- and disk-hungry
- sed -i -e 's:test_large_zip:_&:' numpy/lib/tests/test_io.py || die
-
- distutils-r1_python_prepare_all
-}
-
-python_compile() {
- export MAKEOPTS=-j1 #660754
-
- local python_makeopts_jobs=""
- python_is_python3 || python_makeopts_jobs="-j $(makeopts_jobs)"
- distutils-r1_python_compile \
- ${python_makeopts_jobs} \
- ${NUMPY_FCONFIG}
-}
-
-python_test() {
- distutils_install_for_testing --single-version-externally-managed \
- --record "${TMPDIR}/record.txt" ${NUMPY_FCONFIG}
-
- cd "${TMPDIR}" || die
-
- "${EPYTHON}" -c "
-import numpy, sys
-r = numpy.test(label='full', verbose=3)
-sys.exit(0 if r else 1)" || die "Tests fail with ${EPYTHON}"
-}
-
-python_install() {
- # https://github.com/numpy/numpy/issues/16005
- local mydistutilsargs=( build_src )
- distutils-r1_python_install ${NUMPY_FCONFIG}
-}
-
-python_install_all() {
- local DOCS=( THANKS.txt )
-
- if use doc; then
- local HTML_DOCS=( "${WORKDIR}"/html/. )
- DOCS+=( "${DISTDIR}"/${PN}-{user,ref}-${DOC_PV}.pdf )
- fi
-
- distutils-r1_python_install_all
-}
diff --git a/dev-python/pygame/Manifest b/dev-python/pygame/Manifest
deleted file mode 100644
index a8302f1..0000000
--- a/dev-python/pygame/Manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-DIST pygame-1.9.6.tar.gz 3223131 BLAKE2B a4d04c933fcad244d32bd512ef8717e60ec923f361e9e0296b5c7d57c5949d3434a040d028249c5b8f3c865ac3dcdbb32e6f0b223186678595a8625213ba2a17 SHA512 d923c554203a7c35e37921658cb4c5bf50215ab0ff4d2b869a1ee6b2e2ca31d66ec4bbde4287f5a777838ffe932cd15b993cb0224b86e43d684de61c35acbcd0
-EBUILD pygame-1.9.6-r1.ebuild 2295 BLAKE2B 6c23ecc71e4662de7ea7135c588c9d11a1341784d9eca225d6c58393af0530750d0c19236b0c2826180d735e31916e16d8351b4b6caa1c6ab53d30afdffc4cac SHA512 e35cbe1ef44c6093614bd94f58bb8c14cce9743355196180c766c7309cbd22a211514ac552284bc07f08d354a527ac04b682e8bc25d7551c9ac0a584e9450133
-MISC metadata.xml 408 BLAKE2B ae371ef164069765d0964da714a83c9898ddc190ac295c5ad5bbb6a3c45db5aa415d84ff21dbaa510e5c9852397e6b6b389684c54b67d83d675afd9b3d9a697e SHA512 a6e06c0bed59d5157166577a2dafa53f28a310c56f251bec36af077a79342c6f954fa63a3fa8d3546ca03cc9358e75eeb1ef04c6e0371e43e0b7bff51ffe35dd
diff --git a/dev-python/pygame/metadata.xml b/dev-python/pygame/metadata.xml
deleted file mode 100644
index f00627a..0000000
--- a/dev-python/pygame/metadata.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- python@gentoo.org
- Python
-
-
-
- pygame
-
-
diff --git a/dev-python/pygame/pygame-1.9.6-r1.ebuild b/dev-python/pygame/pygame-1.9.6-r1.ebuild
deleted file mode 100644
index c29f577..0000000
--- a/dev-python/pygame/pygame-1.9.6-r1.ebuild
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-PYTHON_COMPAT=( python2_7 )
-
-inherit flag-o-matic xdistutils-r1
-
-DESCRIPTION="Python bindings for SDL multimedia library"
-HOMEPAGE="https://www.pygame.org/"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
-
-LICENSE="LGPL-2.1"
-SLOT="2.7"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ppc ~ppc64 sparc x86"
-IUSE="doc examples midi opengl test X"
-RESTRICT="!test? ( test )"
-
-RDEPEND="dev-python/numpy:2.7[${PYTHON_USEDEP}]
- >=media-libs/sdl-image-1.2.2[png,jpeg]
- >=media-libs/sdl-mixer-1.2.4
- >=media-libs/sdl-ttf-2.0.6
- >=media-libs/smpeg-0.4.4-r1
- midi? ( media-libs/portmidi )
- X? ( >=media-libs/libsdl-1.2.5[opengl?,video,X] )
- !X? ( >=media-libs/libsdl-1.2.5 )"
-DEPEND="${RDEPEND}
- test? (
- media-libs/sdl-image[gif,png,jpeg]
- media-libs/sdl-mixer[mp3,vorbis,wav]
- )"
-# fontconfig used for fc-list
-RDEPEND+="
- media-libs/fontconfig"
-# util-linux provides script
-BDEPEND="
- test? (
- media-libs/fontconfig
- sys-apps/util-linux
- )"
-
-src_prepare() {
- # segfaults on Xvfb
- rm test/scrap_test.py || die
- # backport from git master (clock() isn't used)
- sed -i -e '/from time import clock/d' test/math_test.py || die
-
- distutils-r1_src_prepare
-}
-
-python_configure() {
- PORTMIDI_INC_PORTTIME=1 LOCALBASE="${EPREFIX}/usr" \
- "${EPYTHON}" "${S}"/buildconfig/config.py -auto
-
- if ! use X; then
- sed -e "s:^scrap :#&:" -i Setup || die "sed failed"
- fi
-
- # Disable automagic dependency on PortMidi.
- if ! use midi; then
- sed -e "s:^pypm :#&:" -i Setup || die "sed failed"
- fi
-}
-
-python_compile() {
- if [[ ${EPYTHON} == python2* ]]; then
- local CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}
-
- append-flags -fno-strict-aliasing
- fi
-
- distutils-r1_python_compile
-}
-
-python_test() {
- local -x PYTHONPATH=
- local -x SDL_VIDEODRIVER=dummy
- local -x SDL_AUDIODRIVER=disk
- distutils_install_for_testing
- script -eqc "${EPYTHON} -m pygame.tests" || die
-}
-
-python_install() {
- distutils-r1_python_install
-
- # Bug #497720
- rm -fr "${D}"$(python_get_sitedir)/pygame/{docs,examples,tests}/ || die
-}
-
-python_install_all() {
- distutils-r1_python_install_all
-
- if use doc; then
- docinto html
- dodoc -r docs/*
- fi
-
- if use examples; then
- insinto /usr/share/doc/${PF}/examples
- doins -r examples/*
- fi
-}
diff --git a/dev-python/pyserial/Manifest b/dev-python/pyserial/Manifest
deleted file mode 100644
index 8597dc2..0000000
--- a/dev-python/pyserial/Manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-DIST pyserial-3.5.tar.gz 159125 BLAKE2B 6be1930afc6cfecad54cd7a116a0e93085d166907acb4c2fa5b7b9485ec28cfb6dc9e7ffc13ae5628c344ef0f78c15bdd828b8d51048a484548538cf14b9da20 SHA512 c8df5e50d952d5a6dcf1d9253a6ba953e9763c545a867da66c22c90dfa015aba0194f2a8f29a229d0a5f4dc8bfeeaaab8bcfda4066ed78a18b151bc05e6ae327
-EBUILD pyserial-3.5.ebuild 766 BLAKE2B 489919c97a5ed826fa1fe2fb30703668ac437803f69f4bfdf5f5ed4941ce2af13ed089be7a2ec82461245c7fce79fc0a6549211a732f628222ccb13b60b55147 SHA512 32e46454e7eacc1ea81bb218965a34ee6edee6ef874071c2aa382c877372ab5774846801b23bd05db1ced08e9805de8703b329349314194ac58dc1a6c40093c2
-MISC metadata.xml 421 BLAKE2B f3c94b0b72c3df17d9c539e8b76e1f644e0b4ae1bb3d905652b568084e449bf11cab07f27e7775031eee857095671debd28bf1d2eb8c1992c6b980620b32109b SHA512 30c1232aed930c665c2603443cbff9efbb843b1866d6a4d034a517e0669f28f1e6e7562103a8badbd8fb1efd9e69b058870b9c4fcea8fa5e74e7a1ec8ba17fde
diff --git a/dev-python/pyserial/metadata.xml b/dev-python/pyserial/metadata.xml
deleted file mode 100644
index 9cabbe4..0000000
--- a/dev-python/pyserial/metadata.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- python@gentoo.org
- Python
-
-
- pyserial
- pyserial
- pyserial/pyserial
-
-
diff --git a/dev-python/pyserial/pyserial-3.5.ebuild b/dev-python/pyserial/pyserial-3.5.ebuild
deleted file mode 100644
index e5567af..0000000
--- a/dev-python/pyserial/pyserial-3.5.ebuild
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-PYTHON_COMPAT=( python2_7 )
-
-inherit xdistutils-r1
-
-DESCRIPTION="Python Serial Port extension"
-HOMEPAGE="https://github.com/pyserial/pyserial https://pypi.org/project/pyserial/"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
-
-LICENSE="PSF-2"
-SLOT="2.7"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86"
-IUSE="examples"
-
-DOCS=( CHANGES.rst README.rst )
-
-python_test() {
- "${EPYTHON}" test/run_all_tests.py loop:// -v || die "Testing failed with ${EPYTHON}"
-}
-
-python_install_all() {
- distutils-r1_python_install_all
- if use examples; then
- dodoc -r examples
- docompress -x /usr/share/doc/${PF}/examples
- fi
-}
diff --git a/dev-python/setuptools/Manifest b/dev-python/setuptools/Manifest
deleted file mode 100644
index 07d9b55..0000000
--- a/dev-python/setuptools/Manifest
+++ /dev/null
@@ -1,3 +0,0 @@
-DIST setuptools-46.4.0.zip 865912 BLAKE2B 452d36132f5648c79c7e1616a93ff6a39ab2f64b2864ee397b4f57e7f72c47d418ff274f5decd35b0591b09800ad2a7cbd71c283550bd0e60a4d85744a57d4ec SHA512 31e58fd1d682089a45d23aa07c3c2c4c952ca016fa4c3416b2cba979d8b57369f80baef98ce857912e506e87d6cb456497a1ce1c75a0cdf1ee25d4e753b58726
-EBUILD setuptools-46.4.0-r3.ebuild 2243 BLAKE2B b5e95a89fad14e885b434439558f78317d8349cea8fdbe93e5e36845d6ad6719f5f8d6af7f0d8731494749cf6494ee945360b367afbea3152457eceeb7e99e77 SHA512 d7de3441472689ae99b707118b2e90e6503483510af1e67b33a95f6214a85e14c85391756c11228e5ad1e1c6c8b58d74389b0946f010876c55f75ac7f85f2998
-MISC metadata.xml 468 BLAKE2B 5f9a9240795261f894d54130ba489bb18fd24f8f95f993b55d23136fb2b518f47b64494d71ab0f697ca64f4eacc8cb58487e8889a8de22e8e3448caba5498065 SHA512 e284933f2a5d11cf7bb483776b8de2afe96ccad15a0e0bf7c9feab05c65f4247c9b19bb60c04d699ba917a637ca470e6ba41a38795899e54179602b587efe300
diff --git a/dev-python/setuptools/metadata.xml b/dev-python/setuptools/metadata.xml
deleted file mode 100644
index bd9e6b5..0000000
--- a/dev-python/setuptools/metadata.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
- python@gentoo.org
- Python
-
-
-
- setuptools
- pypa/setuptools
- cpe:/a:python:setuptools
-
-
diff --git a/dev-python/setuptools/setuptools-46.4.0-r3.ebuild b/dev-python/setuptools/setuptools-46.4.0-r3.ebuild
deleted file mode 100644
index dc850ea..0000000
--- a/dev-python/setuptools/setuptools-46.4.0-r3.ebuild
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-# Set to 'manual' to avoid triggering install QA check
-DISTUTILS_USE_SETUPTOOLS=manual
-PYTHON_COMPAT=( python2_7 )
-PYTHON_REQ_USE="xml(+)"
-
-inherit xdistutils-r1
-
-DESCRIPTION="Collection of extensions to Distutils"
-HOMEPAGE="https://github.com/pypa/setuptools https://pypi.org/project/setuptools/"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.zip"
-
-LICENSE="MIT"
-SLOT="2.7"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE="test"
-RESTRICT="!test? ( test )"
-
-BDEPEND="
- app-arch/unzip
-"
-# installing plugins apparently breaks stuff at runtime, so let's pull
-# it early
-PDEPEND="
- >=dev-python/certifi-2016.9.26:2.7[${PYTHON_USEDEP}]
- $(python_gen_cond_dep '
- dev-python/setuptools_scm[${PYTHON_USEDEP}]
- ' -3)"
-
-# Force in-source build because build system modifies sources.
-DISTUTILS_IN_SOURCE_BUILD=1
-
-DOCS=( {CHANGES,README}.rst docs/{easy_install.txt,pkg_resources.txt,setuptools.txt} )
-
-python_prepare_all() {
- # silence the py2 warning that is awfully verbose and breaks some
- # packages by adding unexpected output
- # (also, we know!)
- sed -i -e '/py2_warn/d' pkg_resources/__init__.py || die
-
- # disable tests requiring a network connection
- rm setuptools/tests/test_packageindex.py || die
-
- # don't run integration tests
- rm setuptools/tests/test_integration.py || die
-
- # xpass-es for me on py3
- sed -e '/xfail.*710/s:(:(six.PY2, :' \
- -i setuptools/tests/test_archive_util.py || die
-
- # avoid pointless dep on flake8
- sed -i -e 's:--flake8::' pytest.ini || die
-
- distutils-r1_python_prepare_all
-}
-
-python_test() {
- if ! python_is_python3; then
- einfo "Tests are skipped on py2 to untangle deps"
- return
- fi
-
- distutils_install_for_testing
- # test_easy_install raises a SandboxViolation due to ${HOME}/.pydistutils.cfg
- # It tries to sandbox the test in a tempdir
- HOME="${PWD}" pytest -vv ${PN} || die "Tests failed under ${EPYTHON}"
-}
-
-python_install() {
- export DISTRIBUTE_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT=1
- distutils-r1_python_install
-}
diff --git a/eclass/kernel-2a.eclass b/eclass/kernel-2a.eclass
deleted file mode 100644
index ab4fe4e..0000000
--- a/eclass/kernel-2a.eclass
+++ /dev/null
@@ -1,1258 +0,0 @@
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.284 2013/04/29 22:14:23 tomwij Exp $
-
-# Description: kernel.eclass rewrite for a clean base regarding the 2.6
-# series of kernel with back-compatibility for 2.4
-#
-# Original author: John Mylchreest
-# Maintainer: kernel-misc@gentoo.org
-#
-# Please direct your bugs to the current eclass maintainer :)
-
-# added functionality:
-# unipatch - a flexible, singular method to extract, add and remove patches.
-
-# A Couple of env vars are available to effect usage of this eclass
-# These are as follows:
-#
-# K_USEPV - When setting the EXTRAVERSION variable, it should
-# add PV to the end.
-# this is useful for thigns like wolk. IE:
-# EXTRAVERSION would be something like : -wolk-4.19-r1
-# K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be
-# automatically set within the kernel Makefile
-# K_NOUSENAME - if this is set then EXTRAVERSION will not include the
-# first part of ${PN} in EXTRAVERSION
-# K_NOUSEPR - if this is set then EXTRAVERSION will not include the
-# anything based on ${PR}.
-# K_PREPATCHED - if the patchset is prepatched (ie: mm-sources,
-# ck-sources, ac-sources) it will use PR (ie: -r5) as
-# the patchset version for
-# and not use it as a true package revision
-# K_EXTRAEINFO - this is a new-line seperated list of einfo displays in
-# postinst and can be used to carry additional postinst
-# messages
-# K_EXTRAELOG - same as K_EXTRAEINFO except using elog instead of einfo
-# K_EXTRAEWARN - same as K_EXTRAEINFO except using ewarn instead of einfo
-# K_SYMLINK - if this is set, then forcably create symlink anyway
-#
-# K_DEFCONFIG - Allow specifying a different defconfig target.
-# If length zero, defaults to "defconfig".
-# K_WANT_GENPATCHES - Apply genpatches to kernel source. Provide any
-# combination of "base" and "extras"
-# K_GENPATCHES_VER - The version of the genpatches tarball(s) to apply.
-# A value of "5" would apply genpatches-2.6.12-5 to
-# my-sources-2.6.12.ebuild
-# K_SECURITY_UNSUPPORTED- If set, this kernel is unsupported by Gentoo Security
-# K_DEBLOB_AVAILABLE - A value of "0" will disable all of the optional deblob
-# code. If empty, will be set to "1" if deblobbing is
-# possible. Test ONLY for "1".
-# K_PREDEBLOBBED - This kernel was already deblobbed elsewhere.
-# If false, either optional deblobbing will be available
-# or the license will note the inclusion of freedist
-# code.
-# K_LONGTERM - If set, the eclass will search for the kernel source
-# in the long term directories on the upstream servers
-# as the location has been changed by upstream
-# H_SUPPORTEDARCH - this should be a space separated list of ARCH's which
-# can be supported by the headers ebuild
-
-# UNIPATCH_LIST - space delimetered list of patches to be applied to the
-# kernel
-# UNIPATCH_EXCLUDE - an addition var to support exlusion based completely
-# on "*" and not "_*"
-# - this should _NOT_ be used from the ebuild as this is
-# reserved for end users passing excludes from the cli
-# UNIPATCH_DOCS - space delimemeted list of docs to be installed to
-# the doc dir
-# UNIPATCH_STRICTORDER - if this is set places patches into directories of
-# order, so they are applied in the order passed
-
-# Changing any other variable in this eclass is not supported; you can request
-# for additional variables to be added by contacting the current maintainer.
-# If you do change them, there is a chance that we will not fix resulting bugs;
-# that of course does not mean we're not willing to help.
-
-inherit eutils toolchain-funcs versionator multilib
-EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm
-
-# Added by Daniel Ostrow
-# This is an ugly hack to get around an issue with a 32-bit userland on ppc64.
-# I will remove it when I come up with something more reasonable.
-[[ ${PROFILE_ARCH} == "ppc64" ]] && CHOST="powerpc64-${CHOST#*-}"
-
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} && ${CATEGORY/cross-} != ${CATEGORY} ]]; then
- export CTARGET=${CATEGORY/cross-}
-fi
-
-HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/ ${HOMEPAGE}"
-: ${LICENSE:="GPL-2"}
-
-# This is the latest KV_PATCH of the deblob tool available from the
-# libre-sources upstream. If you bump this, you MUST regenerate the Manifests
-# for ALL kernel-2 consumer packages where deblob is available.
-: ${DEBLOB_MAX_VERSION:=38}
-
-# No need to run scanelf/strip on kernel sources/headers (bug #134453).
-RESTRICT="binchecks strip"
-
-# set LINUX_HOSTCFLAGS if not already set
-: ${LINUX_HOSTCFLAGS:="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include"}
-
-# debugging functions
-#==============================================================
-# this function exists only to help debug kernel-2.eclass
-# if you are adding new functionality in, put a call to it
-# at the start of src_unpack, or during SRC_URI/dep generation.
-debug-print-kernel2-variables() {
- for v in PVR CKV OKV KV KV_FULL KV_MAJOR KV_MINOR KV_PATCH RELEASETYPE \
- RELEASE UNIPATCH_LIST_DEFAULT UNIPATCH_LIST_GENPATCHES \
- UNIPATCH_LIST S KERNEL_URI K_WANT_GENPATCHES ; do
- debug-print "${v}: ${!v}"
- done
-}
-
-#Eclass functions only from here onwards ...
-#==============================================================
-handle_genpatches() {
- local tarball
- [[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return 1
-
- debug-print "Inside handle_genpatches"
- local OKV_ARRAY
- IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
-
- # for > 3.0 kernels, handle genpatches tarball name
- # genpatches for 3.0 and 3.0.1 might be named
- # genpatches-3.0-1.base.tar.xz and genpatches-3.0-2.base.tar.xz
- # respectively. Handle this.
-
- for i in ${K_WANT_GENPATCHES} ; do
- if [[ ${KV_MAJOR} -ge 3 ]]; then
- if [[ ${KV_MINOR} -ge 5 ]]; then
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
- tarball="genpatches-${KV_MAJOR}.${KV_MINOR}-${K_GENPATCHES_VER}.${i}.tar.xz"
- else
- tarball="genpatches-${KV_MAJOR}.${KV_PATCH}-${K_GENPATCHES_VER}.${i}.tar.xz"
- fi
- else
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
- tarball="genpatches-${KV_MAJOR}.${KV_MINOR}-${K_GENPATCHES_VER}.${i}.tar.bz2"
- else
- tarball="genpatches-${KV_MAJOR}.${KV_PATCH}-${K_GENPATCHES_VER}.${i}.tar.bz2"
- fi
- fi
- else
- tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.bz2"
- fi
- debug-print "genpatches tarball: $tarball"
- GENPATCHES_URI="${GENPATCHES_URI} https://apps.karinthy.hu/gentoo/patches/${tarball}"
- UNIPATCH_LIST_GENPATCHES="${UNIPATCH_LIST_GENPATCHES} ${DISTDIR}/${tarball}"
- done
-}
-
-detect_version() {
- # this function will detect and set
- # - OKV: Original Kernel Version (2.6.0/2.6.0-test11)
- # - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1)
- # - EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1)
-
- # We've already run, so nothing to do here.
- [[ -n ${KV_FULL} ]] && return 0
-
- # CKV is used as a comparison kernel version, which is used when
- # PV doesnt reflect the genuine kernel version.
- # this gets set to the portage style versioning. ie:
- # CKV=2.6.11_rc4
- CKV=${CKV:-${PV}}
- OKV=${OKV:-${CKV}}
- OKV=${OKV/_beta/-test}
- OKV=${OKV/_rc/-rc}
- OKV=${OKV/-r*}
- OKV=${OKV/_p*}
-
- KV_MAJOR=$(get_version_component_range 1 ${OKV})
- # handle if OKV is X.Y or X.Y.Z (e.g. 3.0 or 3.0.1)
- local OKV_ARRAY
- IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
-
- # if KV_MAJOR >= 3, then we have no more KV_MINOR
- #if [[ ${KV_MAJOR} -lt 3 ]]; then
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
- KV_MINOR=$(get_version_component_range 2 ${OKV})
- KV_PATCH=$(get_version_component_range 3 ${OKV})
- if [[ ${KV_MAJOR}${KV_MINOR}${KV_PATCH} -ge 269 ]]; then
- KV_EXTRA=$(get_version_component_range 4- ${OKV})
- KV_EXTRA=${KV_EXTRA/[-_]*}
- else
- KV_PATCH=$(get_version_component_range 3- ${OKV})
- fi
- else
- KV_PATCH=$(get_version_component_range 2 ${OKV})
- KV_EXTRA=$(get_version_component_range 3- ${OKV})
- KV_EXTRA=${KV_EXTRA/[-_]*}
- fi
-
- debug-print "KV_EXTRA is ${KV_EXTRA}"
-
- KV_PATCH=${KV_PATCH/[-_]*}
-
- local v n=0 missing
- #if [[ ${KV_MAJOR} -lt 3 ]]; then
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
- for v in CKV OKV KV_{MAJOR,MINOR,PATCH} ; do
- [[ -z ${!v} ]] && n=1 && missing="${missing}${v} ";
- done
- else
- for v in CKV OKV KV_{MAJOR,PATCH} ; do
- [[ -z ${!v} ]] && n=1 && missing="${missing}${v} ";
- done
- fi
-
- [[ $n -eq 1 ]] && \
- eerror "Missing variables: ${missing}" && \
- die "Failed to extract kernel version (try explicit CKV in ebuild)!"
- unset v n missing
-
-# if [[ ${KV_MAJOR} -ge 3 ]]; then
- if [[ ${#OKV_ARRAY[@]} -lt 3 ]]; then
- KV_PATCH_ARR=(${KV_PATCH//\./ })
-
- # at this point 031412, Linus is putting all 3.x kernels in a
- # 3.x directory, may need to revisit when 4.x is released
- KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.x"
-
- [[ -n "${K_LONGTERM}" ]] &&
- KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_PATCH_ARR}"
- else
- #KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.0"
- #KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}"
- if [[ ${KV_MAJOR} -ge 3 ]]; then
- KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.x"
- else
- KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}"
- fi
-
- [[ -n "${K_LONGTERM}" ]] &&
- #KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm"
- KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
- fi
-
- debug-print "KERNEL_BASE_URI is ${KERNEL_BASE_URI}"
-
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
- # handle non genpatch using sources correctly
- if [[ -z ${K_WANT_GENPATCHES} && -z ${K_GENPATCHES_VER} && ${KV_PATCH} -gt 0 ]]; then
- KERNEL_URI="${KERNEL_BASE_URI}/patch-${OKV}.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.xz"
- fi
- KERNEL_URI="${KERNEL_URI} ${KERNEL_BASE_URI}/linux-${KV_MAJOR}.${KV_MINOR}.tar.xz"
- else
- KERNEL_URI="${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- fi
-
- RELEASE=${CKV/${OKV}}
- RELEASE=${RELEASE/_beta}
- RELEASE=${RELEASE/_rc/-rc}
- RELEASE=${RELEASE/_pre/-pre}
- # We cannot trivally call kernel_is here, because it calls us to detect the
- # version
- #kernel_is ge 2 6 && RELEASE=${RELEASE/-pre/-git}
- [ $(($KV_MAJOR * 1000 + ${KV_MINOR:-0})) -ge 2006 ] && RELEASE=${RELEASE/-pre/-git}
- RELEASETYPE=${RELEASE//[0-9]}
-
- # Now we know that RELEASE is the -rc/-git
- # and RELEASETYPE is the same but with its numerics stripped
- # we can work on better sorting EXTRAVERSION.
- # first of all, we add the release
- EXTRAVERSION="${RELEASE}"
- debug-print "0 EXTRAVERSION:${EXTRAVERSION}"
- [[ -n ${KV_EXTRA} ]] && [[ ${KV_MAJOR} -lt 3 ]] && EXTRAVERSION=".${KV_EXTRA}${EXTRAVERSION}"
-
- debug-print "1 EXTRAVERSION:${EXTRAVERSION}"
- if [[ -n "${K_NOUSEPR}" ]]; then
- # Don't add anything based on PR to EXTRAVERSION
- debug-print "1.0 EXTRAVERSION:${EXTRAVERSION}"
- elif [[ -n ${K_PREPATCHED} ]]; then
- debug-print "1.1 EXTRAVERSION:${EXTRAVERSION}"
- EXTRAVERSION="${EXTRAVERSION}-${PN/-*}${PR/r}"
- elif [[ "${ETYPE}" = "sources" ]]; then
- debug-print "1.2 EXTRAVERSION:${EXTRAVERSION}"
- # For some sources we want to use the PV in the extra version
- # This is because upstream releases with a completely different
- # versioning scheme.
- case ${PN/-*} in
- wolk) K_USEPV=1;;
- vserver) K_USEPV=1;;
- esac
-
- [[ -z "${K_NOUSENAME}" ]] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*}"
- [[ -n "${K_USEPV}" ]] && EXTRAVERSION="${EXTRAVERSION}-${PV//_/-}"
- [[ -n "${PR//r0}" ]] && EXTRAVERSION="${EXTRAVERSION}-${PR}"
- fi
- debug-print "2 EXTRAVERSION:${EXTRAVERSION}"
-
- # The only messing around which should actually effect this is for KV_EXTRA
- # since this has to limit OKV to MAJ.MIN.PAT and strip EXTRA off else
- # KV_FULL evaluates to MAJ.MIN.PAT.EXT.EXT after EXTRAVERSION
-
- if [[ -n ${KV_EXTRA} ]]; then
- if [[ -n ${KV_MINOR} ]]; then
- OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
- else
- OKV="${KV_MAJOR}.${KV_PATCH}"
- fi
- KERNEL_URI="${KERNEL_BASE_URI}/patch-${CKV}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.xz"
- fi
-
- # We need to set this using OKV, but we need to set it before we do any
- # messing around with OKV based on RELEASETYPE
- KV_FULL=${OKV}${EXTRAVERSION}
-
- # we will set this for backwards compatibility.
- S=${WORKDIR}/linux-${KV_FULL}
- KV=${KV_FULL}
-
- # -rc-git pulls can be achieved by specifying CKV
- # for example:
- # CKV="2.6.11_rc3_pre2"
- # will pull:
- # linux-2.6.10.tar.xz & patch-2.6.11-rc3.xz & patch-2.6.11-rc3-git2.xz
-
- if [[ ${KV_MAJOR}${KV_MINOR} -eq 26 ]]; then
-
- if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then
- OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))"
- KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.xz"
- fi
-
- if [[ ${RELEASETYPE} == -git ]]; then
- KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.xz"
- fi
-
- if [[ ${RELEASETYPE} == -rc-git ]]; then
- OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))"
- KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.xz
- ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
-
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.xz"
- fi
- else
- if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then
- if [[ ${KV_MAJOR}${KV_PATCH} -eq 30 ]]; then
- OKV="2.6.39"
- else
- KV_PATCH_ARR=(${KV_PATCH//\./ })
- OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))"
- fi
- KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.xz"
- fi
-
- if [[ ${RELEASETYPE} == -git ]]; then
- KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.xz"
- fi
-
- if [[ ${RELEASETYPE} == -rc-git ]]; then
- if [[ ${KV_MAJOR}${KV_PATCH} -eq 30 ]]; then
- OKV="2.6.39"
- else
- KV_PATCH_ARR=(${KV_PATCH//\./ })
- OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))"
- fi
- KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz
- ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
-
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz"
- fi
-
-
- fi
-
-
- debug-print-kernel2-variables
-
- handle_genpatches
-}
-
-# Note: duplicated in linux-info.eclass
-kernel_is() {
- # ALL of these should be set before we can safely continue this function.
- # some of the sources have in the past had only one set.
- local v n=0
- for v in OKV KV_{MAJOR,MINOR,PATCH} ; do [[ -z ${!v} ]] && n=1 ; done
- [[ $n -eq 1 ]] && detect_version
- unset v n
-
- # Now we can continue
- local operator test value
-
- case ${1#-} in
- lt) operator="-lt"; shift;;
- gt) operator="-gt"; shift;;
- le) operator="-le"; shift;;
- ge) operator="-ge"; shift;;
- eq) operator="-eq"; shift;;
- *) operator="-eq";;
- esac
- [[ $# -gt 3 ]] && die "Error in kernel-2_kernel_is(): too many parameters"
-
- : $(( test = (KV_MAJOR << 16) + (KV_MINOR << 8) + KV_PATCH ))
- : $(( value = (${1:-${KV_MAJOR}} << 16) + (${2:-${KV_MINOR}} << 8) + ${3:-${KV_PATCH}} ))
- [ ${test} ${operator} ${value} ]
-}
-
-kernel_is_2_4() {
- kernel_is 2 4
-}
-
-kernel_is_2_6() {
- kernel_is 2 6 || kernel_is 2 5
-}
-
-# Capture the sources type and set DEPENDs
-if [[ ${ETYPE} == sources ]]; then
- DEPEND="!build? ( sys-apps/sed
- >=sys-devel/binutils-2.11.90.0.31 )"
- RDEPEND="!build? ( >=sys-libs/ncurses-5.2
- sys-devel/make
- dev-lang/perl
- sys-devel/bc )"
- PDEPEND="!build? ( virtual/dev-manager )"
-
- SLOT="${PVR}"
- DESCRIPTION="Sources based on the Linux Kernel."
- IUSE="symlink build"
-
- # Bug #266157, deblob for libre support
- if [[ -z ${K_PREDEBLOBBED} ]] ; then
- # Bug #359865, force a call to detect_version if needed
- kernel_is ge 2 6 27 && \
- [[ -z "${K_DEBLOB_AVAILABLE}" ]] && \
- kernel_is le 2 6 ${DEBLOB_MAX_VERSION} && \
- K_DEBLOB_AVAILABLE=1
- if [[ ${K_DEBLOB_AVAILABLE} == "1" ]] ; then
- IUSE="${IUSE} deblob"
- # Reflect that kernels contain firmware blobs unless otherwise
- # stripped
- LICENSE="${LICENSE} !deblob? ( freedist )"
-
- if [[ -n KV_MINOR ]]; then
- DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
- else
- DEBLOB_PV="${KV_MAJOR}.${KV_PATCH}"
- fi
-
- if [[ ${KV_MAJOR} -ge 3 ]]; then
- DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}"
- fi
-
- DEBLOB_A="deblob-${DEBLOB_PV}"
- DEBLOB_CHECK_A="deblob-check-${DEBLOB_PV}"
- DEBLOB_HOMEPAGE="http://www.fsfla.org/svnwiki/selibre/linux-libre/"
- DEBLOB_URI_PATH="download/releases/LATEST-${DEBLOB_PV}.N"
- if ! has "${EAPI:-0}" 0 1 ; then
- DEBLOB_CHECK_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/deblob-check -> ${DEBLOB_CHECK_A}"
- else
- DEBLOB_CHECK_URI="mirror://gentoo/${DEBLOB_CHECK_A}"
- fi
- DEBLOB_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/${DEBLOB_A}"
- HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}"
-
- DEPEND+=" deblob? ( =dev-lang/python-2* )"
- KERNEL_URI="${KERNEL_URI}
- deblob? (
- ${DEBLOB_URI}
- ${DEBLOB_CHECK_URI}
- )"
- else
- # We have no way to deblob older kernels, so just mark them as
- # tainted with non-libre materials.
- LICENSE="${LICENSE} freedist"
- fi
- fi
-
-elif [[ ${ETYPE} == headers ]]; then
- DESCRIPTION="Linux system headers"
-
- # Since we should NOT honour KBUILD_OUTPUT in headers
- # lets unset it here.
- unset KBUILD_OUTPUT
-
- SLOT="0"
-else
- eerror "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\""
- die "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\""
-fi
-
-# Cross-compile support functions
-#==============================================================
-kernel_header_destdir() {
- [[ ${CTARGET} == ${CHOST} ]] \
- && echo /usr/include \
- || echo /usr/${CTARGET}/usr/include
-}
-
-cross_pre_c_headers() {
- use crosscompile_opts_headers-only && [[ ${CHOST} != ${CTARGET} ]]
-}
-
-env_setup_xmakeopts() {
- # Kernel ARCH != portage ARCH
- export KARCH=$(tc-arch-kernel)
-
- # When cross-compiling, we need to set the ARCH/CROSS_COMPILE
- # variables properly or bad things happen !
- xmakeopts="ARCH=${KARCH}"
- if [[ ${CTARGET} != ${CHOST} ]] && ! cross_pre_c_headers ; then
- xmakeopts="${xmakeopts} CROSS_COMPILE=${CTARGET}-"
- elif type -p ${CHOST}-ar > /dev/null ; then
- xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-"
- fi
- export xmakeopts
-}
-
-# Unpack functions
-#==============================================================
-unpack_2_4() {
- # this file is required for other things to build properly,
- # so we autogenerate it
- make -s mrproper ${xmakeopts} || die "make mrproper failed"
- make -s symlinks ${xmakeopts} || die "make symlinks failed"
- make -s include/linux/version.h ${xmakeopts} || die "make include/linux/version.h failed"
- echo ">>> version.h compiled successfully."
-}
-
-unpack_2_6() {
- # this file is required for other things to build properly, so we
- # autogenerate it ... generate a .config to keep version.h build from
- # spitting out an annoying warning
- make -s mrproper ${xmakeopts} 2>/dev/null \
- || die "make mrproper failed"
-
- # quick fix for bug #132152 which triggers when it cannot include linux
- # headers (ie, we have not installed it yet)
- if ! make -s defconfig ${xmakeopts} &>/dev/null 2>&1 ; then
- touch .config
- eerror "make defconfig failed."
- eerror "assuming you dont have any headers installed yet and continuing"
- epause 5
- fi
-
- make -s include/linux/version.h ${xmakeopts} 2>/dev/null \
- || die "make include/linux/version.h failed"
- rm -f .config >/dev/null
-}
-
-universal_unpack() {
- debug-print "Inside universal_unpack"
-
- local OKV_ARRAY
- IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
-
- cd "${WORKDIR}"
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
- unpack linux-${KV_MAJOR}.${KV_MINOR}.tar.xz
- else
- unpack linux-${OKV}.tar.xz
- fi
-
- if [[ -d "linux" ]]; then
- debug-print "Moving linux to linux-${KV_FULL}"
- mv linux linux-${KV_FULL} \
- || die "Unable to move source tree to ${KV_FULL}."
- elif [[ "${OKV}" != "${KV_FULL}" ]]; then
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]] &&
- [[ "${ETYPE}" = "sources" ]]; then
- debug-print "moving linux-${KV_MAJOR}.${KV_MINOR} to linux-${KV_FULL} "
- mv linux-${KV_MAJOR}.${KV_MINOR} linux-${KV_FULL} \
- || die "Unable to move source tree to ${KV_FULL}."
- else
- debug-print "moving linux-${OKV} to linux-${KV_FULL} "
- mv linux-${OKV} linux-${KV_FULL} \
- || die "Unable to move source tree to ${KV_FULL}."
- fi
- elif [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
- mv linux-${KV_MAJOR}.${KV_MINOR} linux-${KV_FULL} \
- || die "Unable to move source tree to ${KV_FULL}."
- fi
- cd "${S}"
-
- # remove all backup files
- find . -iname "*~" -exec rm {} \; 2> /dev/null
-
-}
-
-unpack_set_extraversion() {
- cd "${S}"
- sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile
- cd "${OLDPWD}"
-}
-
-# Should be done after patches have been applied
-# Otherwise patches that modify the same area of Makefile will fail
-unpack_fix_install_path() {
- cd "${S}"
- sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
-}
-
-# Compile Functions
-#==============================================================
-compile_headers() {
- env_setup_xmakeopts
-
- # if we couldnt obtain HOSTCFLAGS from the Makefile,
- # then set it to something sane
- local HOSTCFLAGS=$(getfilevar HOSTCFLAGS "${S}"/Makefile)
- HOSTCFLAGS=${HOSTCFLAGS:--Wall -Wstrict-prototypes -O2 -fomit-frame-pointer}
-
- if kernel_is 2 4; then
- yes "" | make oldconfig ${xmakeopts}
- echo ">>> make oldconfig complete"
- make dep ${xmakeopts}
- elif kernel_is 2 6; then
- # 2.6.18 introduces headers_install which means we dont need any
- # of this crap anymore :D
- kernel_is ge 2 6 18 && return 0
-
- # autoconf.h isnt generated unless it already exists. plus, we have
- # no guarantee that any headers are installed on the system...
- [[ -f ${ROOT}/usr/include/linux/autoconf.h ]] \
- || touch include/linux/autoconf.h
-
- # if K_DEFCONFIG isn't set, force to "defconfig"
- # needed by mips
- if [[ -z ${K_DEFCONFIG} ]]; then
- if [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.16) ]]; then
- case ${CTARGET} in
- powerpc64*) K_DEFCONFIG="ppc64_defconfig";;
- powerpc*) K_DEFCONFIG="pmac32_defconfig";;
- *) K_DEFCONFIG="defconfig";;
- esac
- else
- K_DEFCONFIG="defconfig"
- fi
- fi
-
- # if there arent any installed headers, then there also isnt an asm
- # symlink in /usr/include/, and make defconfig will fail, so we have
- # to force an include path with $S.
- HOSTCFLAGS="${HOSTCFLAGS} -I${S}/include/"
- ln -sf asm-${KARCH} "${S}"/include/asm
- cross_pre_c_headers && return 0
-
- make ${K_DEFCONFIG} HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "defconfig failed (${K_DEFCONFIG})"
- if compile_headers_tweak_config ; then
- yes "" | make oldconfig HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "2nd oldconfig failed"
- fi
- make prepare HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed"
- make prepare-all HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed"
- fi
-}
-
-compile_headers_tweak_config() {
- # some targets can be very very picky, so let's finesse the
- # .config based upon any info we may have
- case ${CTARGET} in
- sh*)
- sed -i '/CONFIG_CPU_SH/d' .config
- echo "CONFIG_CPU_SH${CTARGET:2:1}=y" >> .config
- return 0;;
- esac
-
- # no changes, so lets do nothing
- return 1
-}
-
-# install functions
-#==============================================================
-install_universal() {
- # Fix silly permissions in tarball
- cd "${WORKDIR}"
- chown -R 0:0 * >& /dev/null
- chmod -R a+r-w+X,u+w *
- cd ${OLDPWD}
-}
-
-install_headers() {
- local ddir=$(kernel_header_destdir)
-
- # 2.6.18 introduces headers_install which means we dont need any
- # of this crap anymore :D
- if kernel_is ge 2 6 18 ; then
- env_setup_xmakeopts
- emake headers_install INSTALL_HDR_PATH="${D}"/${ddir}/.. ${xmakeopts} || die
-
- # let other packages install some of these headers
- rm -rf "${D}"/${ddir}/sound #alsa-headers
- rm -rf "${D}"/${ddir}/scsi #glibc/uclibc/etc...
- return 0
- fi
-
- # Do not use "linux/*" as that can cause problems with very long
- # $S values where the cmdline to cp is too long
- pushd "${S}" >/dev/null
- dodir ${ddir}/linux
- cp -pPR "${S}"/include/linux "${D}"/${ddir}/ || die
- rm -rf "${D}"/${ddir}/linux/modules
-
- dodir ${ddir}/asm
- cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm
-
- if kernel_is 2 6 ; then
- dodir ${ddir}/asm-generic
- cp -pPR "${S}"/include/asm-generic/* "${D}"/${ddir}/asm-generic
- fi
-
- # clean up
- find "${D}" -name '*.orig' -exec rm -f {} \;
-
- popd >/dev/null
-}
-
-install_sources() {
- local file
-
- cd "${S}"
- dodir /usr/src
- echo ">>> Copying sources ..."
-
- file="$(find ${WORKDIR} -iname "docs" -type d)"
- if [[ -n ${file} ]]; then
- for file in $(find ${file} -type f); do
- echo "${file//*docs\/}" >> "${S}"/patches.txt
- echo "===================================================" >> "${S}"/patches.txt
- cat ${file} >> "${S}"/patches.txt
- echo "===================================================" >> "${S}"/patches.txt
- echo "" >> "${S}"/patches.txt
- done
- fi
-
- if [[ ! -f ${S}/patches.txt ]]; then
- # patches.txt is empty so lets use our ChangeLog
- [[ -f ${FILESDIR}/../ChangeLog ]] && \
- echo "Please check the ebuild ChangeLog for more details." \
- > "${S}"/patches.txt
- fi
-
- mv ${WORKDIR}/linux* "${D}"/usr/src
-
- if [[ -n "${UNIPATCH_DOCS}" ]] ; then
- for i in ${UNIPATCH_DOCS}; do
- dodoc "${T}"/${i}
- done
- fi
-}
-
-# pkg_preinst functions
-#==============================================================
-preinst_headers() {
- local ddir=$(kernel_header_destdir)
- [[ -L ${ddir}/linux ]] && rm ${ddir}/linux
- [[ -L ${ddir}/asm ]] && rm ${ddir}/asm
-}
-
-# pkg_postinst functions
-#==============================================================
-postinst_sources() {
- local MAKELINK=0
-
- # if we have USE=symlink, then force K_SYMLINK=1
- use symlink && K_SYMLINK=1
-
- # if we're using a deblobbed kernel, it's not supported
- [[ $K_DEBLOB_AVAILABLE == 1 ]] && \
- use deblob && \
- K_SECURITY_UNSUPPORTED=deblob
-
- # if we are to forcably symlink, delete it if it already exists first.
- if [[ ${K_SYMLINK} > 0 ]]; then
- [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux
- MAKELINK=1
- fi
-
- # if the link doesnt exist, lets create it
- [[ ! -h ${ROOT}usr/src/linux ]] && MAKELINK=1
-
- if [[ ${MAKELINK} == 1 ]]; then
- cd "${ROOT}"usr/src
- ln -sf linux-${KV_FULL} linux
- cd ${OLDPWD}
- fi
-
- # Don't forget to make directory for sysfs
- [[ ! -d ${ROOT}sys ]] && kernel_is 2 6 && mkdir ${ROOT}sys
-
- echo
- elog "If you are upgrading from a previous kernel, you may be interested"
- elog "in the following document:"
- elog " - General upgrade guide: http://www.gentoo.org/doc/en/kernel-upgrade.xml"
- echo
-
- # if K_EXTRAEINFO is set then lets display it now
- if [[ -n ${K_EXTRAEINFO} ]]; then
- echo ${K_EXTRAEINFO} | fmt |
- while read -s ELINE; do einfo "${ELINE}"; done
- fi
-
- # if K_EXTRAELOG is set then lets display it now
- if [[ -n ${K_EXTRAELOG} ]]; then
- echo ${K_EXTRAELOG} | fmt |
- while read -s ELINE; do elog "${ELINE}"; done
- fi
-
- # if K_EXTRAEWARN is set then lets display it now
- if [[ -n ${K_EXTRAEWARN} ]]; then
- echo ${K_EXTRAEWARN} | fmt |
- while read -s ELINE; do ewarn "${ELINE}"; done
- fi
-
- # optionally display security unsupported message
- # Start with why
- if [[ ${K_SECURITY_UNSUPPORTED} = deblob ]]; then
- ewarn "Deblobbed kernels are UNSUPPORTED by Gentoo Security."
- elif [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
- ewarn "${PN} is UNSUPPORTED by Gentoo Security."
- fi
- # And now the general message.
- if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
- ewarn "This means that it is likely to be vulnerable to recent security issues."
- ewarn "For specific information on why this kernel is unsupported, please read:"
- ewarn "http://www.gentoo.org/proj/en/security/kernel.xml"
- fi
-
- # warn sparc users that they need to do cross-compiling with >= 2.6.25(bug #214765)
- KV_MAJOR=$(get_version_component_range 1 ${OKV})
- KV_MINOR=$(get_version_component_range 2 ${OKV})
- KV_PATCH=$(get_version_component_range 3 ${OKV})
- if [[ "$(tc-arch)" = "sparc" ]]; then
- if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.24 ]]
- then
- echo
- elog "NOTE: Since 2.6.25 the kernel Makefile has changed in a way that"
- elog "you now need to do"
- elog " make CROSS_COMPILE=sparc64-unknown-linux-gnu-"
- elog "instead of just"
- elog " make"
- elog "to compile the kernel. For more information please browse to"
- elog "https://bugs.gentoo.org/show_bug.cgi?id=214765"
- echo
- fi
- fi
-}
-
-# pkg_setup functions
-#==============================================================
-setup_headers() {
- [[ -z ${H_SUPPORTEDARCH} ]] && H_SUPPORTEDARCH=${PN/-*/}
- for i in ${H_SUPPORTEDARCH}; do
- [[ $(tc-arch) == "${i}" ]] && H_ACCEPT_ARCH="yes"
- done
-
- if [[ ${H_ACCEPT_ARCH} != "yes" ]]; then
- echo
- eerror "This version of ${PN} does not support $(tc-arch)."
- eerror "Please merge the appropriate sources, in most cases"
- eerror "(but not all) this will be called $(tc-arch)-headers."
- die "Package unsupported for $(tc-arch)"
- fi
-}
-
-# unipatch
-#==============================================================
-unipatch() {
- local i x y z extention PIPE_CMD UNIPATCH_DROP KPATCH_DIR PATCH_DEPTH ELINE
- local STRICT_COUNT PATCH_LEVEL myLC_ALL myLANG
-
- # set to a standard locale to ensure sorts are ordered properly.
- myLC_ALL="${LC_ALL}"
- myLANG="${LANG}"
- LC_ALL="C"
- LANG=""
-
- [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/"
- [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
-
- # We're gonna need it when doing patches with a predefined patchlevel
- eshopts_push -s extglob
-
- # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers
- # usage can be either via an env var or by params
- # although due to the nature we pass this within this eclass
- # it shall be by param only.
- # -z "${UNIPATCH_LIST}" ] && UNIPATCH_LIST="${@}"
- UNIPATCH_LIST="${@}"
-
- #unpack any passed tarballs
- for i in ${UNIPATCH_LIST}; do
- if echo ${i} | grep -qs -e "\.tar" -e "\.tbz" -e "\.tgz" ; then
- if [ -n "${UNIPATCH_STRICTORDER}" ]; then
- unset z
- STRICT_COUNT=$((10#${STRICT_COUNT} + 1))
- for((y=0; y<$((6 - ${#STRICT_COUNT})); y++));
- do z="${z}0";
- done
- PATCH_ORDER="${z}${STRICT_COUNT}"
-
- mkdir -p "${KPATCH_DIR}/${PATCH_ORDER}"
- pushd "${KPATCH_DIR}/${PATCH_ORDER}" >/dev/null
- unpack ${i##*/}
- popd >/dev/null
- else
- pushd "${KPATCH_DIR}" >/dev/null
- unpack ${i##*/}
- popd >/dev/null
- fi
-
- [[ ${i} == *:* ]] && echo ">>> Strict patch levels not currently supported for tarballed patchsets"
- else
- extention=${i/*./}
- extention=${extention/:*/}
- PIPE_CMD=""
- case ${extention} in
- xz) PIPE_CMD="xz -dc";;
- lzma) PIPE_CMD="lzma -dc";;
- bz2) PIPE_CMD="bzip2 -dc";;
- patch) PIPE_CMD="cat";;
- diff) PIPE_CMD="cat";;
- gz|Z|z) PIPE_CMD="gzip -dc";;
- ZIP|zip) PIPE_CMD="unzip -p";;
- *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i/:*/}";;
- esac
-
- PATCH_LEVEL=${i/*([^:])?(:)}
- i=${i/:*/}
- x=${i/*\//}
- x=${x/\.${extention}/}
-
- if [ -n "${PIPE_CMD}" ]; then
- if [ ! -r "${i}" ]; then
- echo
- eerror "FATAL: unable to locate:"
- eerror "${i}"
- eerror "for read-only. The file either has incorrect permissions"
- eerror "or does not exist."
- die Unable to locate ${i}
- fi
-
- if [ -n "${UNIPATCH_STRICTORDER}" ]; then
- unset z
- STRICT_COUNT=$((10#${STRICT_COUNT} + 1))
- for((y=0; y<$((6 - ${#STRICT_COUNT})); y++));
- do z="${z}0";
- done
- PATCH_ORDER="${z}${STRICT_COUNT}"
-
- mkdir -p ${KPATCH_DIR}/${PATCH_ORDER}/
- $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${PATCH_ORDER}/${x}.patch${PATCH_LEVEL}) || die "uncompressing patch failed"
- else
- $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL}) || die "uncompressing patch failed"
- fi
- fi
- fi
- done
-
- #populate KPATCH_DIRS so we know where to look to remove the excludes
- x=${KPATCH_DIR}
- KPATCH_DIR=""
- for i in $(find ${x} -type d | sort -n); do
- KPATCH_DIR="${KPATCH_DIR} ${i}"
- done
-
- # do not apply fbcondecor patch to sparc/sparc64 as it breaks boot
- # bug #272676
- if [[ "$(tc-arch)" = "sparc" || "$(tc-arch)" = "sparc64" ]]; then
- if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.28 ]]; then
- UNIPATCH_DROP="${UNIPATCH_DROP} *_fbcondecor-0.9.6.patch"
- echo
- ewarn "fbcondecor currently prevents sparc/sparc64 from booting"
- ewarn "for kernel versions >= 2.6.29. Removing fbcondecor patch."
- ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=272676 for details"
- echo
- fi
- fi
-
- #so now lets get rid of the patchno's we want to exclude
- UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
- for i in ${UNIPATCH_DROP}; do
- ebegin "Excluding Patch #${i}"
- for x in ${KPATCH_DIR}; do rm -f ${x}/${i}* 2>/dev/null; done
- eend $?
- done
-
- # and now, finally, we patch it :)
- for x in ${KPATCH_DIR}; do
- for i in $(find ${x} -maxdepth 1 -iname "*.patch*" -or -iname "*.diff*" | sort -n); do
- STDERR_T="${T}/${i/*\//}"
- STDERR_T="${STDERR_T/.patch*/.err}"
-
- [ -z ${i/*.patch*/} ] && PATCH_DEPTH=${i/*.patch/}
- #[ -z ${i/*.diff*/} ] && PATCH_DEPTH=${i/*.diff/}
-
- if [ -z "${PATCH_DEPTH}" ]; then PATCH_DEPTH=0; fi
-
- while [ ${PATCH_DEPTH} -lt 5 ]; do
- echo "Attempting Dry-run:" >> ${STDERR_T}
- echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i}" >> ${STDERR_T}
- echo "=======================================================" >> ${STDERR_T}
- if [ $(patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i} >> ${STDERR_T}) $? -eq 0 ]; then
- ebegin "Applying ${i/*\//} (-p${PATCH_DEPTH})"
- echo "Attempting patch:" > ${STDERR_T}
- echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch -f < ${i}" >> ${STDERR_T}
- echo "=======================================================" >> ${STDERR_T}
- if [ $(patch -p${PATCH_DEPTH} --no-backup-if-mismatch -f < ${i} >> ${STDERR_T}) "$?" -eq 0 ]; then
- eend 0
- rm ${STDERR_T}
- break
- else
- eend 1
- eerror "Failed to apply patch ${i/*\//}"
- eerror "Please attach ${STDERR_T} to any bug you may post."
- eshopts_pop
- die "Failed to apply ${i/*\//} on patch depth ${PATCH_DEPTH}."
- fi
- else
- PATCH_DEPTH=$((${PATCH_DEPTH} + 1))
- fi
- done
- if [ ${PATCH_DEPTH} -eq 5 ]; then
- eerror "Failed to dry-run patch ${i/*\//}"
- eerror "Please attach ${STDERR_T} to any bug you may post."
- eshopts_pop
- die "Unable to dry-run patch on any patch depth lower than 5."
- fi
- done
- done
-
- # When genpatches is used, we want to install 0000_README which documents
- # the patches that were used; such that the user can see them, bug #301478.
- if [[ ! -z ${K_WANT_GENPATCHES} ]] ; then
- UNIPATCH_DOCS="${UNIPATCH_DOCS} 0000_README"
- fi
-
- # When files listed in UNIPATCH_DOCS are found in KPATCH_DIR's, we copy it
- # to the temporary directory and remember them in UNIPATCH_DOCS to install
- # them during the install phase.
- local tmp
- for x in ${KPATCH_DIR}; do
- for i in ${UNIPATCH_DOCS}; do
- if [[ -f "${x}/${i}" ]] ; then
- tmp="${tmp} ${i}"
- cp -f "${x}/${i}" "${T}"/
- fi
- done
- done
- UNIPATCH_DOCS="${tmp}"
-
- # clean up KPATCH_DIR's - fixes bug #53610
- for x in ${KPATCH_DIR}; do rm -Rf ${x}; done
-
- LC_ALL="${myLC_ALL}"
- LANG="${myLANG}"
- eshopts_pop
-}
-
-# getfilevar accepts 2 vars as follows:
-# getfilevar
-# pulled from linux-info
-
-getfilevar() {
- local workingdir basefname basedname xarch=$(tc-arch-kernel)
-
- if [[ -z ${1} ]] && [[ ! -f ${2} ]]; then
- echo -e "\n"
- eerror "getfilevar requires 2 variables, with the second a valid file."
- eerror " getfilevar "
- else
- workingdir=${PWD}
- basefname=$(basename ${2})
- basedname=$(dirname ${2})
- unset ARCH
-
- cd ${basedname}
- echo -e "include ${basefname}\ne:\n\t@echo \$(${1})" | \
- make ${BUILD_FIXES} -s -f - e 2>/dev/null
- cd ${workingdir}
-
- ARCH=${xarch}
- fi
-}
-
-detect_arch() {
- # This function sets ARCH_URI and ARCH_PATCH
- # with the neccessary info for the arch sepecific compatibility
- # patchsets.
-
- local ALL_ARCH LOOP_ARCH COMPAT_URI i
-
- # COMPAT_URI is the contents of ${ARCH}_URI
- # ARCH_URI is the URI for all the ${ARCH}_URI patches
- # ARCH_PATCH is ARCH_URI broken into files for UNIPATCH
-
- ARCH_URI=""
- ARCH_PATCH=""
- ALL_ARCH="ALPHA AMD64 ARM HPPA IA64 M68K MIPS PPC PPC64 S390 SH SPARC X86"
-
- for LOOP_ARCH in ${ALL_ARCH}; do
- COMPAT_URI="${LOOP_ARCH}_URI"
- COMPAT_URI="${!COMPAT_URI}"
-
- [[ -n ${COMPAT_URI} ]] && \
- ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr '[:upper:]' '[:lower:]')? ( ${COMPAT_URI} )"
-
- if [[ ${LOOP_ARCH} == "$(echo $(tc-arch-kernel) | tr '[:lower:]' '[:upper:]')" ]]; then
- for i in ${COMPAT_URI}; do
- ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
- done
- fi
- done
-}
-
-headers___fix() {
- # Voodoo to partially fix broken upstream headers.
- # note: do not put inline/asm/volatile together (breaks "inline asm volatile")
- sed -i \
- -e '/^\#define.*_TYPES_H/{:loop n; bloop}' \
- -e 's:\<\([us]\(8\|16\|32\|64\)\)\>:__\1:g' \
- -e "s/\([[:space:]]\)inline\([[:space:](]\)/\1__inline__\2/g" \
- -e "s/\([[:space:]]\)asm\([[:space:](]\)/\1__asm__\2/g" \
- -e "s/\([[:space:]]\)volatile\([[:space:](]\)/\1__volatile__\2/g" \
- "$@"
-}
-
-# common functions
-#==============================================================
-kernel-2a_src_unpack() {
- universal_unpack
- debug-print "Doing unipatch"
-
- [[ -n ${UNIPATCH_LIST} || -n ${UNIPATCH_LIST_DEFAULT} || -n ${UNIPATCH_LIST_GENPATCHES} ]] && \
- unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST_GENPATCHES} ${UNIPATCH_LIST}"
-
- debug-print "Doing premake"
-
- # allow ebuilds to massage the source tree after patching but before
- # we run misc `make` functions below
- [[ $(type -t kernel-2a_hook_premake) == "function" ]] && kernel-2a_hook_premake
-
- debug-print "Doing epatch_user"
- epatch_user
-
- debug-print "Doing unpack_set_extraversion"
-
- [[ -z ${K_NOSETEXTRAVERSION} ]] && unpack_set_extraversion
- unpack_fix_install_path
-
- # Setup xmakeopts and cd into sourcetree.
- env_setup_xmakeopts
- cd "${S}"
-
- # We dont need a version.h for anything other than headers
- # at least, I should hope we dont. If this causes problems
- # take out the if/fi block and inform me please.
- # unpack_2_6 should now be 2.6.17 safe anyways
- if [[ ${ETYPE} == headers ]]; then
- kernel_is 2 4 && unpack_2_4
- kernel_is 2 6 && unpack_2_6
- fi
-
- if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
- cp "${DISTDIR}/${DEBLOB_A}" "${T}" || die "cp ${DEBLOB_A} failed"
- cp "${DISTDIR}/${DEBLOB_CHECK_A}" "${T}/deblob-check" || die "cp ${DEBLOB_CHECK_A} failed"
- chmod +x "${T}/${DEBLOB_A}" "${T}/deblob-check" || die "chmod deblob scripts failed"
- fi
-
- # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
- # only do this for kernel < 2.6.27 since this file does not exist in later
- # kernels
- if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]]
- then
- sed -i \
- -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
- "${S}"/arch/ppc/Makefile
- else
- sed -i \
- -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
- "${S}"/arch/powerpc/Makefile
- fi
-}
-
-kernel-2a_src_compile() {
- cd "${S}"
- [[ ${ETYPE} == headers ]] && compile_headers
-
- if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
- echo ">>> Running deblob script ..."
- EPYTHON="python2" sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!"
- fi
-}
-
-# if you leave it to the default src_test, it will run make to
-# find whether test/check targets are present; since "make test"
-# actually produces a few support files, they are installed even
-# though the package is binchecks-restricted.
-#
-# Avoid this altogether by making the function moot.
-kernel-2a_src_test() { :; }
-
-kernel-2a_pkg_preinst() {
- [[ ${ETYPE} == headers ]] && preinst_headers
-}
-
-kernel-2a_src_install() {
- install_universal
- [[ ${ETYPE} == headers ]] && install_headers
- [[ ${ETYPE} == sources ]] && install_sources
-}
-
-kernel-2a_pkg_postinst() {
- [[ ${ETYPE} == sources ]] && postinst_sources
-}
-
-kernel-2a_pkg_setup() {
- if kernel_is 2 4; then
- if [[ $(gcc-major-version) -ge 4 ]] ; then
- echo
- ewarn "Be warned !! >=sys-devel/gcc-4.0.0 isn't supported with linux-2.4!"
- ewarn "Either switch to another gcc-version (via gcc-config) or use a"
- ewarn "newer kernel that supports gcc-4."
- echo
- ewarn "Also be aware that bugreports about gcc-4 not working"
- ewarn "with linux-2.4 based ebuilds will be closed as INVALID!"
- echo
- epause 10
- fi
- fi
-
- ABI="${KERNEL_ABI}"
- [[ ${ETYPE} == headers ]] && setup_headers
- [[ ${ETYPE} == sources ]] && echo ">>> Preparing to unpack ..."
-}
-
-kernel-2a_pkg_postrm() {
- # This warning only makes sense for kernel sources.
- [[ ${ETYPE} == headers ]] && return 0
-
- # If there isn't anything left behind, then don't complain.
- [[ -e ${ROOT}usr/src/linux-${KV_FULL} ]] || return 0
- echo
- ewarn "Note: Even though you have successfully unmerged "
- ewarn "your kernel package, directories in kernel source location: "
- ewarn "${ROOT}usr/src/linux-${KV_FULL}"
- ewarn "with modified files will remain behind. By design, package managers"
- ewarn "will not remove these modified files and the directories they reside in."
- echo
-}
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
deleted file mode 100644
index e061220..0000000
--- a/eclass/python-utils-r1.eclass
+++ /dev/null
@@ -1,1451 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: python-utils-r1.eclass
-# @MAINTAINER:
-# Python team
-# @AUTHOR:
-# Author: Michał Górny
-# Based on work of: Krzysztof Pawlik
-# @SUPPORTED_EAPIS: 5 6 7
-# @BLURB: Utility functions for packages with Python parts.
-# @DESCRIPTION:
-# A utility eclass providing functions to query Python implementations,
-# install Python modules and scripts.
-#
-# This eclass does not set any metadata variables nor export any phase
-# functions. It can be inherited safely.
-#
-# For more information, please see the Python Guide:
-# https://dev.gentoo.org/~mgorny/python-guide/
-
-case "${EAPI:-0}" in
- [0-4]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
- [5-7]) ;;
- *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
-esac
-
-if [[ ${_PYTHON_ECLASS_INHERITED} ]]; then
- die 'python-r1 suite eclasses can not be used with python.eclass.'
-fi
-
-if [[ ! ${_PYTHON_UTILS_R1} ]]; then
-
-[[ ${EAPI} == 5 ]] && inherit eutils multilib
-inherit toolchain-funcs
-
-# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
-# @INTERNAL
-# @DESCRIPTION:
-# All supported Python implementations, most preferred last.
-_PYTHON_ALL_IMPLS=(
- pypy3
- python2_7
- python3_7 python3_8 python3_9
-)
-readonly _PYTHON_ALL_IMPLS
-
-# @ECLASS-VARIABLE: _PYTHON_HISTORICAL_IMPLS
-# @INTERNAL
-# @DESCRIPTION:
-# All historical Python implementations that are no longer supported.
-_PYTHON_HISTORICAL_IMPLS=(
- jython2_7
- pypy pypy1_{8,9} pypy2_0
- python2_{5..6}
- python3_{1..6}
-)
-readonly _PYTHON_HISTORICAL_IMPLS
-
-# @ECLASS-VARIABLE: PYTHON_COMPAT_NO_STRICT
-# @INTERNAL
-# @DESCRIPTION:
-# Set to a non-empty value in order to make eclass tolerate (ignore)
-# unknown implementations in PYTHON_COMPAT.
-#
-# This is intended to be set by the user when using ebuilds that may
-# have unknown (newer) implementations in PYTHON_COMPAT. The assumption
-# is that the ebuilds are intended to be used within multiple contexts
-# which can involve revisions of this eclass that support a different
-# set of Python implementations.
-
-# @FUNCTION: _python_verify_patterns
-# @USAGE: ...
-# @INTERNAL
-# @DESCRIPTION:
-# Verify whether the patterns passed to the eclass function are correct
-# (i.e. can match any valid implementation). Dies on wrong pattern.
-_python_verify_patterns() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local impl pattern
- for pattern; do
- [[ ${pattern} == -[23] ]] && continue
-
- for impl in "${_PYTHON_ALL_IMPLS[@]}" "${_PYTHON_HISTORICAL_IMPLS[@]}"
- do
- [[ ${impl} == ${pattern/./_} ]] && continue 2
- done
-
- die "Invalid implementation pattern: ${pattern}"
- done
-}
-
-# @FUNCTION: _python_set_impls
-# @INTERNAL
-# @DESCRIPTION:
-# Check PYTHON_COMPAT for well-formedness and validity, then set
-# two global variables:
-#
-# - _PYTHON_SUPPORTED_IMPLS containing valid implementations supported
-# by the ebuild (PYTHON_COMPAT - dead implementations),
-#
-# - and _PYTHON_UNSUPPORTED_IMPLS containing valid implementations that
-# are not supported by the ebuild.
-#
-# Implementations in both variables are ordered using the pre-defined
-# eclass implementation ordering.
-#
-# This function must be called once in global scope by an eclass
-# utilizing PYTHON_COMPAT.
-_python_set_impls() {
- local i
-
- if ! declare -p PYTHON_COMPAT &>/dev/null; then
- die 'PYTHON_COMPAT not declared.'
- fi
- if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then
- die 'PYTHON_COMPAT must be an array.'
- fi
- if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then
- for i in "${PYTHON_COMPAT[@]}"; do
- # check for incorrect implementations
- # we're using pattern matching as an optimization
- # please keep them in sync with _PYTHON_ALL_IMPLS
- # and _PYTHON_HISTORICAL_IMPLS
- case ${i} in
- jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9])
- ;;
- *)
- if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \
- "${_PYTHON_HISTORICAL_IMPLS[@]}"
- then
- die "Mis-synced patterns in _python_set_impls: missing ${i}"
- else
- die "Invalid implementation in PYTHON_COMPAT: ${i}"
- fi
- esac
- done
- fi
-
- local supp=() unsupp=()
-
- for i in "${_PYTHON_ALL_IMPLS[@]}"; do
- if has "${i}" "${PYTHON_COMPAT[@]}"; then
- supp+=( "${i}" )
- else
- unsupp+=( "${i}" )
- fi
- done
-
- if [[ ! ${supp[@]} ]]; then
- # special-case python2_7 for python-any-r1
- if [[ ${_PYTHON_ALLOW_PY27} ]] && has python2_7 "${PYTHON_COMPAT[@]}"
- then
- supp+=( python2_7 )
- else
- die "No supported implementation in PYTHON_COMPAT."
- fi
- fi
-
- if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then
- # set once already, verify integrity
- if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} != ${supp[@]} ]]; then
- eerror "Supported impls (PYTHON_COMPAT) changed between inherits!"
- eerror "Before: ${_PYTHON_SUPPORTED_IMPLS[*]}"
- eerror "Now : ${supp[*]}"
- die "_PYTHON_SUPPORTED_IMPLS integrity check failed"
- fi
- if [[ ${_PYTHON_UNSUPPORTED_IMPLS[@]} != ${unsupp[@]} ]]; then
- eerror "Unsupported impls changed between inherits!"
- eerror "Before: ${_PYTHON_UNSUPPORTED_IMPLS[*]}"
- eerror "Now : ${unsupp[*]}"
- die "_PYTHON_UNSUPPORTED_IMPLS integrity check failed"
- fi
- else
- _PYTHON_SUPPORTED_IMPLS=( "${supp[@]}" )
- _PYTHON_UNSUPPORTED_IMPLS=( "${unsupp[@]}" )
- readonly _PYTHON_SUPPORTED_IMPLS _PYTHON_UNSUPPORTED_IMPLS
- fi
-}
-
-# @FUNCTION: _python_impl_matches
-# @USAGE: [...]
-# @INTERNAL
-# @DESCRIPTION:
-# Check whether the specified matches at least one
-# of the patterns following it. Return 0 if it does, 1 otherwise.
-# Matches if no patterns are provided.
-#
-# can be in PYTHON_COMPAT or EPYTHON form. The patterns can be
-# either:
-# a) fnmatch-style patterns, e.g. 'python2*', 'pypy'...
-# b) '-2' to indicate all Python 2 variants (= !python_is_python3)
-# c) '-3' to indicate all Python 3 variants (= python_is_python3)
-_python_impl_matches() {
- [[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter"
- [[ ${#} -eq 1 ]] && return 0
-
- local impl=${1} pattern
- shift
-
- for pattern; do
- if [[ ${pattern} == -2 ]]; then
- python_is_python3 "${impl}" || return 0
- elif [[ ${pattern} == -3 ]]; then
- python_is_python3 "${impl}" && return 0
- return
- # unify value style to allow lax matching
- elif [[ ${impl/./_} == ${pattern/./_} ]]; then
- return 0
- fi
- done
-
- return 1
-}
-
-# @ECLASS-VARIABLE: PYTHON
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The absolute path to the current Python interpreter.
-#
-# This variable is set automatically in the following contexts:
-#
-# python-r1: Set in functions called by python_foreach_impl() or after
-# calling python_setup().
-#
-# python-single-r1: Set after calling python-single-r1_pkg_setup().
-#
-# distutils-r1: Set within any of the python sub-phase functions.
-#
-# Example value:
-# @CODE
-# /usr/bin/python2.7
-# @CODE
-
-# @ECLASS-VARIABLE: EPYTHON
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The executable name of the current Python interpreter.
-#
-# This variable is set automatically in the following contexts:
-#
-# python-r1: Set in functions called by python_foreach_impl() or after
-# calling python_setup().
-#
-# python-single-r1: Set after calling python-single-r1_pkg_setup().
-#
-# distutils-r1: Set within any of the python sub-phase functions.
-#
-# Example value:
-# @CODE
-# python2.7
-# @CODE
-
-# @FUNCTION: python_export
-# @USAGE: [] ...
-# @INTERNAL
-# @DESCRIPTION:
-# Backwards compatibility function. The relevant API is now considered
-# private, please use python_get* instead.
-python_export() {
- debug-print-function ${FUNCNAME} "${@}"
-
- eqawarn "python_export() is part of private eclass API."
- eqawarn "Please call python_get*() instead."
-
- _python_export "${@}"
-}
-
-# @FUNCTION: _python_export
-# @USAGE: [] ...
-# @INTERNAL
-# @DESCRIPTION:
-# Set and export the Python implementation-relevant variables passed
-# as parameters.
-#
-# The optional first parameter may specify the requested Python
-# implementation (either as PYTHON_TARGETS value, e.g. python2_7,
-# or an EPYTHON one, e.g. python2.7). If no implementation passed,
-# the current one will be obtained from ${EPYTHON}.
-#
-# The variables which can be exported are: PYTHON, EPYTHON,
-# PYTHON_SITEDIR. They are described more completely in the eclass
-# variable documentation.
-_python_export() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local impl var
-
- case "${1}" in
- python*|jython*)
- impl=${1/_/.}
- shift
- ;;
- pypy|pypy3)
- impl=${1}
- shift
- ;;
- *)
- impl=${EPYTHON}
- if [[ -z ${impl} ]]; then
- die "_python_export called without a python implementation and EPYTHON is unset"
- fi
- ;;
- esac
- debug-print "${FUNCNAME}: implementation: ${impl}"
-
- for var; do
- case "${var}" in
- EPYTHON)
- export EPYTHON=${impl}
- debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}"
- ;;
- PYTHON)
- export PYTHON=${EPREFIX}/usr/bin/${impl}
- debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
- ;;
- PYTHON_SITEDIR)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- # sysconfig can't be used because:
- # 1) pypy doesn't give site-packages but stdlib
- # 2) jython gives paths with wrong case
- PYTHON_SITEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())') || die
- export PYTHON_SITEDIR
- debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
- ;;
- PYTHON_INCLUDEDIR)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())') || die
- export PYTHON_INCLUDEDIR
- debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
-
- # Jython gives a non-existing directory
- if [[ ! -d ${PYTHON_INCLUDEDIR} ]]; then
- die "${impl} does not install any header files!"
- fi
- ;;
- PYTHON_LIBPATH)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_LIBPATH=$("${PYTHON}" -c 'import os.path, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR"), sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") else "")') || die
- export PYTHON_LIBPATH
- debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
-
- if [[ ! ${PYTHON_LIBPATH} ]]; then
- die "${impl} lacks a (usable) dynamic library"
- fi
- ;;
- PYTHON_CFLAGS)
- local val
-
- case "${impl}" in
- python*)
- # python-2.7, python-3.2, etc.
- val=$($(tc-getPKG_CONFIG) --cflags ${impl/n/n-}) || die
- ;;
- *)
- die "${impl}: obtaining ${var} not supported"
- ;;
- esac
-
- export PYTHON_CFLAGS=${val}
- debug-print "${FUNCNAME}: PYTHON_CFLAGS = ${PYTHON_CFLAGS}"
- ;;
- PYTHON_LIBS)
- local val
-
- case "${impl}" in
- python2*|python3.6|python3.7*)
- # python* up to 3.7
- val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die
- ;;
- python*)
- # python3.8+
- val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}-embed) || die
- ;;
- *)
- die "${impl}: obtaining ${var} not supported"
- ;;
- esac
-
- export PYTHON_LIBS=${val}
- debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}"
- ;;
- PYTHON_CONFIG)
- local flags val
-
- case "${impl}" in
- python*)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- flags=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")') || die
- val=${PYTHON}${flags}-config
- ;;
- *)
- die "${impl}: obtaining ${var} not supported"
- ;;
- esac
-
- export PYTHON_CONFIG=${val}
- debug-print "${FUNCNAME}: PYTHON_CONFIG = ${PYTHON_CONFIG}"
- ;;
- PYTHON_PKG_DEP)
- local d
- case ${impl} in
- python2.7)
- PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7';;
- python*)
- PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
- pypy)
- PYTHON_PKG_DEP='>=dev-python/pypy-7.3.0:0=';;
- pypy3)
- PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.0:0=';;
- *)
- die "Invalid implementation: ${impl}"
- esac
-
- # use-dep
- if [[ ${PYTHON_REQ_USE} ]]; then
- PYTHON_PKG_DEP+=[${PYTHON_REQ_USE}]
- fi
-
- export PYTHON_PKG_DEP
- debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}"
- ;;
- PYTHON_SCRIPTDIR)
- local dir
- export PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl}
- debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}"
- ;;
- *)
- die "_python_export: unknown variable ${var}"
- esac
- done
-}
-
-# @FUNCTION: python_get_sitedir
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the 'site-packages' path for the given
-# implementation. If no implementation is provided, ${EPYTHON} will
-# be used.
-python_get_sitedir() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_SITEDIR
- echo "${PYTHON_SITEDIR}"
-}
-
-# @FUNCTION: python_get_includedir
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the include path for the given implementation. If no
-# implementation is provided, ${EPYTHON} will be used.
-python_get_includedir() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_INCLUDEDIR
- echo "${PYTHON_INCLUDEDIR}"
-}
-
-# @FUNCTION: python_get_library_path
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the Python library path for the given implementation.
-# If no implementation is provided, ${EPYTHON} will be used.
-#
-# Please note that this function can be used with CPython only. Use
-# in another implementation will result in a fatal failure.
-python_get_library_path() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_LIBPATH
- echo "${PYTHON_LIBPATH}"
-}
-
-# @FUNCTION: python_get_CFLAGS
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the compiler flags for building against Python,
-# for the given implementation. If no implementation is provided,
-# ${EPYTHON} will be used.
-#
-# Please note that this function can be used with CPython only.
-# It requires Python and pkg-config installed, and therefore proper
-# build-time dependencies need be added to the ebuild.
-python_get_CFLAGS() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_CFLAGS
- echo "${PYTHON_CFLAGS}"
-}
-
-# @FUNCTION: python_get_LIBS
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the compiler flags for linking against Python,
-# for the given implementation. If no implementation is provided,
-# ${EPYTHON} will be used.
-#
-# Please note that this function can be used with CPython only.
-# It requires Python and pkg-config installed, and therefore proper
-# build-time dependencies need be added to the ebuild.
-python_get_LIBS() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_LIBS
- echo "${PYTHON_LIBS}"
-}
-
-# @FUNCTION: python_get_PYTHON_CONFIG
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the PYTHON_CONFIG location for the given
-# implementation. If no implementation is provided, ${EPYTHON} will be
-# used.
-#
-# Please note that this function can be used with CPython only.
-# It requires Python installed, and therefore proper build-time
-# dependencies need be added to the ebuild.
-python_get_PYTHON_CONFIG() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_CONFIG
- echo "${PYTHON_CONFIG}"
-}
-
-# @FUNCTION: python_get_scriptdir
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the script install path for the given
-# implementation. If no implementation is provided, ${EPYTHON} will
-# be used.
-python_get_scriptdir() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_SCRIPTDIR
- echo "${PYTHON_SCRIPTDIR}"
-}
-
-# @FUNCTION: _python_ln_rel
-# @USAGE:
-# @INTERNAL
-# @DESCRIPTION:
-# Create a relative symlink.
-_python_ln_rel() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local target=${1}
- local symname=${2}
-
- local tgpath=${target%/*}/
- local sympath=${symname%/*}/
- local rel_target=
-
- while [[ ${sympath} ]]; do
- local tgseg= symseg=
-
- while [[ ! ${tgseg} && ${tgpath} ]]; do
- tgseg=${tgpath%%/*}
- tgpath=${tgpath#${tgseg}/}
- done
-
- while [[ ! ${symseg} && ${sympath} ]]; do
- symseg=${sympath%%/*}
- sympath=${sympath#${symseg}/}
- done
-
- if [[ ${tgseg} != ${symseg} ]]; then
- rel_target=../${rel_target}${tgseg:+${tgseg}/}
- fi
- done
- rel_target+=${tgpath}${target##*/}
-
- debug-print "${FUNCNAME}: ${symname} -> ${target}"
- debug-print "${FUNCNAME}: rel_target = ${rel_target}"
-
- ln -fs "${rel_target}" "${symname}"
-}
-
-# @FUNCTION: python_optimize
-# @USAGE: [...]
-# @DESCRIPTION:
-# Compile and optimize Python modules in specified directories (absolute
-# paths). If no directories are provided, the default system paths
-# are used (prepended with ${D}).
-python_optimize() {
- debug-print-function ${FUNCNAME} "${@}"
-
- if [[ ${EBUILD_PHASE} == pre* || ${EBUILD_PHASE} == post* ]]; then
- eerror "The new Python eclasses expect the compiled Python files to"
- eerror "be controlled by the Package Manager. For this reason,"
- eerror "the python_optimize function can be used only during src_* phases"
- eerror "(src_install most commonly) and not during pkg_* phases."
- echo
- die "python_optimize is not to be used in pre/post* phases"
- fi
-
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
-
- local PYTHON=${PYTHON}
- [[ ${PYTHON} ]] || _python_export PYTHON
- [[ -x ${PYTHON} ]] || die "PYTHON (${PYTHON}) is not executable"
-
- # default to sys.path
- if [[ ${#} -eq 0 ]]; then
- local f
- while IFS= read -r -d '' f; do
- # 1) accept only absolute paths
- # (i.e. skip '', '.' or anything like that)
- # 2) skip paths which do not exist
- # (python2.6 complains about them verbosely)
-
- if [[ ${f} == /* && -d ${D%/}${f} ]]; then
- set -- "${D%/}${f}" "${@}"
- fi
- done < <("${PYTHON}" -c 'import sys; print("".join(x + "\0" for x in sys.path))' || die)
-
- debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"
- fi
-
- local d
- for d; do
- # make sure to get a nice path without //
- local instpath=${d#${D%/}}
- instpath=/${instpath##/}
-
- case "${EPYTHON}" in
- python2.7|python3.[34])
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
- ;;
- python*|pypy3)
- # both levels of optimization are separate since 3.5
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -O -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
- ;;
- *)
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
- ;;
- esac
- done
-}
-
-# @FUNCTION: python_scriptinto
-# @USAGE:
-# @DESCRIPTION:
-# Set the directory to which files passed to python_doexe(),
-# python_doscript(), python_newexe() and python_newscript()
-# are going to be installed. The new value needs to be relative
-# to the installation root (${ED}).
-#
-# If not set explicitly, the directory defaults to /usr/bin.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_scriptinto /usr/sbin
-# python_foreach_impl python_doscript foo
-# }
-# @CODE
-python_scriptinto() {
- debug-print-function ${FUNCNAME} "${@}"
-
- python_scriptroot=${1}
-}
-
-# @FUNCTION: python_doexe
-# @USAGE: ...
-# @DESCRIPTION:
-# Install the given executables into the executable install directory,
-# for the current Python implementation (${EPYTHON}).
-#
-# The executable will be wrapped properly for the Python implementation,
-# though no shebang mangling will be performed.
-python_doexe() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local f
- for f; do
- python_newexe "${f}" "${f##*/}"
- done
-}
-
-# @FUNCTION: python_newexe
-# @USAGE:
-# @DESCRIPTION:
-# Install the given executable into the executable install directory,
-# for the current Python implementation (${EPYTHON}).
-#
-# The executable will be wrapped properly for the Python implementation,
-# though no shebang mangling will be performed. It will be renamed
-# to .
-python_newexe() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
- [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} "
-
- local wrapd=${python_scriptroot:-/usr/bin}
-
- local f=${1}
- local newfn=${2}
-
- local scriptdir=$(python_get_scriptdir)
- local d=${scriptdir#${EPREFIX}}
-
- (
- dodir "${wrapd}"
- exeopts -m 0755
- exeinto "${d}"
- newexe "${f}" "${newfn}" || return ${?}
- )
-
- # install the wrapper
- _python_ln_rel "${ED%/}"/usr/lib/python-exec/python-exec2 \
- "${ED%/}/${wrapd}/${newfn}" || die
-
- # don't use this at home, just call python_doscript() instead
- if [[ ${_PYTHON_REWRITE_SHEBANG} ]]; then
- python_fix_shebang -q "${ED%/}/${d}/${newfn}"
- fi
-}
-
-# @FUNCTION: python_doscript
-# @USAGE: ...
-# @DESCRIPTION:
-# Install the given scripts into the executable install directory,
-# for the current Python implementation (${EPYTHON}).
-#
-# All specified files must start with a 'python' shebang. The shebang
-# will be converted, and the files will be wrapped properly
-# for the Python implementation.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_foreach_impl python_doscript ${PN}
-# }
-# @CODE
-python_doscript() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local _PYTHON_REWRITE_SHEBANG=1
- python_doexe "${@}"
-}
-
-# @FUNCTION: python_newscript
-# @USAGE:
-# @DESCRIPTION:
-# Install the given script into the executable install directory
-# for the current Python implementation (${EPYTHON}), and name it
-# .
-#
-# The file must start with a 'python' shebang. The shebang will be
-# converted, and the file will be wrapped properly for the Python
-# implementation. It will be renamed to .
-#
-# Example:
-# @CODE
-# src_install() {
-# python_foreach_impl python_newscript foo.py foo
-# }
-# @CODE
-python_newscript() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local _PYTHON_REWRITE_SHEBANG=1
- python_newexe "${@}"
-}
-
-# @FUNCTION: python_moduleinto
-# @USAGE:
-# @DESCRIPTION:
-# Set the Python module install directory for python_domodule().
-# The can either be an absolute target system path (in which
-# case it needs to start with a slash, and ${ED} will be prepended to
-# it) or relative to the implementation's site-packages directory
-# (then it must not start with a slash). The relative path can be
-# specified either using the Python package notation (separated by dots)
-# or the directory notation (using slashes).
-#
-# When not set explicitly, the modules are installed to the top
-# site-packages directory.
-#
-# In the relative case, the exact path is determined directly
-# by each python_doscript/python_newscript function. Therefore,
-# python_moduleinto can be safely called before establishing the Python
-# interpreter and/or a single call can be used to set the path correctly
-# for multiple implementations, as can be seen in the following example.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_moduleinto bar
-# # installs ${PYTHON_SITEDIR}/bar/baz.py
-# python_foreach_impl python_domodule baz.py
-# }
-# @CODE
-python_moduleinto() {
- debug-print-function ${FUNCNAME} "${@}"
-
- python_moduleroot=${1}
-}
-
-# @FUNCTION: python_domodule
-# @USAGE: ...
-# @DESCRIPTION:
-# Install the given modules (or packages) into the current Python module
-# installation directory. The list can mention both modules (files)
-# and packages (directories). All listed files will be installed
-# for all enabled implementations, and compiled afterwards.
-#
-# Example:
-# @CODE
-# src_install() {
-# # (${PN} being a directory)
-# python_foreach_impl python_domodule ${PN}
-# }
-# @CODE
-python_domodule() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
-
- local d
- if [[ ${python_moduleroot} == /* ]]; then
- # absolute path
- d=${python_moduleroot}
- else
- # relative to site-packages
- local sitedir=$(python_get_sitedir)
- d=${sitedir#${EPREFIX}}/${python_moduleroot//.//}
- fi
-
- (
- insopts -m 0644
- insinto "${d}"
- doins -r "${@}" || return ${?}
- )
-
- python_optimize "${ED%/}/${d}"
-}
-
-# @FUNCTION: python_doheader
-# @USAGE: ...
-# @DESCRIPTION:
-# Install the given headers into the implementation-specific include
-# directory. This function is unconditionally recursive, i.e. you can
-# pass directories instead of files.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_foreach_impl python_doheader foo.h bar.h
-# }
-# @CODE
-python_doheader() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
-
- local includedir=$(python_get_includedir)
- local d=${includedir#${EPREFIX}}
-
- (
- insopts -m 0644
- insinto "${d}"
- doins -r "${@}" || return ${?}
- )
-}
-
-# @FUNCTION: python_wrapper_setup
-# @USAGE: [ []]
-# @DESCRIPTION:
-# Backwards compatibility function. The relevant API is now considered
-# private, please use python_setup instead.
-python_wrapper_setup() {
- debug-print-function ${FUNCNAME} "${@}"
-
- eqawarn "python_wrapper_setup() is part of private eclass API."
- eqawarn "Please call python_setup() instead."
-
- _python_wrapper_setup "${@}"
-}
-
-# @FUNCTION: _python_wrapper_setup
-# @USAGE: [ []]
-# @INTERNAL
-# @DESCRIPTION:
-# Create proper 'python' executable and pkg-config wrappers
-# (if available) in the directory named by . Set up PATH
-# and PKG_CONFIG_PATH appropriately. defaults to ${T}/${EPYTHON}.
-#
-# The wrappers will be created for implementation named by ,
-# or for one named by ${EPYTHON} if no passed.
-#
-# If the named directory contains a python symlink already, it will
-# be assumed to contain proper wrappers already and only environment
-# setup will be done. If wrapper update is requested, the directory
-# shall be removed first.
-_python_wrapper_setup() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local workdir=${1:-${T}/${EPYTHON}}
- local impl=${2:-${EPYTHON}}
-
- [[ ${workdir} ]] || die "${FUNCNAME}: no workdir specified."
- [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON specified."
-
- if [[ ! -x ${workdir}/bin/python ]]; then
- _python_check_dead_variables
-
- mkdir -p "${workdir}"/{bin,pkgconfig} || die
-
- # Clean up, in case we were supposed to do a cheap update.
- rm -f "${workdir}"/bin/python{,2,3}{,-config} || die
- rm -f "${workdir}"/bin/2to3 || die
- rm -f "${workdir}"/pkgconfig/python{2,3}{,-embed}.pc || die
-
- local EPYTHON PYTHON
- _python_export "${impl}" EPYTHON PYTHON
-
- local pyver pyother
- if python_is_python3; then
- pyver=3
- pyother=2
- else
- pyver=2
- pyother=3
- fi
-
- # Python interpreter
- # note: we don't use symlinks because python likes to do some
- # symlink reading magic that breaks stuff
- # https://bugs.gentoo.org/show_bug.cgi?id=555752
- cat > "${workdir}/bin/python" <<-_EOF_ || die
- #!/bin/sh
- exec "${PYTHON}" "\${@}"
- _EOF_
- cp "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die
- chmod +x "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die
-
- local nonsupp=( "python${pyother}" "python${pyother}-config" )
-
- # CPython-specific
- if [[ ${EPYTHON} == python* ]]; then
- cat > "${workdir}/bin/python-config" <<-_EOF_ || die
- #!/bin/sh
- exec "${PYTHON}-config" "\${@}"
- _EOF_
- cp "${workdir}/bin/python-config" \
- "${workdir}/bin/python${pyver}-config" || die
- chmod +x "${workdir}/bin/python-config" \
- "${workdir}/bin/python${pyver}-config" || die
-
- # Python 2.6+.
- ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die
-
- # Python 2.7+.
- ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc \
- "${workdir}"/pkgconfig/python${pyver}.pc || die
-
- # Python 3.8+.
- if [[ ${EPYTHON} != python[23].[67] ]]; then
- ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \
- "${workdir}"/pkgconfig/python${pyver}-embed.pc || die
- fi
- else
- nonsupp+=( 2to3 python-config "python${pyver}-config" )
- fi
-
- local x
- for x in "${nonsupp[@]}"; do
- cat >"${workdir}"/bin/${x} <<-_EOF_ || die
- #!/bin/sh
- echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${EPYTHON} (PYTHON_COMPAT)" >&2
- exit 127
- _EOF_
- chmod +x "${workdir}"/bin/${x} || die
- done
- fi
-
- # Now, set the environment.
- # But note that ${workdir} may be shared with something else,
- # and thus already on top of PATH.
- if [[ ${PATH##:*} != ${workdir}/bin ]]; then
- PATH=${workdir}/bin${PATH:+:${PATH}}
- fi
- if [[ ${PKG_CONFIG_PATH##:*} != ${workdir}/pkgconfig ]]; then
- PKG_CONFIG_PATH=${workdir}/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
- fi
- export PATH PKG_CONFIG_PATH
-}
-
-# @FUNCTION: python_is_python3
-# @USAGE: []
-# @DESCRIPTION:
-# Check whether (or ${EPYTHON}) is a Python3k variant
-# (i.e. uses syntax and stdlib of Python 3.*).
-#
-# Returns 0 (true) if it is, 1 (false) otherwise.
-python_is_python3() {
- local impl=${1:-${EPYTHON}}
- [[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON"
-
- [[ ${impl} == python3* || ${impl} == pypy3 ]]
-}
-
-# @FUNCTION: python_is_installed
-# @USAGE: []
-# @DESCRIPTION:
-# Check whether the interpreter for (or ${EPYTHON}) is installed.
-# Uses has_version with a proper dependency string.
-#
-# Returns 0 (true) if it is, 1 (false) otherwise.
-python_is_installed() {
- local impl=${1:-${EPYTHON}}
- [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
- local hasv_args=()
-
- case ${EAPI} in
- 5|6)
- hasv_args+=( --host-root )
- ;;
- *)
- hasv_args+=( -b )
- ;;
- esac
-
- local PYTHON_PKG_DEP
- _python_export "${impl}" PYTHON_PKG_DEP
- has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
-}
-
-# @FUNCTION: python_fix_shebang
-# @USAGE: [-f|--force] [-q|--quiet] ...
-# @DESCRIPTION:
-# Replace the shebang in Python scripts with the current Python
-# implementation (EPYTHON). If a directory is passed, works recursively
-# on all Python scripts.
-#
-# Only files having a 'python*' shebang will be modified. Files with
-# other shebang will either be skipped when working recursively
-# on a directory or treated as error when specified explicitly.
-#
-# Shebangs matching explicitly current Python version will be left
-# unmodified. Shebangs requesting another Python version will be treated
-# as fatal error, unless --force is given.
-#
-# --force causes the function to replace even shebangs that require
-# incompatible Python version. --quiet causes the function not to list
-# modified files verbosely.
-python_fix_shebang() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EPYTHON} ]] || die "${FUNCNAME}: EPYTHON unset (pkg_setup not called?)"
-
- local force quiet
- while [[ ${@} ]]; do
- case "${1}" in
- -f|--force) force=1; shift;;
- -q|--quiet) quiet=1; shift;;
- --) shift; break;;
- *) break;;
- esac
- done
-
- [[ ${1} ]] || die "${FUNCNAME}: no paths given"
-
- local path f
- for path; do
- local any_correct any_fixed is_recursive
-
- [[ -d ${path} ]] && is_recursive=1
-
- while IFS= read -r -d '' f; do
- local shebang i
- local error= from=
-
- # note: we can't ||die here since read will fail if file
- # has no newline characters
- IFS= read -r shebang <"${f}"
-
- # First, check if it's shebang at all...
- if [[ ${shebang} == '#!'* ]]; then
- local split_shebang=()
- read -r -a split_shebang <<<${shebang} || die
-
- # Match left-to-right in a loop, to avoid matching random
- # repetitions like 'python2.7 python2'.
- for i in "${split_shebang[@]}"; do
- case "${i}" in
- *"${EPYTHON}")
- debug-print "${FUNCNAME}: in file ${f#${D%/}}"
- debug-print "${FUNCNAME}: shebang matches EPYTHON: ${shebang}"
-
- # Nothing to do, move along.
- any_correct=1
- from=${EPYTHON}
- break
- ;;
- *python|*python[23])
- debug-print "${FUNCNAME}: in file ${f#${D%/}}"
- debug-print "${FUNCNAME}: rewriting shebang: ${shebang}"
-
- if [[ ${i} == *python2 ]]; then
- from=python2
- if [[ ! ${force} ]]; then
- python_is_python3 "${EPYTHON}" && error=1
- fi
- elif [[ ${i} == *python3 ]]; then
- from=python3
- if [[ ! ${force} ]]; then
- python_is_python3 "${EPYTHON}" || error=1
- fi
- else
- from=python
- fi
- break
- ;;
- *python[23].[0123456789]|*pypy|*pypy3|*jython[23].[0123456789])
- # Explicit mismatch.
- if [[ ! ${force} ]]; then
- error=1
- else
- case "${i}" in
- *python[23].[0123456789])
- from="python[23].[0123456789]";;
- *pypy)
- from="pypy";;
- *pypy3)
- from="pypy3";;
- *jython[23].[0123456789])
- from="jython[23].[0123456789]";;
- *)
- die "${FUNCNAME}: internal error in 2nd pattern match";;
- esac
- fi
- break
- ;;
- esac
- done
- fi
-
- if [[ ! ${error} && ! ${from} ]]; then
- # Non-Python shebang. Allowed in recursive mode,
- # disallowed when specifying file explicitly.
- [[ ${is_recursive} ]] && continue
- error=1
- fi
-
- if [[ ! ${quiet} ]]; then
- einfo "Fixing shebang in ${f#${D%/}}."
- fi
-
- if [[ ! ${error} ]]; then
- # We either want to match ${from} followed by space
- # or at end-of-string.
- if [[ ${shebang} == *${from}" "* ]]; then
- sed -i -e "1s:${from} :${EPYTHON} :" "${f}" || die
- else
- sed -i -e "1s:${from}$:${EPYTHON}:" "${f}" || die
- fi
- any_fixed=1
- else
- eerror "The file has incompatible shebang:"
- eerror " file: ${f#${D%/}}"
- eerror " current shebang: ${shebang}"
- eerror " requested impl: ${EPYTHON}"
- die "${FUNCNAME}: conversion of incompatible shebang requested"
- fi
- done < <(find -H "${path}" -type f -print0 || die)
-
- if [[ ! ${any_fixed} ]]; then
- local cmd=eerror
- [[ ${EAPI} == 5 ]] && cmd=eqawarn
-
- "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
- if [[ ${any_correct} ]]; then
- "${cmd}" "All files have ${EPYTHON} shebang already."
- else
- "${cmd}" "There are no Python files in specified directory."
- fi
-
- [[ ${cmd} == eerror ]] && die "${FUNCNAME} did not match any fixable files (QA warning fatal in EAPI ${EAPI})"
- fi
- done
-}
-
-# @FUNCTION: _python_check_locale_sanity
-# @USAGE:
-# @RETURN: 0 if sane, 1 otherwise
-# @INTERNAL
-# @DESCRIPTION:
-# Check whether the specified locale sanely maps between lowercase
-# and uppercase ASCII characters.
-_python_check_locale_sanity() {
- local -x LC_ALL=${1}
- local IFS=
-
- local lc=( {a..z} )
- local uc=( {A..Z} )
- local input="${lc[*]}${uc[*]}"
-
- local output=$(tr '[:lower:][:upper:]' '[:upper:][:lower:]' <<<"${input}")
- [[ ${output} == "${uc[*]}${lc[*]}" ]]
-}
-
-# @FUNCTION: python_export_utf8_locale
-# @RETURN: 0 on success, 1 on failure.
-# @DESCRIPTION:
-# Attempts to export a usable UTF-8 locale in the LC_CTYPE variable. Does
-# nothing if LC_ALL is defined, or if the current locale uses a UTF-8 charmap.
-# This may be used to work around the quirky open() behavior of python3.
-python_export_utf8_locale() {
- debug-print-function ${FUNCNAME} "${@}"
-
- # If the locale program isn't available, just return.
- type locale >/dev/null || return 0
-
- if [[ $(locale charmap) != UTF-8 ]]; then
- # Try English first, then everything else.
- local lang locales="C.UTF-8 en_US.UTF-8 en_GB.UTF-8 $(locale -a)"
-
- for lang in ${locales}; do
- if [[ $(LC_ALL=${lang} locale charmap 2>/dev/null) == UTF-8 ]]; then
- if _python_check_locale_sanity "${lang}"; then
- export LC_CTYPE=${lang}
- if [[ -n ${LC_ALL} ]]; then
- export LC_NUMERIC=${LC_ALL}
- export LC_TIME=${LC_ALL}
- export LC_COLLATE=${LC_ALL}
- export LC_MONETARY=${LC_ALL}
- export LC_MESSAGES=${LC_ALL}
- export LC_PAPER=${LC_ALL}
- export LC_NAME=${LC_ALL}
- export LC_ADDRESS=${LC_ALL}
- export LC_TELEPHONE=${LC_ALL}
- export LC_MEASUREMENT=${LC_ALL}
- export LC_IDENTIFICATION=${LC_ALL}
- export LC_ALL=
- fi
- return 0
- fi
- fi
- done
-
- ewarn "Could not find a UTF-8 locale. This may trigger build failures in"
- ewarn "some python packages. Please ensure that a UTF-8 locale is listed in"
- ewarn "/etc/locale.gen and run locale-gen."
- return 1
- fi
-
- return 0
-}
-
-# @FUNCTION: build_sphinx
-# @USAGE:
-# @DESCRIPTION:
-# Build HTML documentation using dev-python/sphinx in the specified
-# . Takes care of disabling Intersphinx and appending
-# to HTML_DOCS.
-#
-# If is relative to the current directory, care needs
-# to be taken to run einstalldocs from the same directory
-# (usually ${S}).
-build_sphinx() {
- debug-print-function ${FUNCNAME} "${@}"
- [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes 1 arg: "
-
- local dir=${1}
-
- sed -i -e 's:^intersphinx_mapping:disabled_&:' \
- "${dir}"/conf.py || die
- # not all packages include the Makefile in pypi tarball
- sphinx-build -b html -d "${dir}"/_build/doctrees "${dir}" \
- "${dir}"/_build/html || die
-
- HTML_DOCS+=( "${dir}/_build/html/." )
-}
-
-# -- python.eclass functions --
-
-_python_check_dead_variables() {
- local v
-
- for v in PYTHON_DEPEND PYTHON_USE_WITH{,_OR,_OPT} {RESTRICT,SUPPORT}_PYTHON_ABIS
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Ebuild_head"
- fi
- done
-
- for v in PYTHON_{CPPFLAGS,CFLAGS,CXXFLAGS,LDFLAGS}
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#PYTHON_CFLAGS"
- fi
- done
-
- for v in PYTHON_TESTS_RESTRICTED_ABIS PYTHON_EXPORT_PHASE_FUNCTIONS \
- PYTHON_VERSIONED_{SCRIPTS,EXECUTABLES} PYTHON_NONVERSIONED_EXECUTABLES
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite"
- fi
- done
-
- for v in DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES DISTUTILS_SETUP_FILES \
- DISTUTILS_GLOBAL_OPTIONS DISTUTILS_SRC_TEST PYTHON_MODNAME
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for distutils-r1, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#${v}"
- fi
- done
-
- if [[ ${DISTUTILS_DISABLE_TEST_DEPENDENCY} ]]; then
- die "${v} is invalid for distutils-r1, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#DISTUTILS_SRC_TEST"
- fi
-
- # python.eclass::progress
- for v in PYTHON_BDEPEND PYTHON_MULTIPLE_ABIS PYTHON_ABI_TYPE \
- PYTHON_RESTRICTED_ABIS PYTHON_TESTS_FAILURES_TOLERANT_ABIS \
- PYTHON_CFFI_MODULES_GENERATION_COMMANDS
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite"
- fi
- done
-}
-
-python_pkg_setup() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup"
-}
-
-python_convert_shebangs() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_convert_shebangs"
-}
-
-python_clean_py-compile_files() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_clean_installation_image() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_function() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_execute_function"
-}
-
-python_generate_wrapper_scripts() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_merge_intermediate_installation_images() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_set_active_version() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup"
-}
-
-python_need_rebuild() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-PYTHON() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#.24.28PYTHON.29.2C_.24.7BEPYTHON.7D"
-}
-
-python_get_implementation() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_implementational_package() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_libdir() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_library() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_version() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_implementation_and_version() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_nosetests() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_py.test() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_trial() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_enable_pyc() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_disable_pyc() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_mod_optimize() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Python_byte-code_compilation"
-}
-
-python_mod_cleanup() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Python_byte-code_compilation"
-}
-
-# python.eclass::progress
-
-python_abi_depend() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_install_executables() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_extension_module_suffix() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_byte-compile_modules() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_clean_byte-compiled_modules() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_generate_cffi_modules() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-_PYTHON_UTILS_R1=1
-fi
diff --git a/eclass/xdistutils-r1.eclass b/eclass/xdistutils-r1.eclass
deleted file mode 100644
index 26aec7c..0000000
--- a/eclass/xdistutils-r1.eclass
+++ /dev/null
@@ -1,40 +0,0 @@
-if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
- inherit xpython-r1
-else
- inherit xpython-single-r1
-fi
-
-inherit distutils-r1
-
-# @FUNCTION: distutils-r1_python_compile
-# @USAGE: [additional-args...]
-# @DESCRIPTION:
-# The default python_compile(). Runs 'esetup.py build'. Any parameters
-# passed to this function will be appended to setup.py invocation,
-# i.e. passed as options to the 'build' command.
-#
-# This phase also sets up initial setup.cfg with build directories
-# and copies upstream egg-info files if supplied.
-distutils-r1_python_compile() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _distutils-r1_copy_egg_info
-
- local build_args=()
- # distutils is parallel-capable since py3.5
- # to avoid breaking stable ebuilds, enable it only if either:
- # a. we're dealing with EAPI 7
- # b. we're dealing with Python 3.7 or PyPy3
- if python_is_python3 && [[ ${EPYTHON} != python3.4 ]]; then
- if [[ ${EAPI} != [56] || ${EPYTHON} != python3.[56] ]]; then
- local jobs=$(makeopts_jobs "${MAKEOPTS}" INF)
- if [[ ${jobs} == INF ]]; then
- local nproc=$(get_nproc)
- jobs=$(( nproc + 1 ))
- fi
- build_args+=( -j "${jobs}" )
- fi
- fi
-
- esetup.py build "${build_args[@]}" "${@}"
-}
diff --git a/eclass/xpython-any-r1.eclass b/eclass/xpython-any-r1.eclass
deleted file mode 100644
index 4c88e44..0000000
--- a/eclass/xpython-any-r1.eclass
+++ /dev/null
@@ -1,2 +0,0 @@
-inherit xpython-utils-r1
-inherit python-any-r1
diff --git a/eclass/xpython-r1.eclass b/eclass/xpython-r1.eclass
deleted file mode 100644
index 4766a76..0000000
--- a/eclass/xpython-r1.eclass
+++ /dev/null
@@ -1,3 +0,0 @@
-inherit xpython-utils-r1
-
-inherit python-r1
diff --git a/eclass/xpython-single-r1.eclass b/eclass/xpython-single-r1.eclass
deleted file mode 100644
index f36bf63..0000000
--- a/eclass/xpython-single-r1.eclass
+++ /dev/null
@@ -1,3 +0,0 @@
-inherit xpython-utils-r1
-
-inherit python-single-r1
diff --git a/eclass/xpython-utils-r1.eclass b/eclass/xpython-utils-r1.eclass
deleted file mode 100644
index e061220..0000000
--- a/eclass/xpython-utils-r1.eclass
+++ /dev/null
@@ -1,1451 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: python-utils-r1.eclass
-# @MAINTAINER:
-# Python team
-# @AUTHOR:
-# Author: Michał Górny
-# Based on work of: Krzysztof Pawlik
-# @SUPPORTED_EAPIS: 5 6 7
-# @BLURB: Utility functions for packages with Python parts.
-# @DESCRIPTION:
-# A utility eclass providing functions to query Python implementations,
-# install Python modules and scripts.
-#
-# This eclass does not set any metadata variables nor export any phase
-# functions. It can be inherited safely.
-#
-# For more information, please see the Python Guide:
-# https://dev.gentoo.org/~mgorny/python-guide/
-
-case "${EAPI:-0}" in
- [0-4]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
- [5-7]) ;;
- *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
-esac
-
-if [[ ${_PYTHON_ECLASS_INHERITED} ]]; then
- die 'python-r1 suite eclasses can not be used with python.eclass.'
-fi
-
-if [[ ! ${_PYTHON_UTILS_R1} ]]; then
-
-[[ ${EAPI} == 5 ]] && inherit eutils multilib
-inherit toolchain-funcs
-
-# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
-# @INTERNAL
-# @DESCRIPTION:
-# All supported Python implementations, most preferred last.
-_PYTHON_ALL_IMPLS=(
- pypy3
- python2_7
- python3_7 python3_8 python3_9
-)
-readonly _PYTHON_ALL_IMPLS
-
-# @ECLASS-VARIABLE: _PYTHON_HISTORICAL_IMPLS
-# @INTERNAL
-# @DESCRIPTION:
-# All historical Python implementations that are no longer supported.
-_PYTHON_HISTORICAL_IMPLS=(
- jython2_7
- pypy pypy1_{8,9} pypy2_0
- python2_{5..6}
- python3_{1..6}
-)
-readonly _PYTHON_HISTORICAL_IMPLS
-
-# @ECLASS-VARIABLE: PYTHON_COMPAT_NO_STRICT
-# @INTERNAL
-# @DESCRIPTION:
-# Set to a non-empty value in order to make eclass tolerate (ignore)
-# unknown implementations in PYTHON_COMPAT.
-#
-# This is intended to be set by the user when using ebuilds that may
-# have unknown (newer) implementations in PYTHON_COMPAT. The assumption
-# is that the ebuilds are intended to be used within multiple contexts
-# which can involve revisions of this eclass that support a different
-# set of Python implementations.
-
-# @FUNCTION: _python_verify_patterns
-# @USAGE: ...
-# @INTERNAL
-# @DESCRIPTION:
-# Verify whether the patterns passed to the eclass function are correct
-# (i.e. can match any valid implementation). Dies on wrong pattern.
-_python_verify_patterns() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local impl pattern
- for pattern; do
- [[ ${pattern} == -[23] ]] && continue
-
- for impl in "${_PYTHON_ALL_IMPLS[@]}" "${_PYTHON_HISTORICAL_IMPLS[@]}"
- do
- [[ ${impl} == ${pattern/./_} ]] && continue 2
- done
-
- die "Invalid implementation pattern: ${pattern}"
- done
-}
-
-# @FUNCTION: _python_set_impls
-# @INTERNAL
-# @DESCRIPTION:
-# Check PYTHON_COMPAT for well-formedness and validity, then set
-# two global variables:
-#
-# - _PYTHON_SUPPORTED_IMPLS containing valid implementations supported
-# by the ebuild (PYTHON_COMPAT - dead implementations),
-#
-# - and _PYTHON_UNSUPPORTED_IMPLS containing valid implementations that
-# are not supported by the ebuild.
-#
-# Implementations in both variables are ordered using the pre-defined
-# eclass implementation ordering.
-#
-# This function must be called once in global scope by an eclass
-# utilizing PYTHON_COMPAT.
-_python_set_impls() {
- local i
-
- if ! declare -p PYTHON_COMPAT &>/dev/null; then
- die 'PYTHON_COMPAT not declared.'
- fi
- if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then
- die 'PYTHON_COMPAT must be an array.'
- fi
- if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then
- for i in "${PYTHON_COMPAT[@]}"; do
- # check for incorrect implementations
- # we're using pattern matching as an optimization
- # please keep them in sync with _PYTHON_ALL_IMPLS
- # and _PYTHON_HISTORICAL_IMPLS
- case ${i} in
- jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9])
- ;;
- *)
- if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \
- "${_PYTHON_HISTORICAL_IMPLS[@]}"
- then
- die "Mis-synced patterns in _python_set_impls: missing ${i}"
- else
- die "Invalid implementation in PYTHON_COMPAT: ${i}"
- fi
- esac
- done
- fi
-
- local supp=() unsupp=()
-
- for i in "${_PYTHON_ALL_IMPLS[@]}"; do
- if has "${i}" "${PYTHON_COMPAT[@]}"; then
- supp+=( "${i}" )
- else
- unsupp+=( "${i}" )
- fi
- done
-
- if [[ ! ${supp[@]} ]]; then
- # special-case python2_7 for python-any-r1
- if [[ ${_PYTHON_ALLOW_PY27} ]] && has python2_7 "${PYTHON_COMPAT[@]}"
- then
- supp+=( python2_7 )
- else
- die "No supported implementation in PYTHON_COMPAT."
- fi
- fi
-
- if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then
- # set once already, verify integrity
- if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} != ${supp[@]} ]]; then
- eerror "Supported impls (PYTHON_COMPAT) changed between inherits!"
- eerror "Before: ${_PYTHON_SUPPORTED_IMPLS[*]}"
- eerror "Now : ${supp[*]}"
- die "_PYTHON_SUPPORTED_IMPLS integrity check failed"
- fi
- if [[ ${_PYTHON_UNSUPPORTED_IMPLS[@]} != ${unsupp[@]} ]]; then
- eerror "Unsupported impls changed between inherits!"
- eerror "Before: ${_PYTHON_UNSUPPORTED_IMPLS[*]}"
- eerror "Now : ${unsupp[*]}"
- die "_PYTHON_UNSUPPORTED_IMPLS integrity check failed"
- fi
- else
- _PYTHON_SUPPORTED_IMPLS=( "${supp[@]}" )
- _PYTHON_UNSUPPORTED_IMPLS=( "${unsupp[@]}" )
- readonly _PYTHON_SUPPORTED_IMPLS _PYTHON_UNSUPPORTED_IMPLS
- fi
-}
-
-# @FUNCTION: _python_impl_matches
-# @USAGE: [...]
-# @INTERNAL
-# @DESCRIPTION:
-# Check whether the specified matches at least one
-# of the patterns following it. Return 0 if it does, 1 otherwise.
-# Matches if no patterns are provided.
-#
-# can be in PYTHON_COMPAT or EPYTHON form. The patterns can be
-# either:
-# a) fnmatch-style patterns, e.g. 'python2*', 'pypy'...
-# b) '-2' to indicate all Python 2 variants (= !python_is_python3)
-# c) '-3' to indicate all Python 3 variants (= python_is_python3)
-_python_impl_matches() {
- [[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter"
- [[ ${#} -eq 1 ]] && return 0
-
- local impl=${1} pattern
- shift
-
- for pattern; do
- if [[ ${pattern} == -2 ]]; then
- python_is_python3 "${impl}" || return 0
- elif [[ ${pattern} == -3 ]]; then
- python_is_python3 "${impl}" && return 0
- return
- # unify value style to allow lax matching
- elif [[ ${impl/./_} == ${pattern/./_} ]]; then
- return 0
- fi
- done
-
- return 1
-}
-
-# @ECLASS-VARIABLE: PYTHON
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The absolute path to the current Python interpreter.
-#
-# This variable is set automatically in the following contexts:
-#
-# python-r1: Set in functions called by python_foreach_impl() or after
-# calling python_setup().
-#
-# python-single-r1: Set after calling python-single-r1_pkg_setup().
-#
-# distutils-r1: Set within any of the python sub-phase functions.
-#
-# Example value:
-# @CODE
-# /usr/bin/python2.7
-# @CODE
-
-# @ECLASS-VARIABLE: EPYTHON
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The executable name of the current Python interpreter.
-#
-# This variable is set automatically in the following contexts:
-#
-# python-r1: Set in functions called by python_foreach_impl() or after
-# calling python_setup().
-#
-# python-single-r1: Set after calling python-single-r1_pkg_setup().
-#
-# distutils-r1: Set within any of the python sub-phase functions.
-#
-# Example value:
-# @CODE
-# python2.7
-# @CODE
-
-# @FUNCTION: python_export
-# @USAGE: [] ...
-# @INTERNAL
-# @DESCRIPTION:
-# Backwards compatibility function. The relevant API is now considered
-# private, please use python_get* instead.
-python_export() {
- debug-print-function ${FUNCNAME} "${@}"
-
- eqawarn "python_export() is part of private eclass API."
- eqawarn "Please call python_get*() instead."
-
- _python_export "${@}"
-}
-
-# @FUNCTION: _python_export
-# @USAGE: [] ...
-# @INTERNAL
-# @DESCRIPTION:
-# Set and export the Python implementation-relevant variables passed
-# as parameters.
-#
-# The optional first parameter may specify the requested Python
-# implementation (either as PYTHON_TARGETS value, e.g. python2_7,
-# or an EPYTHON one, e.g. python2.7). If no implementation passed,
-# the current one will be obtained from ${EPYTHON}.
-#
-# The variables which can be exported are: PYTHON, EPYTHON,
-# PYTHON_SITEDIR. They are described more completely in the eclass
-# variable documentation.
-_python_export() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local impl var
-
- case "${1}" in
- python*|jython*)
- impl=${1/_/.}
- shift
- ;;
- pypy|pypy3)
- impl=${1}
- shift
- ;;
- *)
- impl=${EPYTHON}
- if [[ -z ${impl} ]]; then
- die "_python_export called without a python implementation and EPYTHON is unset"
- fi
- ;;
- esac
- debug-print "${FUNCNAME}: implementation: ${impl}"
-
- for var; do
- case "${var}" in
- EPYTHON)
- export EPYTHON=${impl}
- debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}"
- ;;
- PYTHON)
- export PYTHON=${EPREFIX}/usr/bin/${impl}
- debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
- ;;
- PYTHON_SITEDIR)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- # sysconfig can't be used because:
- # 1) pypy doesn't give site-packages but stdlib
- # 2) jython gives paths with wrong case
- PYTHON_SITEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())') || die
- export PYTHON_SITEDIR
- debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
- ;;
- PYTHON_INCLUDEDIR)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())') || die
- export PYTHON_INCLUDEDIR
- debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
-
- # Jython gives a non-existing directory
- if [[ ! -d ${PYTHON_INCLUDEDIR} ]]; then
- die "${impl} does not install any header files!"
- fi
- ;;
- PYTHON_LIBPATH)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_LIBPATH=$("${PYTHON}" -c 'import os.path, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR"), sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") else "")') || die
- export PYTHON_LIBPATH
- debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
-
- if [[ ! ${PYTHON_LIBPATH} ]]; then
- die "${impl} lacks a (usable) dynamic library"
- fi
- ;;
- PYTHON_CFLAGS)
- local val
-
- case "${impl}" in
- python*)
- # python-2.7, python-3.2, etc.
- val=$($(tc-getPKG_CONFIG) --cflags ${impl/n/n-}) || die
- ;;
- *)
- die "${impl}: obtaining ${var} not supported"
- ;;
- esac
-
- export PYTHON_CFLAGS=${val}
- debug-print "${FUNCNAME}: PYTHON_CFLAGS = ${PYTHON_CFLAGS}"
- ;;
- PYTHON_LIBS)
- local val
-
- case "${impl}" in
- python2*|python3.6|python3.7*)
- # python* up to 3.7
- val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die
- ;;
- python*)
- # python3.8+
- val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}-embed) || die
- ;;
- *)
- die "${impl}: obtaining ${var} not supported"
- ;;
- esac
-
- export PYTHON_LIBS=${val}
- debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}"
- ;;
- PYTHON_CONFIG)
- local flags val
-
- case "${impl}" in
- python*)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- flags=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")') || die
- val=${PYTHON}${flags}-config
- ;;
- *)
- die "${impl}: obtaining ${var} not supported"
- ;;
- esac
-
- export PYTHON_CONFIG=${val}
- debug-print "${FUNCNAME}: PYTHON_CONFIG = ${PYTHON_CONFIG}"
- ;;
- PYTHON_PKG_DEP)
- local d
- case ${impl} in
- python2.7)
- PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7';;
- python*)
- PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
- pypy)
- PYTHON_PKG_DEP='>=dev-python/pypy-7.3.0:0=';;
- pypy3)
- PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.0:0=';;
- *)
- die "Invalid implementation: ${impl}"
- esac
-
- # use-dep
- if [[ ${PYTHON_REQ_USE} ]]; then
- PYTHON_PKG_DEP+=[${PYTHON_REQ_USE}]
- fi
-
- export PYTHON_PKG_DEP
- debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}"
- ;;
- PYTHON_SCRIPTDIR)
- local dir
- export PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl}
- debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}"
- ;;
- *)
- die "_python_export: unknown variable ${var}"
- esac
- done
-}
-
-# @FUNCTION: python_get_sitedir
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the 'site-packages' path for the given
-# implementation. If no implementation is provided, ${EPYTHON} will
-# be used.
-python_get_sitedir() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_SITEDIR
- echo "${PYTHON_SITEDIR}"
-}
-
-# @FUNCTION: python_get_includedir
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the include path for the given implementation. If no
-# implementation is provided, ${EPYTHON} will be used.
-python_get_includedir() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_INCLUDEDIR
- echo "${PYTHON_INCLUDEDIR}"
-}
-
-# @FUNCTION: python_get_library_path
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the Python library path for the given implementation.
-# If no implementation is provided, ${EPYTHON} will be used.
-#
-# Please note that this function can be used with CPython only. Use
-# in another implementation will result in a fatal failure.
-python_get_library_path() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_LIBPATH
- echo "${PYTHON_LIBPATH}"
-}
-
-# @FUNCTION: python_get_CFLAGS
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the compiler flags for building against Python,
-# for the given implementation. If no implementation is provided,
-# ${EPYTHON} will be used.
-#
-# Please note that this function can be used with CPython only.
-# It requires Python and pkg-config installed, and therefore proper
-# build-time dependencies need be added to the ebuild.
-python_get_CFLAGS() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_CFLAGS
- echo "${PYTHON_CFLAGS}"
-}
-
-# @FUNCTION: python_get_LIBS
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the compiler flags for linking against Python,
-# for the given implementation. If no implementation is provided,
-# ${EPYTHON} will be used.
-#
-# Please note that this function can be used with CPython only.
-# It requires Python and pkg-config installed, and therefore proper
-# build-time dependencies need be added to the ebuild.
-python_get_LIBS() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_LIBS
- echo "${PYTHON_LIBS}"
-}
-
-# @FUNCTION: python_get_PYTHON_CONFIG
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the PYTHON_CONFIG location for the given
-# implementation. If no implementation is provided, ${EPYTHON} will be
-# used.
-#
-# Please note that this function can be used with CPython only.
-# It requires Python installed, and therefore proper build-time
-# dependencies need be added to the ebuild.
-python_get_PYTHON_CONFIG() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_CONFIG
- echo "${PYTHON_CONFIG}"
-}
-
-# @FUNCTION: python_get_scriptdir
-# @USAGE: []
-# @DESCRIPTION:
-# Obtain and print the script install path for the given
-# implementation. If no implementation is provided, ${EPYTHON} will
-# be used.
-python_get_scriptdir() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_SCRIPTDIR
- echo "${PYTHON_SCRIPTDIR}"
-}
-
-# @FUNCTION: _python_ln_rel
-# @USAGE:
-# @INTERNAL
-# @DESCRIPTION:
-# Create a relative symlink.
-_python_ln_rel() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local target=${1}
- local symname=${2}
-
- local tgpath=${target%/*}/
- local sympath=${symname%/*}/
- local rel_target=
-
- while [[ ${sympath} ]]; do
- local tgseg= symseg=
-
- while [[ ! ${tgseg} && ${tgpath} ]]; do
- tgseg=${tgpath%%/*}
- tgpath=${tgpath#${tgseg}/}
- done
-
- while [[ ! ${symseg} && ${sympath} ]]; do
- symseg=${sympath%%/*}
- sympath=${sympath#${symseg}/}
- done
-
- if [[ ${tgseg} != ${symseg} ]]; then
- rel_target=../${rel_target}${tgseg:+${tgseg}/}
- fi
- done
- rel_target+=${tgpath}${target##*/}
-
- debug-print "${FUNCNAME}: ${symname} -> ${target}"
- debug-print "${FUNCNAME}: rel_target = ${rel_target}"
-
- ln -fs "${rel_target}" "${symname}"
-}
-
-# @FUNCTION: python_optimize
-# @USAGE: [...]
-# @DESCRIPTION:
-# Compile and optimize Python modules in specified directories (absolute
-# paths). If no directories are provided, the default system paths
-# are used (prepended with ${D}).
-python_optimize() {
- debug-print-function ${FUNCNAME} "${@}"
-
- if [[ ${EBUILD_PHASE} == pre* || ${EBUILD_PHASE} == post* ]]; then
- eerror "The new Python eclasses expect the compiled Python files to"
- eerror "be controlled by the Package Manager. For this reason,"
- eerror "the python_optimize function can be used only during src_* phases"
- eerror "(src_install most commonly) and not during pkg_* phases."
- echo
- die "python_optimize is not to be used in pre/post* phases"
- fi
-
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
-
- local PYTHON=${PYTHON}
- [[ ${PYTHON} ]] || _python_export PYTHON
- [[ -x ${PYTHON} ]] || die "PYTHON (${PYTHON}) is not executable"
-
- # default to sys.path
- if [[ ${#} -eq 0 ]]; then
- local f
- while IFS= read -r -d '' f; do
- # 1) accept only absolute paths
- # (i.e. skip '', '.' or anything like that)
- # 2) skip paths which do not exist
- # (python2.6 complains about them verbosely)
-
- if [[ ${f} == /* && -d ${D%/}${f} ]]; then
- set -- "${D%/}${f}" "${@}"
- fi
- done < <("${PYTHON}" -c 'import sys; print("".join(x + "\0" for x in sys.path))' || die)
-
- debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"
- fi
-
- local d
- for d; do
- # make sure to get a nice path without //
- local instpath=${d#${D%/}}
- instpath=/${instpath##/}
-
- case "${EPYTHON}" in
- python2.7|python3.[34])
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
- ;;
- python*|pypy3)
- # both levels of optimization are separate since 3.5
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -O -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
- ;;
- *)
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
- ;;
- esac
- done
-}
-
-# @FUNCTION: python_scriptinto
-# @USAGE:
-# @DESCRIPTION:
-# Set the directory to which files passed to python_doexe(),
-# python_doscript(), python_newexe() and python_newscript()
-# are going to be installed. The new value needs to be relative
-# to the installation root (${ED}).
-#
-# If not set explicitly, the directory defaults to /usr/bin.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_scriptinto /usr/sbin
-# python_foreach_impl python_doscript foo
-# }
-# @CODE
-python_scriptinto() {
- debug-print-function ${FUNCNAME} "${@}"
-
- python_scriptroot=${1}
-}
-
-# @FUNCTION: python_doexe
-# @USAGE: ...
-# @DESCRIPTION:
-# Install the given executables into the executable install directory,
-# for the current Python implementation (${EPYTHON}).
-#
-# The executable will be wrapped properly for the Python implementation,
-# though no shebang mangling will be performed.
-python_doexe() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local f
- for f; do
- python_newexe "${f}" "${f##*/}"
- done
-}
-
-# @FUNCTION: python_newexe
-# @USAGE:
-# @DESCRIPTION:
-# Install the given executable into the executable install directory,
-# for the current Python implementation (${EPYTHON}).
-#
-# The executable will be wrapped properly for the Python implementation,
-# though no shebang mangling will be performed. It will be renamed
-# to .
-python_newexe() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
- [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} "
-
- local wrapd=${python_scriptroot:-/usr/bin}
-
- local f=${1}
- local newfn=${2}
-
- local scriptdir=$(python_get_scriptdir)
- local d=${scriptdir#${EPREFIX}}
-
- (
- dodir "${wrapd}"
- exeopts -m 0755
- exeinto "${d}"
- newexe "${f}" "${newfn}" || return ${?}
- )
-
- # install the wrapper
- _python_ln_rel "${ED%/}"/usr/lib/python-exec/python-exec2 \
- "${ED%/}/${wrapd}/${newfn}" || die
-
- # don't use this at home, just call python_doscript() instead
- if [[ ${_PYTHON_REWRITE_SHEBANG} ]]; then
- python_fix_shebang -q "${ED%/}/${d}/${newfn}"
- fi
-}
-
-# @FUNCTION: python_doscript
-# @USAGE: ...
-# @DESCRIPTION:
-# Install the given scripts into the executable install directory,
-# for the current Python implementation (${EPYTHON}).
-#
-# All specified files must start with a 'python' shebang. The shebang
-# will be converted, and the files will be wrapped properly
-# for the Python implementation.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_foreach_impl python_doscript ${PN}
-# }
-# @CODE
-python_doscript() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local _PYTHON_REWRITE_SHEBANG=1
- python_doexe "${@}"
-}
-
-# @FUNCTION: python_newscript
-# @USAGE:
-# @DESCRIPTION:
-# Install the given script into the executable install directory
-# for the current Python implementation (${EPYTHON}), and name it
-# .
-#
-# The file must start with a 'python' shebang. The shebang will be
-# converted, and the file will be wrapped properly for the Python
-# implementation. It will be renamed to .
-#
-# Example:
-# @CODE
-# src_install() {
-# python_foreach_impl python_newscript foo.py foo
-# }
-# @CODE
-python_newscript() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local _PYTHON_REWRITE_SHEBANG=1
- python_newexe "${@}"
-}
-
-# @FUNCTION: python_moduleinto
-# @USAGE:
-# @DESCRIPTION:
-# Set the Python module install directory for python_domodule().
-# The can either be an absolute target system path (in which
-# case it needs to start with a slash, and ${ED} will be prepended to
-# it) or relative to the implementation's site-packages directory
-# (then it must not start with a slash). The relative path can be
-# specified either using the Python package notation (separated by dots)
-# or the directory notation (using slashes).
-#
-# When not set explicitly, the modules are installed to the top
-# site-packages directory.
-#
-# In the relative case, the exact path is determined directly
-# by each python_doscript/python_newscript function. Therefore,
-# python_moduleinto can be safely called before establishing the Python
-# interpreter and/or a single call can be used to set the path correctly
-# for multiple implementations, as can be seen in the following example.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_moduleinto bar
-# # installs ${PYTHON_SITEDIR}/bar/baz.py
-# python_foreach_impl python_domodule baz.py
-# }
-# @CODE
-python_moduleinto() {
- debug-print-function ${FUNCNAME} "${@}"
-
- python_moduleroot=${1}
-}
-
-# @FUNCTION: python_domodule
-# @USAGE: ...
-# @DESCRIPTION:
-# Install the given modules (or packages) into the current Python module
-# installation directory. The list can mention both modules (files)
-# and packages (directories). All listed files will be installed
-# for all enabled implementations, and compiled afterwards.
-#
-# Example:
-# @CODE
-# src_install() {
-# # (${PN} being a directory)
-# python_foreach_impl python_domodule ${PN}
-# }
-# @CODE
-python_domodule() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
-
- local d
- if [[ ${python_moduleroot} == /* ]]; then
- # absolute path
- d=${python_moduleroot}
- else
- # relative to site-packages
- local sitedir=$(python_get_sitedir)
- d=${sitedir#${EPREFIX}}/${python_moduleroot//.//}
- fi
-
- (
- insopts -m 0644
- insinto "${d}"
- doins -r "${@}" || return ${?}
- )
-
- python_optimize "${ED%/}/${d}"
-}
-
-# @FUNCTION: python_doheader
-# @USAGE: ...
-# @DESCRIPTION:
-# Install the given headers into the implementation-specific include
-# directory. This function is unconditionally recursive, i.e. you can
-# pass directories instead of files.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_foreach_impl python_doheader foo.h bar.h
-# }
-# @CODE
-python_doheader() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
-
- local includedir=$(python_get_includedir)
- local d=${includedir#${EPREFIX}}
-
- (
- insopts -m 0644
- insinto "${d}"
- doins -r "${@}" || return ${?}
- )
-}
-
-# @FUNCTION: python_wrapper_setup
-# @USAGE: [ []]
-# @DESCRIPTION:
-# Backwards compatibility function. The relevant API is now considered
-# private, please use python_setup instead.
-python_wrapper_setup() {
- debug-print-function ${FUNCNAME} "${@}"
-
- eqawarn "python_wrapper_setup() is part of private eclass API."
- eqawarn "Please call python_setup() instead."
-
- _python_wrapper_setup "${@}"
-}
-
-# @FUNCTION: _python_wrapper_setup
-# @USAGE: [ []]
-# @INTERNAL
-# @DESCRIPTION:
-# Create proper 'python' executable and pkg-config wrappers
-# (if available) in the directory named by . Set up PATH
-# and PKG_CONFIG_PATH appropriately. defaults to ${T}/${EPYTHON}.
-#
-# The wrappers will be created for implementation named by ,
-# or for one named by ${EPYTHON} if no passed.
-#
-# If the named directory contains a python symlink already, it will
-# be assumed to contain proper wrappers already and only environment
-# setup will be done. If wrapper update is requested, the directory
-# shall be removed first.
-_python_wrapper_setup() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local workdir=${1:-${T}/${EPYTHON}}
- local impl=${2:-${EPYTHON}}
-
- [[ ${workdir} ]] || die "${FUNCNAME}: no workdir specified."
- [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON specified."
-
- if [[ ! -x ${workdir}/bin/python ]]; then
- _python_check_dead_variables
-
- mkdir -p "${workdir}"/{bin,pkgconfig} || die
-
- # Clean up, in case we were supposed to do a cheap update.
- rm -f "${workdir}"/bin/python{,2,3}{,-config} || die
- rm -f "${workdir}"/bin/2to3 || die
- rm -f "${workdir}"/pkgconfig/python{2,3}{,-embed}.pc || die
-
- local EPYTHON PYTHON
- _python_export "${impl}" EPYTHON PYTHON
-
- local pyver pyother
- if python_is_python3; then
- pyver=3
- pyother=2
- else
- pyver=2
- pyother=3
- fi
-
- # Python interpreter
- # note: we don't use symlinks because python likes to do some
- # symlink reading magic that breaks stuff
- # https://bugs.gentoo.org/show_bug.cgi?id=555752
- cat > "${workdir}/bin/python" <<-_EOF_ || die
- #!/bin/sh
- exec "${PYTHON}" "\${@}"
- _EOF_
- cp "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die
- chmod +x "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die
-
- local nonsupp=( "python${pyother}" "python${pyother}-config" )
-
- # CPython-specific
- if [[ ${EPYTHON} == python* ]]; then
- cat > "${workdir}/bin/python-config" <<-_EOF_ || die
- #!/bin/sh
- exec "${PYTHON}-config" "\${@}"
- _EOF_
- cp "${workdir}/bin/python-config" \
- "${workdir}/bin/python${pyver}-config" || die
- chmod +x "${workdir}/bin/python-config" \
- "${workdir}/bin/python${pyver}-config" || die
-
- # Python 2.6+.
- ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die
-
- # Python 2.7+.
- ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc \
- "${workdir}"/pkgconfig/python${pyver}.pc || die
-
- # Python 3.8+.
- if [[ ${EPYTHON} != python[23].[67] ]]; then
- ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \
- "${workdir}"/pkgconfig/python${pyver}-embed.pc || die
- fi
- else
- nonsupp+=( 2to3 python-config "python${pyver}-config" )
- fi
-
- local x
- for x in "${nonsupp[@]}"; do
- cat >"${workdir}"/bin/${x} <<-_EOF_ || die
- #!/bin/sh
- echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${EPYTHON} (PYTHON_COMPAT)" >&2
- exit 127
- _EOF_
- chmod +x "${workdir}"/bin/${x} || die
- done
- fi
-
- # Now, set the environment.
- # But note that ${workdir} may be shared with something else,
- # and thus already on top of PATH.
- if [[ ${PATH##:*} != ${workdir}/bin ]]; then
- PATH=${workdir}/bin${PATH:+:${PATH}}
- fi
- if [[ ${PKG_CONFIG_PATH##:*} != ${workdir}/pkgconfig ]]; then
- PKG_CONFIG_PATH=${workdir}/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
- fi
- export PATH PKG_CONFIG_PATH
-}
-
-# @FUNCTION: python_is_python3
-# @USAGE: []
-# @DESCRIPTION:
-# Check whether (or ${EPYTHON}) is a Python3k variant
-# (i.e. uses syntax and stdlib of Python 3.*).
-#
-# Returns 0 (true) if it is, 1 (false) otherwise.
-python_is_python3() {
- local impl=${1:-${EPYTHON}}
- [[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON"
-
- [[ ${impl} == python3* || ${impl} == pypy3 ]]
-}
-
-# @FUNCTION: python_is_installed
-# @USAGE: []
-# @DESCRIPTION:
-# Check whether the interpreter for (or ${EPYTHON}) is installed.
-# Uses has_version with a proper dependency string.
-#
-# Returns 0 (true) if it is, 1 (false) otherwise.
-python_is_installed() {
- local impl=${1:-${EPYTHON}}
- [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
- local hasv_args=()
-
- case ${EAPI} in
- 5|6)
- hasv_args+=( --host-root )
- ;;
- *)
- hasv_args+=( -b )
- ;;
- esac
-
- local PYTHON_PKG_DEP
- _python_export "${impl}" PYTHON_PKG_DEP
- has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
-}
-
-# @FUNCTION: python_fix_shebang
-# @USAGE: [-f|--force] [-q|--quiet] ...
-# @DESCRIPTION:
-# Replace the shebang in Python scripts with the current Python
-# implementation (EPYTHON). If a directory is passed, works recursively
-# on all Python scripts.
-#
-# Only files having a 'python*' shebang will be modified. Files with
-# other shebang will either be skipped when working recursively
-# on a directory or treated as error when specified explicitly.
-#
-# Shebangs matching explicitly current Python version will be left
-# unmodified. Shebangs requesting another Python version will be treated
-# as fatal error, unless --force is given.
-#
-# --force causes the function to replace even shebangs that require
-# incompatible Python version. --quiet causes the function not to list
-# modified files verbosely.
-python_fix_shebang() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EPYTHON} ]] || die "${FUNCNAME}: EPYTHON unset (pkg_setup not called?)"
-
- local force quiet
- while [[ ${@} ]]; do
- case "${1}" in
- -f|--force) force=1; shift;;
- -q|--quiet) quiet=1; shift;;
- --) shift; break;;
- *) break;;
- esac
- done
-
- [[ ${1} ]] || die "${FUNCNAME}: no paths given"
-
- local path f
- for path; do
- local any_correct any_fixed is_recursive
-
- [[ -d ${path} ]] && is_recursive=1
-
- while IFS= read -r -d '' f; do
- local shebang i
- local error= from=
-
- # note: we can't ||die here since read will fail if file
- # has no newline characters
- IFS= read -r shebang <"${f}"
-
- # First, check if it's shebang at all...
- if [[ ${shebang} == '#!'* ]]; then
- local split_shebang=()
- read -r -a split_shebang <<<${shebang} || die
-
- # Match left-to-right in a loop, to avoid matching random
- # repetitions like 'python2.7 python2'.
- for i in "${split_shebang[@]}"; do
- case "${i}" in
- *"${EPYTHON}")
- debug-print "${FUNCNAME}: in file ${f#${D%/}}"
- debug-print "${FUNCNAME}: shebang matches EPYTHON: ${shebang}"
-
- # Nothing to do, move along.
- any_correct=1
- from=${EPYTHON}
- break
- ;;
- *python|*python[23])
- debug-print "${FUNCNAME}: in file ${f#${D%/}}"
- debug-print "${FUNCNAME}: rewriting shebang: ${shebang}"
-
- if [[ ${i} == *python2 ]]; then
- from=python2
- if [[ ! ${force} ]]; then
- python_is_python3 "${EPYTHON}" && error=1
- fi
- elif [[ ${i} == *python3 ]]; then
- from=python3
- if [[ ! ${force} ]]; then
- python_is_python3 "${EPYTHON}" || error=1
- fi
- else
- from=python
- fi
- break
- ;;
- *python[23].[0123456789]|*pypy|*pypy3|*jython[23].[0123456789])
- # Explicit mismatch.
- if [[ ! ${force} ]]; then
- error=1
- else
- case "${i}" in
- *python[23].[0123456789])
- from="python[23].[0123456789]";;
- *pypy)
- from="pypy";;
- *pypy3)
- from="pypy3";;
- *jython[23].[0123456789])
- from="jython[23].[0123456789]";;
- *)
- die "${FUNCNAME}: internal error in 2nd pattern match";;
- esac
- fi
- break
- ;;
- esac
- done
- fi
-
- if [[ ! ${error} && ! ${from} ]]; then
- # Non-Python shebang. Allowed in recursive mode,
- # disallowed when specifying file explicitly.
- [[ ${is_recursive} ]] && continue
- error=1
- fi
-
- if [[ ! ${quiet} ]]; then
- einfo "Fixing shebang in ${f#${D%/}}."
- fi
-
- if [[ ! ${error} ]]; then
- # We either want to match ${from} followed by space
- # or at end-of-string.
- if [[ ${shebang} == *${from}" "* ]]; then
- sed -i -e "1s:${from} :${EPYTHON} :" "${f}" || die
- else
- sed -i -e "1s:${from}$:${EPYTHON}:" "${f}" || die
- fi
- any_fixed=1
- else
- eerror "The file has incompatible shebang:"
- eerror " file: ${f#${D%/}}"
- eerror " current shebang: ${shebang}"
- eerror " requested impl: ${EPYTHON}"
- die "${FUNCNAME}: conversion of incompatible shebang requested"
- fi
- done < <(find -H "${path}" -type f -print0 || die)
-
- if [[ ! ${any_fixed} ]]; then
- local cmd=eerror
- [[ ${EAPI} == 5 ]] && cmd=eqawarn
-
- "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
- if [[ ${any_correct} ]]; then
- "${cmd}" "All files have ${EPYTHON} shebang already."
- else
- "${cmd}" "There are no Python files in specified directory."
- fi
-
- [[ ${cmd} == eerror ]] && die "${FUNCNAME} did not match any fixable files (QA warning fatal in EAPI ${EAPI})"
- fi
- done
-}
-
-# @FUNCTION: _python_check_locale_sanity
-# @USAGE:
-# @RETURN: 0 if sane, 1 otherwise
-# @INTERNAL
-# @DESCRIPTION:
-# Check whether the specified locale sanely maps between lowercase
-# and uppercase ASCII characters.
-_python_check_locale_sanity() {
- local -x LC_ALL=${1}
- local IFS=
-
- local lc=( {a..z} )
- local uc=( {A..Z} )
- local input="${lc[*]}${uc[*]}"
-
- local output=$(tr '[:lower:][:upper:]' '[:upper:][:lower:]' <<<"${input}")
- [[ ${output} == "${uc[*]}${lc[*]}" ]]
-}
-
-# @FUNCTION: python_export_utf8_locale
-# @RETURN: 0 on success, 1 on failure.
-# @DESCRIPTION:
-# Attempts to export a usable UTF-8 locale in the LC_CTYPE variable. Does
-# nothing if LC_ALL is defined, or if the current locale uses a UTF-8 charmap.
-# This may be used to work around the quirky open() behavior of python3.
-python_export_utf8_locale() {
- debug-print-function ${FUNCNAME} "${@}"
-
- # If the locale program isn't available, just return.
- type locale >/dev/null || return 0
-
- if [[ $(locale charmap) != UTF-8 ]]; then
- # Try English first, then everything else.
- local lang locales="C.UTF-8 en_US.UTF-8 en_GB.UTF-8 $(locale -a)"
-
- for lang in ${locales}; do
- if [[ $(LC_ALL=${lang} locale charmap 2>/dev/null) == UTF-8 ]]; then
- if _python_check_locale_sanity "${lang}"; then
- export LC_CTYPE=${lang}
- if [[ -n ${LC_ALL} ]]; then
- export LC_NUMERIC=${LC_ALL}
- export LC_TIME=${LC_ALL}
- export LC_COLLATE=${LC_ALL}
- export LC_MONETARY=${LC_ALL}
- export LC_MESSAGES=${LC_ALL}
- export LC_PAPER=${LC_ALL}
- export LC_NAME=${LC_ALL}
- export LC_ADDRESS=${LC_ALL}
- export LC_TELEPHONE=${LC_ALL}
- export LC_MEASUREMENT=${LC_ALL}
- export LC_IDENTIFICATION=${LC_ALL}
- export LC_ALL=
- fi
- return 0
- fi
- fi
- done
-
- ewarn "Could not find a UTF-8 locale. This may trigger build failures in"
- ewarn "some python packages. Please ensure that a UTF-8 locale is listed in"
- ewarn "/etc/locale.gen and run locale-gen."
- return 1
- fi
-
- return 0
-}
-
-# @FUNCTION: build_sphinx
-# @USAGE:
-# @DESCRIPTION:
-# Build HTML documentation using dev-python/sphinx in the specified
-# . Takes care of disabling Intersphinx and appending
-# to HTML_DOCS.
-#
-# If is relative to the current directory, care needs
-# to be taken to run einstalldocs from the same directory
-# (usually ${S}).
-build_sphinx() {
- debug-print-function ${FUNCNAME} "${@}"
- [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes 1 arg: "
-
- local dir=${1}
-
- sed -i -e 's:^intersphinx_mapping:disabled_&:' \
- "${dir}"/conf.py || die
- # not all packages include the Makefile in pypi tarball
- sphinx-build -b html -d "${dir}"/_build/doctrees "${dir}" \
- "${dir}"/_build/html || die
-
- HTML_DOCS+=( "${dir}/_build/html/." )
-}
-
-# -- python.eclass functions --
-
-_python_check_dead_variables() {
- local v
-
- for v in PYTHON_DEPEND PYTHON_USE_WITH{,_OR,_OPT} {RESTRICT,SUPPORT}_PYTHON_ABIS
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Ebuild_head"
- fi
- done
-
- for v in PYTHON_{CPPFLAGS,CFLAGS,CXXFLAGS,LDFLAGS}
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#PYTHON_CFLAGS"
- fi
- done
-
- for v in PYTHON_TESTS_RESTRICTED_ABIS PYTHON_EXPORT_PHASE_FUNCTIONS \
- PYTHON_VERSIONED_{SCRIPTS,EXECUTABLES} PYTHON_NONVERSIONED_EXECUTABLES
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite"
- fi
- done
-
- for v in DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES DISTUTILS_SETUP_FILES \
- DISTUTILS_GLOBAL_OPTIONS DISTUTILS_SRC_TEST PYTHON_MODNAME
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for distutils-r1, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#${v}"
- fi
- done
-
- if [[ ${DISTUTILS_DISABLE_TEST_DEPENDENCY} ]]; then
- die "${v} is invalid for distutils-r1, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#DISTUTILS_SRC_TEST"
- fi
-
- # python.eclass::progress
- for v in PYTHON_BDEPEND PYTHON_MULTIPLE_ABIS PYTHON_ABI_TYPE \
- PYTHON_RESTRICTED_ABIS PYTHON_TESTS_FAILURES_TOLERANT_ABIS \
- PYTHON_CFFI_MODULES_GENERATION_COMMANDS
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite"
- fi
- done
-}
-
-python_pkg_setup() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup"
-}
-
-python_convert_shebangs() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_convert_shebangs"
-}
-
-python_clean_py-compile_files() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_clean_installation_image() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_function() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_execute_function"
-}
-
-python_generate_wrapper_scripts() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_merge_intermediate_installation_images() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_set_active_version() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup"
-}
-
-python_need_rebuild() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-PYTHON() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#.24.28PYTHON.29.2C_.24.7BEPYTHON.7D"
-}
-
-python_get_implementation() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_implementational_package() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_libdir() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_library() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_version() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_implementation_and_version() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_nosetests() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_py.test() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_trial() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_enable_pyc() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_disable_pyc() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_mod_optimize() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Python_byte-code_compilation"
-}
-
-python_mod_cleanup() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Python_byte-code_compilation"
-}
-
-# python.eclass::progress
-
-python_abi_depend() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_install_executables() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_extension_module_suffix() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_byte-compile_modules() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_clean_byte-compiled_modules() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_generate_cffi_modules() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-_PYTHON_UTILS_R1=1
-fi