diff options
29 files changed, 790 insertions, 485 deletions
diff --git a/app-admin/awscli/Manifest b/app-admin/awscli/Manifest index 7a4c904a23fc..fcc842da83a2 100644 --- a/app-admin/awscli/Manifest +++ b/app-admin/awscli/Manifest @@ -5,3 +5,4 @@ DIST awscli-1.22.47.tar.gz 2161197 BLAKE2B ede83ea2a0ca35aab53eea5950eab59a5f845 DIST awscli-1.22.48.tar.gz 2161566 BLAKE2B f9ced24e30951ec517753fa0d1e8c321d9f5d2b32374c82c794f669c012f6e56b69456fed550db2c1753d9cd9c0bf4c5a964c5dc656e66da99815ee063940323 SHA512 149d06dd400d4a5616d4da38c5b6ef4223da88f09ce77e82524dac1b1cb27deb047b032759f0188ba6a6fda456101e361655fa363fd2c50554a3a1e506e5ffe1 DIST awscli-1.22.49.tar.gz 2161874 BLAKE2B de97f0f9aeb075049e69c5bbd4bc67d59ba964f6508c92f8c2d1574f77dd4f2d602cd16b07270242c516e68d4119f8df95834935bfbcb16eccc3c1bc0a6cb08a SHA512 d55cf65bb8f70e4f98bd1eb0a79385d0959985b1b969e6f0269e7185c4af2cf3b40e0cd6d736431a489e21e4ec5b055ac0727dd1b2226b6d4dc6b19c4609ff11 DIST awscli-1.22.50.tar.gz 2162541 BLAKE2B cd7dda4d0d36897d299b39798d7ee5810a5b5d45759c548bf02ab66694954e470b00e141d6459dd8741c64dfc565e8227f468bd1f95c020963f0f8151460da18 SHA512 bd8e9b71eb370e409e3b06ff9c20db84f6329eef49b50fedf21225767ef7433f1d941c8f224e82a10159c319a87ab3b69a9255446ee3d0ce6f65c00531c1bb7d +DIST awscli-1.22.51.tar.gz 2163551 BLAKE2B cd7c0b312b96f1dc44f9826a6606deb6d7467b64a674efbb6d8293720c9daa9bdc3cea9d71f2da75fe308fd80bead172f2cfcdba045e6debe44d1e884c0aa64b SHA512 c4bfa7022181c93fd319b18d916ed1af281b4a6bbefb81e693e4479b3ed07200e4c8c8687b79bd0d411b194e049fcbbf8e59c977ce551076b98840f973621bf4 diff --git a/app-admin/awscli/awscli-1.22.51.ebuild b/app-admin/awscli/awscli-1.22.51.ebuild new file mode 100644 index 000000000000..1f3430af8a9f --- /dev/null +++ b/app-admin/awscli/awscli-1.22.51.ebuild @@ -0,0 +1,58 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{8..10} ) +inherit bash-completion-r1 distutils-r1 + +DESCRIPTION="Universal Command Line Environment for AWS" +HOMEPAGE="https://pypi.org/project/awscli/" +#SRC_URI="mirror://pypi/${P:0:1}/${PN}/${P}.tar.gz" +SRC_URI="https://github.com/aws/aws-cli/archive/${PV}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/aws-cli-${PV}" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86" + +# botocore is x.(y+1).z +BOTOCORE_PV="$(ver_cut 1).$(( $(ver_cut 2) + 1)).$(ver_cut 3-)" +RDEPEND=" + >=dev-python/botocore-${BOTOCORE_PV}[${PYTHON_USEDEP}] + dev-python/colorama[${PYTHON_USEDEP}] + dev-python/docutils[${PYTHON_USEDEP}] + dev-python/rsa[${PYTHON_USEDEP}] + >=dev-python/s3transfer-0.4.0[${PYTHON_USEDEP}] + dev-python/pyyaml[${PYTHON_USEDEP}] +" + +distutils_enable_tests pytest + +src_prepare() { + # do not rely on bundled deps in botocore (sic!) + find -name '*.py' -exec sed -i \ + -e 's:from botocore[.]vendored import:import:' \ + -e 's:from botocore[.]vendored[.]:from :' \ + {} + || die + # strip overzealous upper bounds on requirements + sed -i -e 's:,<[0-9.]*::' -e 's:==:>=:' setup.py || die + distutils-r1_src_prepare +} + +python_test() { + # integration tests require AWS credentials and Internet access + epytest tests/{functional,unit} +} + +python_install_all() { + newbashcomp bin/aws_bash_completer aws + + insinto /usr/share/zsh/site-functions + newins bin/aws_zsh_completer.sh _aws + + distutils-r1_python_install_all + + rm "${ED}"/usr/bin/{aws.cmd,aws_bash_completer,aws_zsh_completer.sh} || die +} diff --git a/dev-java/lmax-disruptor/Manifest b/dev-java/lmax-disruptor/Manifest new file mode 100644 index 000000000000..07618fb8c6fc --- /dev/null +++ b/dev-java/lmax-disruptor/Manifest @@ -0,0 +1 @@ +DIST lmax-disruptor-3.4.4.tar.gz 237165 BLAKE2B ff17747e24a587e4b0656e16281ecf98cad5b3f260cd270a87e157ccbd6afc4a4e0886fcfab774a3c7919a9f5d26e13199a3cbcd3f7699986d4f9a36576f72dd SHA512 871d474ecbc4e09d33b0d099232f2abdf88b755141e00406e4a721e5bd6c5edc99c6c446277e054bd603ae9b158bdb6b438aa6e8532194dca9bce953b748bfde diff --git a/dev-java/lmax-disruptor/lmax-disruptor-3.4.4.ebuild b/dev-java/lmax-disruptor/lmax-disruptor-3.4.4.ebuild new file mode 100644 index 000000000000..7965344532c6 --- /dev/null +++ b/dev-java/lmax-disruptor/lmax-disruptor-3.4.4.ebuild @@ -0,0 +1,41 @@ +# Copyright 2021-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +JAVA_PKG_IUSE="doc source test" +MAVEN_ID="com.lmax:disruptor:3.4.4" +JAVA_TESTING_FRAMEWORKS="junit-4" + +inherit java-pkg-2 java-pkg-simple + +DESCRIPTION="A High Performance Inter-Thread Messaging Library" +HOMEPAGE="https://lmax-exchange.github.io/disruptor/" +SRC_URI="https://github.com/LMAX-Exchange/disruptor/archive/${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" + +DEPEND=">=virtual/jdk-1.8:*" +RDEPEND=">=virtual/jre-1.8:*" + +DOCS=( LICENCE.txt README.md ) + +S="${WORKDIR}/disruptor-${PV}" + +JAVA_SRC_DIR="src/main" + +JAVA_TEST_GENTOO_CLASSPATH="junit-4" +JAVA_TEST_SRC_DIR="src/test" +JAVA_TEST_EXCLUDES=( + # valid test classes have pattern *Test with nothing behind + com.lmax.disruptor.dsl.stubs.TestWorkHandler # No runnable methods + com.lmax.disruptor.support.TestEvent # No runnable methods + com.lmax.disruptor.support.TestWaiter # No runnable methods +) + +src_install() { + default # https://bugs.gentoo.org/789582 + java-pkg-simple_src_install +} diff --git a/dev-java/lmax-disruptor/metadata.xml b/dev-java/lmax-disruptor/metadata.xml new file mode 100644 index 000000000000..bc7984dba201 --- /dev/null +++ b/dev-java/lmax-disruptor/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>java@gentoo.org</email> + </maintainer> + <upstream> + <remote-id type="github">LMAX-Exchange/disruptor</remote-id> + <bugs-to>https://github.com/LMAX-Exchange/disruptor/issues</bugs-to> + </upstream> +</pkgmetadata> diff --git a/dev-python/boto3/Manifest b/dev-python/boto3/Manifest index 60678dd3b5c5..209f4b1b4fd3 100644 --- a/dev-python/boto3/Manifest +++ b/dev-python/boto3/Manifest @@ -5,3 +5,4 @@ DIST boto3-1.20.47.tar.gz 465774 BLAKE2B ab615d29d79b209671808770968c38c2ef26b83 DIST boto3-1.20.48.tar.gz 466063 BLAKE2B 7ba92d1cfbd576d4262e0f99a9e9aa118747fbbe60caa703c14f24559d4c2312b3e7695c40b6555bd58f7beb248e7ecfcedd64bc84badb44cb96812c9537cabe SHA512 e80f2e54909a3a54e5eba9c9a75c0ccbb2ba3f8907dfec9563f50bef1be56b82b593ae0bc0ee0bfab1a7c993d4bbf0c624486822ef3cd93ef425f39205b628f0 DIST boto3-1.20.49.tar.gz 466426 BLAKE2B 82f2ed7f14576afd5a4d2dab91b99986904fef97b98460dce152e0806cb20e39b14975e4c3362c9d208c4dce9de3e7a4fa9fa60559aa0007ff735ce9e43995e4 SHA512 6ea92236726b9200a8b06f773483b0d6803585480cfad1f68eab227598ca86c3aa93cbeccec5338febc52eb48691f003c5983d52be56dd91e97735ddbfac7053 DIST boto3-1.20.50.tar.gz 466795 BLAKE2B 662284de4654781391605fba93f401ec24300abab696c02146739598e9206598e92539ff9468f99b108d3ac00f72555945986e04e2b6625baace11b8f9b746ef SHA512 103a75edc907ea9a7ed5d08bb8a2f31b1360495a130d0492461956c0ec5c1e1b839187d9d9feaebf7eb06e2d367f9fcdc1c522c234be3314fceca7884651d54e +DIST boto3-1.20.51.tar.gz 467620 BLAKE2B 18cb273cd7af7184baa40b5ac98be270324e221f8fd408b3f4ecf1d1cfff387af84d72207281f6ac906c1f55048d603001d865acc509451b555fa57a3b1f848e SHA512 c4a3ab6460e58e3bad305dbd12b4719b07ee0c92bed30e1fff017d6df93883f50fca388389c1cf8b474c42c049f189106c3e71f087e7fe9c921b81c796acc70b diff --git a/dev-python/boto3/boto3-1.20.51.ebuild b/dev-python/boto3/boto3-1.20.51.ebuild new file mode 100644 index 000000000000..48ea5aa483a1 --- /dev/null +++ b/dev-python/boto3/boto3-1.20.51.ebuild @@ -0,0 +1,60 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{8..10} ) +inherit distutils-r1 + +DESCRIPTION="The AWS SDK for Python" +HOMEPAGE="https://github.com/boto/boto3" +LICENSE="Apache-2.0" +SLOT="0" + +if [[ "${PV}" == "9999" ]]; then + EGIT_REPO_URI="https://github.com/boto/boto3" + inherit git-r3 + BOTOCORE_PV=${PV} +else + SRC_URI="https://github.com/boto/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux" + + # botocore is x.(y+3).z + BOTOCORE_PV="$(ver_cut 1).$(( $(ver_cut 2) + 3)).$(ver_cut 3-)" +fi + +RDEPEND=" + >=dev-python/botocore-${BOTOCORE_PV}[${PYTHON_USEDEP}] + >=dev-python/jmespath-0.7.1[${PYTHON_USEDEP}] + >=dev-python/s3transfer-0.3.0[${PYTHON_USEDEP}] +" +BDEPEND=" + test? ( + dev-python/mock[${PYTHON_USEDEP}] + ) +" + +distutils_enable_sphinx docs/source \ + 'dev-python/guzzle_sphinx_theme' +distutils_enable_tests pytest + +python_prepare_all() { + # don't lock versions to narrow ranges + sed -e '/botocore/ d' \ + -e '/jmespath/ d' \ + -e '/s3transfer/ d' \ + -i setup.py || die + + # do not rely on bundled deps in botocore (sic!) + find -name '*.py' -exec sed -i \ + -e 's:from botocore[.]vendored import:import:' \ + -e 's:from botocore[.]vendored[.]:from :' \ + {} + || die + + distutils-r1_python_prepare_all +} + +python_test() { + epytest tests/{functional,unit} +} diff --git a/dev-python/botocore/Manifest b/dev-python/botocore/Manifest index dd2a0116f4f8..22c1b531eec8 100644 --- a/dev-python/botocore/Manifest +++ b/dev-python/botocore/Manifest @@ -5,3 +5,4 @@ DIST botocore-1.23.47.tar.gz 8757185 BLAKE2B 7d80ec4a869ed9c86b47a1fe8a7e9913381 DIST botocore-1.23.48.tar.gz 8757876 BLAKE2B e70a1aa1fdbeab5246640d9e5fc26ac6853491e32cdd0a29ef98d4dda441f4b61ae16011298cf2da0434d5668260010cd2a70c2cc760fc2c282b236b278158f3 SHA512 ad2d8e632ff7da1a1b677876b9d4345a9ba60a407f77deb8fe9df7108495853ff9a915b8e5956f6cf226501d6fe34d8328fdb7446c4a8db5b3f219ca2fbe1cb6 DIST botocore-1.23.49.tar.gz 8758361 BLAKE2B 5e53366fdd705e81af6752665f3078e26d55460bc2e3644fa030f6b3a4485bd504c445ac15d6b6abcdb164d6c93f33fe8a596d5eb8e7f85c10363cd93a3d3e58 SHA512 2450752613a815a67f007a23371e0349a2ebaa991f3b48062bab5ed5736fa11255e206a20cc71a2477b65673f689c5447229a9e0c14358ffcd322e1f55971a86 DIST botocore-1.23.50.tar.gz 8758107 BLAKE2B ac43af21c46168bc0c14f3afe6afb06e1e33e09af9c0f62bc6331f6bb2240563e137dcf23381ec0e4ed97f79e3475a70ae73ded969b0c9f954f01361504134ee SHA512 64230e9d6d4b4916fcbe8d2fdbba2ee0575a85de56160518e8ad48f2f1566f7cec0667cd9bd53f2afa514f5f6e341cc681b2830a43ac82e3356c1e82a49e2c7a +DIST botocore-1.23.51.tar.gz 8763657 BLAKE2B f8abe69785f50c244073a791c124a51c8f92e67b0245465e878f13449b999585849e88f706392709caea26d69fb3850b9749cc9a57ea5c1df62f08008b8d56fc SHA512 e54cf59656bd5144b1f85d4ea57eaefd5ea4ac570b877771e06df62f442e61b2f239c1a4dd083c26cb75905d139cf681dcba67e3d89d2af0b99e416e65141917 diff --git a/dev-python/botocore/botocore-1.23.51.ebuild b/dev-python/botocore/botocore-1.23.51.ebuild new file mode 100644 index 000000000000..79a1cd5da0e2 --- /dev/null +++ b/dev-python/botocore/botocore-1.23.51.ebuild @@ -0,0 +1,65 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{8..10} ) +inherit distutils-r1 + +DESCRIPTION="Low-level, data-driven core of boto 3" +HOMEPAGE="https://github.com/boto/botocore" +LICENSE="Apache-2.0" +SLOT="0" + +if [[ "${PV}" == "9999" ]]; then + EGIT_REPO_URI="https://github.com/boto/botocore" + inherit git-r3 +else + SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux" +fi + +RDEPEND=" + dev-python/six[${PYTHON_USEDEP}] + dev-python/jmespath[${PYTHON_USEDEP}] + dev-python/python-dateutil[${PYTHON_USEDEP}] + >=dev-python/urllib3-1.25.4[${PYTHON_USEDEP}] +" +BDEPEND=" + test? ( + dev-python/jsonschema[${PYTHON_USEDEP}] + ) +" + +PATCHES=( + "${FILESDIR}/1.8.6-tests-pass-all-env-vars-to-cmd-runner.patch" +) + +distutils_enable_sphinx docs/source \ + 'dev-python/guzzle_sphinx_theme' +distutils_enable_tests pytest + +src_prepare() { + # unpin deps + sed -i -e "s:>=.*':':" setup.py || die + + # unbundle deps + rm -r botocore/vendored || die + find -name '*.py' -exec sed -i \ + -e 's:from botocore[.]vendored import:import:' \ + -e 's:from botocore[.]vendored[.]:from :' \ + {} + || die + + distutils-r1_src_prepare +} + +python_test() { + local EPYTEST_DESELECT=( + # rely on bundled six + tests/functional/test_six_imports.py::test_no_bare_six_imports + tests/functional/test_six_threading.py::test_six_thread_safety + ) + + epytest tests/{functional,unit} +} diff --git a/dev-python/django-timezone-field/Manifest b/dev-python/django-timezone-field/Manifest index 9f4d4cd4679b..46086f68710a 100644 --- a/dev-python/django-timezone-field/Manifest +++ b/dev-python/django-timezone-field/Manifest @@ -1,2 +1,3 @@ DIST django-timezone-field-4.2.1.gh.tar.gz 23457 BLAKE2B 72452a21e6e086363da2ef40389d12b79860f66706e54fb9050ffe48f7fa6ad2908c75d4c7e17a79df339eac76492599dd4533ddca69a5b8757b46a36ed4b0fc SHA512 4c2da420c3aaffa23d8cdb66dbbe4b2ea8638de5a45d9e381bf9af980e52eba77fc03a2b8fee8497662199cdc9436d56543c0f6316e74ae5da68187a305c34a2 DIST django-timezone-field-4.2.3.gh.tar.gz 23605 BLAKE2B d183fb57254a6a1c86ca57558b88d5429d1d4d368c2cbf2f7a7f4d5414432fd80c5ae1df30793da185d5347afe8535dd821e7e605fb0693f26619b319894a6a3 SHA512 1a72ee557b5b527d2aeae9033c765272ebdd017d9e05708734e9bcdf6355e2747e1ce920a542dbead2d8fc6043024ece24adb3b27ccd6d0f2c8e5b3eb907e012 +DIST django-timezone-field-5.0.gh.tar.gz 33265 BLAKE2B 1d6c12ff6854463070dd6a5019cc2bfaf9514e5f6568057c684c7b061d28cc99416bac2796474fd2d884cd382e2c0e0a77883c35d4f7a7d2bb77a79255379268 SHA512 6fba9333463f1d68c0d5c6c85ad32b0106fa66be38c4e07e802222f25a0d0e024a77f36b17cb2644e89b76ea50ed667a324a9583b7b5dc0be7518ffa593335f8 diff --git a/dev-python/django-timezone-field/django-timezone-field-5.0.ebuild b/dev-python/django-timezone-field/django-timezone-field-5.0.ebuild new file mode 100644 index 000000000000..10674e933208 --- /dev/null +++ b/dev-python/django-timezone-field/django-timezone-field-5.0.ebuild @@ -0,0 +1,41 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=poetry +PYTHON_COMPAT=( python3_{8..10} ) + +inherit distutils-r1 + +DESCRIPTION="A Django app providing database and form fields for pytz timezone objects" +HOMEPAGE="https://github.com/mfogel/django-timezone-field" +SRC_URI=" + https://github.com/mfogel/django-timezone-field/archive/${PV}.tar.gz + -> ${P}.gh.tar.gz" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64" + +RDEPEND=" + >=dev-python/django-2.2[${PYTHON_USEDEP}] + dev-python/pytz[${PYTHON_USEDEP}] + $(python_gen_cond_dep ' + dev-python/backports-zoneinfo[${PYTHON_USEDEP}] + ' 3.8) +" +BDEPEND=" + test? ( + dev-python/djangorestframework[${PYTHON_USEDEP}] + dev-python/pytest-django[${PYTHON_USEDEP}] + dev-python/pytest-lazy-fixture[${PYTHON_USEDEP}] + ) +" + +distutils_enable_tests pytest + +python_test() { + local -x DB_ENGINE=sqlite + epytest +} diff --git a/dev-python/isort/isort-5.10.1-r1.ebuild b/dev-python/isort/isort-5.10.1-r1.ebuild new file mode 100644 index 000000000000..11d6b04236b8 --- /dev/null +++ b/dev-python/isort/isort-5.10.1-r1.ebuild @@ -0,0 +1,65 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=poetry +PYTHON_COMPAT=( python3_{8..10} ) + +inherit distutils-r1 + +DESCRIPTION="A python utility/library to sort imports" +HOMEPAGE="https://pypi.org/project/isort/" +SRC_URI=" + https://github.com/PyCQA/isort/archive/${PV}.tar.gz + -> ${P}.gh.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + +RDEPEND=" + dev-python/toml[${PYTHON_USEDEP}]" +BDEPEND=" + test? ( + dev-python/black[${PYTHON_USEDEP}] + dev-python/colorama[${PYTHON_USEDEP}] + dev-python/hypothesis[${PYTHON_USEDEP}] + dev-python/natsort[${PYTHON_USEDEP}] + dev-python/pylama[${PYTHON_USEDEP}] + dev-python/pytest-mock[${PYTHON_USEDEP}] + dev-vcs/git + ) +" + +distutils_enable_tests pytest + +src_prepare() { + # unbundle toml + sed -i -e 's:from ._vendored ::' isort/settings.py || die + rm -r isort/_vendored || die + # remove upper bounds from example plugin deps + # (already removed upstream) + sed -i -e 's:\^:>=:' example*/pyproject.toml || die + + distutils-r1_src_prepare +} + +python_test() { + cp -a "${BUILD_DIR}"/{install,test} || die + local -x PATH=${BUILD_DIR}/test/usr/bin:${PATH} + + # Install necessary plugins + local p + for p in example*/; do + pushd "${p}" >/dev/null || die + distutils_pep517_install "${BUILD_DIR}"/test + popd >/dev/null || die + done + + local EPYTEST_IGNORE=( + # Excluded from upstream's test script + tests/unit/test_deprecated_finders.py + ) + epytest tests/unit +} diff --git a/dev-python/pdm-pep517/Manifest b/dev-python/pdm-pep517/Manifest index e7b8b7d79369..964e7d4e69c5 100644 --- a/dev-python/pdm-pep517/Manifest +++ b/dev-python/pdm-pep517/Manifest @@ -1,3 +1,4 @@ DIST pdm-pep517-0.10.0.gh.tar.gz 189457 BLAKE2B 5a51b62dbc828aec5bca6ada8c7ecb479dd7491f22251392198a3d8e183f2d3d86fd4264addd9a428c37a24041365f3eeecec0a33c3f1a39ea8a1a8e6827be91 SHA512 7eb76bdf3db99ec1cf76a467617ce15423eaa465800efa9ccb248efb3c3cb5644b8e6a9ce04d6181dc9f3b5287a167f62f25d5e3334929f3e947a62ca9633d01 DIST pdm-pep517-0.10.1.gh.tar.gz 189525 BLAKE2B 10d80fee2ac45fd68c61baf9a8ee7365da19a5daa085fdecd3164b3271cf0c0ee8ad110b1f96a33a4eecdceace72c2d4ee1ce789331c208eb4a67e3b4e3fe56a SHA512 acdf36eeb2baf90c1c80b676901ac06946fbb32f2a5c2bfbdfd85d0889ae22a0851dede4f5898d109d20583504b311cbec6903deadfb77e3f1dd7ff6a1098e04 DIST pdm-pep517-0.10.2.gh.tar.gz 189817 BLAKE2B 47e773ac38197d898c50821d272c155d6749952bcce1492416291c02fa370965ca438e68268a56b8366b18f8a786883c9101e4dc325c9d4741f6cc509862d823 SHA512 6cdbd2cd96a784317356f4c5c52697279b720de03e7059c287872725baa10333b2f352e9a1c5ace727907bd6179cd879fcb4f6770eae1dd23294bf1b60cc233b +DIST pdm-pep517-0.11.0.gh.tar.gz 211783 BLAKE2B 10a112a29ce8cef047d5dea79169fbc590a953e201da5fb3cde631dfc0b0a4ebdbe6e82e28971773db4b913d6b6ab468eb611564f59137beb3df4bd961decbc1 SHA512 71a12512660f85af2a50133f67cb0dc15a2d848d6500fe7dbc9e63ea0e7b916cb00a6c392abc8eb7383db81b1f46b53779a0befbeee4d6831d2586d65be1676c diff --git a/dev-python/pdm-pep517/pdm-pep517-0.11.0.ebuild b/dev-python/pdm-pep517/pdm-pep517-0.11.0.ebuild new file mode 100644 index 000000000000..deda6c869be7 --- /dev/null +++ b/dev-python/pdm-pep517/pdm-pep517-0.11.0.ebuild @@ -0,0 +1,56 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=standalone +PYTHON_COMPAT=( python3_{8..10} pypy3 ) +inherit distutils-r1 + +DESCRIPTION="A PEP 517 backend for PDM that supports PEP 621 metadata" +HOMEPAGE=" + https://pypi.org/project/pdm-pep517/ + https://github.com/pdm-project/pdm-pep517/ +" +SRC_URI=" + https://github.com/pdm-project/pdm-pep517/archive/${PV}.tar.gz + -> ${P}.gh.tar.gz +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +RDEPEND=" + >=dev-python/cerberus-1.3.4[${PYTHON_USEDEP}] + >=dev-python/packaging-21.0[${PYTHON_USEDEP}] + >=dev-python/tomli-2[${PYTHON_USEDEP}] + dev-python/tomli-w[${PYTHON_USEDEP}] +" +BDEPEND=" + ${RDEPEND} + test? ( + dev-vcs/git + ) +" +# setuptools are used to build C extensions +RDEPEND+=" + dev-python/setuptools[${PYTHON_USEDEP}] +" + +distutils_enable_tests pytest + +src_prepare() { + rm -r pdm/pep517/_vendor || die + find -name '*.py' -exec sed \ + -e 's:from pdm\.pep517\._vendor\.:from :' \ + -e 's:from pdm\.pep517\._vendor ::' \ + -i {} + || die + distutils-r1_src_prepare +} + +src_test() { + git config --global user.email "test@example.com" || die + git config --global user.name "Test User" || die + distutils-r1_src_test +} diff --git a/dev-python/rich/Manifest b/dev-python/rich/Manifest index 440f6f1d5a12..145720093c8a 100644 --- a/dev-python/rich/Manifest +++ b/dev-python/rich/Manifest @@ -1,3 +1,4 @@ DIST rich-10.16.2.tar.gz 16282443 BLAKE2B ccc7292e265770880539d6a1a6b2e819b45e2e3d4d152f1a16c56f2da74c9a472ae49ea0a4a677ad71c4dd087fade2c415484073b4b2cd86869ad7c43c32b162 SHA512 9cb8b0c8105589db22d7efdc47cbfa20531cd184f07855db4bfafb667299c7d3e520b19e3b33e7818affb7a5674805849ee9f2e770927e285ccd7f4f838982c3 DIST rich-11.0.0.tar.gz 16293684 BLAKE2B bd38f84a7e0623dc9474bdc369b452fc668cd4756f00f6dd1b185f95dffb3d55f6b95a7f6dfaed5ee1ec5f2d9514af6080835b9ffd010f150005b15afb761d97 SHA512 bf8218ff43a101c4624baff1ecc316eb95912d0b634c41293b44de135ea4c6ead0fa2c6a96ab1403ce4dd80961915dbe7753415a74c7d41fc1f2d227113e9ff3 DIST rich-11.1.0.gh.tar.gz 16295117 BLAKE2B 1d326edea18b1eaad633665c2e50aa789f9eba19ee9b4cb50b94a160a69d12604fdf87d57ffbc903835b6e1e745fe17e0c521801b515ae73c8a44bf9ef17b6c2 SHA512 9da2015a66e0924bdd04deebd8fe8e963151d0a912f78320f8de8e61d656a693595c4feb0ce2436610602308d690ed96c8d10b5c81a9fc12a350b2e40907dbcb +DIST rich-11.2.0.gh.tar.gz 16300346 BLAKE2B 520f512a7e26613a4cc881834f8c150963b84a6dc3a43029dde6d64d1e405d82422b9c6f0098293b6f9bdb55749c7929426dad14840c9a287889c1a6a70f6bf2 SHA512 ec1178a6a320a48f589ead5163e974725f79ae63ddf9a2deb66400e43619ade8d366dbef6b524e66e603647a957b8e26266845a0bcb85912fd9ad2a81dd92f5e diff --git a/dev-python/rich/files/rich-11.1.0-pypy3.patch b/dev-python/rich/files/rich-11.1.0-pypy3.patch index 09a7f8022e26..e1ff1f3496d0 100644 --- a/dev-python/rich/files/rich-11.1.0-pypy3.patch +++ b/dev-python/rich/files/rich-11.1.0-pypy3.patch @@ -11,30 +11,6 @@ to fix test failure on PyPy3. tests/test_syntax.py | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) -diff --git a/CHANGELOG.md b/CHANGELOG.md -index 4997ae3..17f3028 100644 ---- a/CHANGELOG.md -+++ b/CHANGELOG.md -@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - - - Add support for US spelling of "gray" in ANSI color names https://github.com/Textualize/rich/issues/1890 - -+### Fixed -+ -+- Fixed `test_syntax.py::test_from_path_lexer_override` test failure on PyPy3 https://github.com/Textualize/rich/pull/1904 -+ - ## [11.1.0] - 2022-01-28 - - ### Added -diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md -index c29cd79..06e0618 100644 ---- a/CONTRIBUTORS.md -+++ b/CONTRIBUTORS.md -@@ -27,3 +27,4 @@ The following people have contributed to the development of Rich: - - [Nicolas Simonds](https://github.com/0xDEC0DE) - - [Gabriele N. Tornetta](https://github.com/p403n1x87) - - [Patrick Arminio](https://github.com/patrick91) -+- [Michał Górny](https://github.com/mgorny) diff --git a/tests/test_syntax.py b/tests/test_syntax.py index 46d0126..e5d904f 100644 --- a/tests/test_syntax.py @@ -63,19 +39,6 @@ to be skipped appropriately. tests/test_inspect.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) -diff --git a/CHANGELOG.md b/CHANGELOG.md -index 17f3028..1a75bf3 100644 ---- a/CHANGELOG.md -+++ b/CHANGELOG.md -@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - - ### Fixed - --- Fixed `test_syntax.py::test_from_path_lexer_override` test failure on PyPy3 https://github.com/Textualize/rich/pull/1904 -+- Fixed test failures on PyPy3 https://github.com/Textualize/rich/pull/1904 - - ## [11.1.0] - 2022-01-28 - diff --git a/tests/test_inspect.py b/tests/test_inspect.py index 63c5f06..b4c1d2a 100644 --- a/tests/test_inspect.py diff --git a/dev-python/rich/rich-11.2.0.ebuild b/dev-python/rich/rich-11.2.0.ebuild new file mode 100644 index 000000000000..96cdf74b9e78 --- /dev/null +++ b/dev-python/rich/rich-11.2.0.ebuild @@ -0,0 +1,45 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=poetry +PYTHON_COMPAT=( python3_{8..10} pypy3 ) + +inherit distutils-r1 optfeature + +DESCRIPTION="Python library for renrering rich text, tables, etc. to the terminal" +HOMEPAGE="https://github.com/Textualize/rich" +SRC_URI=" + https://github.com/Textualize/${PN}/archive/v${PV}.tar.gz + -> ${P}.gh.tar.gz +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86" + +RDEPEND=" + dev-python/colorama[${PYTHON_USEDEP}] + dev-python/commonmark[${PYTHON_USEDEP}] + dev-python/pygments[${PYTHON_USEDEP}]" + +distutils_enable_tests pytest + +PATCHES=( + "${FILESDIR}"/rich-11.1.0-pypy3.patch +) + +python_test() { + local EPYTEST_DESELECT=( + # check for exact color render string, which changes across pygments bumps + tests/test_syntax.py::test_python_render + tests/test_syntax.py::test_python_render_simple + tests/test_syntax.py::test_python_render_indent_guides + ) + epytest -p no:pytest-qt +} + +pkg_postinst() { + optfeature "integration with HTML widgets for Jupyter" dev-python/ipywidgets +} diff --git a/dev-python/setuptools_scm/Manifest b/dev-python/setuptools_scm/Manifest index 18af30b61a9c..09ab5823ab27 100644 --- a/dev-python/setuptools_scm/Manifest +++ b/dev-python/setuptools_scm/Manifest @@ -1,4 +1,2 @@ -DIST setuptools_scm-6.0.1.tar.gz 51433 BLAKE2B 7045eec0c1a43d6c93c94e0b2799f0d000cda509fa0df9ee9a638b95383f07fe430b07c3bf72fdc4809563ac289521976956f728a4b2984921fa31532bb7ed8b SHA512 db27653c57f674ec62689247680adace3779216249f1b09a35e8a0233a1ec1acb9ae89b52acd439f7062da2ba1a45b8c0d6d81333ddda0764447c30698ddb314 DIST setuptools_scm-6.3.2.tar.gz 57207 BLAKE2B 4291f3810dc5ea111a6bad1bf37c8704a7eb6cdd112ea476d629d6175c43cc7d8f78d450181c0e588a5f3fc0fc092fedb41fcb6e198a42f730f9fc6b8d96e343 SHA512 9a16552803ef92367ad71007cf322737b5baa58b924083f04c860875bf6cb2e2bb4f43a7f89778b040c2eb55c5d32de479a918056519339820c6d0f1a6a386f0 -DIST setuptools_scm-6.4.0.tar.gz 61142 BLAKE2B 752f6c541b05e5d63c66c20a3458e615fc774a4781f92a02aae37a64d971af536586cec3fabac8d5efebe3cf95c18c3e323ad650b4bd8c96a2b4a7808987bd7e SHA512 1e11de29f73c48b93fe5c81b7d8ed5c75c0647dad39de53f2fdf334e6c731a8baa7744ea3c797d2aa95c4d456fff2c9a937cccf9eaa1af8a4c47e1f136328b54 DIST setuptools_scm-6.4.1.tar.gz 61255 BLAKE2B 984b60de24e3090bfa7284ef91f40cfb8481cd9008d57012564e6631727dc1e1bb6820265a4fd3576581ce836224599bdd8ddef73446ddc3040e51ddad4b6140 SHA512 b4d16fc9f352d7fccf18853aee2e80c2bd048fe46753fe5c099542253cf30e0d087be6dfec846aed0b8182238494ef333363482dcd75781e285312a9f7547c11 diff --git a/dev-python/setuptools_scm/setuptools_scm-6.0.1-r1.ebuild b/dev-python/setuptools_scm/setuptools_scm-6.0.1-r1.ebuild deleted file mode 100644 index c333450a2173..000000000000 --- a/dev-python/setuptools_scm/setuptools_scm-6.0.1-r1.ebuild +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# please keep this ebuild at EAPI 7 -- sys-apps/portage dep -EAPI=7 - -DISTUTILS_USE_SETUPTOOLS=rdepend -PYTHON_COMPAT=( python3_{7..10} pypy3 ) - -inherit distutils-r1 - -DESCRIPTION="Manage versions by scm tags via setuptools" -HOMEPAGE=" - https://github.com/pypa/setuptools_scm/ - https://pypi.org/project/setuptools-scm/" -SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" - -LICENSE="MIT" -SLOT="0" -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="dev-python/toml[${PYTHON_USEDEP}]" -BDEPEND=" - !!<dev-python/setuptools_scm-2 - test? ( - dev-vcs/git - !sparc? ( dev-vcs/mercurial ) )" - -distutils_enable_tests --install pytest - -python_prepare_all() { - # network access - sed -i -e 's:test_pip_download:_&:' testing/test_regressions.py || die - # all fetch specific setuptools versions - rm testing/test_setuptools_support.py || die - - distutils-r1_python_prepare_all -} diff --git a/dev-python/setuptools_scm/setuptools_scm-6.4.0.ebuild b/dev-python/setuptools_scm/setuptools_scm-6.4.0.ebuild deleted file mode 100644 index 12fb994eaec5..000000000000 --- a/dev-python/setuptools_scm/setuptools_scm-6.4.0.ebuild +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -# please keep this ebuild at EAPI 7 -- sys-apps/portage dep -EAPI=7 - -DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{8..10} pypy3 ) - -inherit distutils-r1 - -DESCRIPTION="Manage versions by scm tags via setuptools" -HOMEPAGE=" - https://github.com/pypa/setuptools_scm/ - https://pypi.org/project/setuptools-scm/" -SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" - -LICENSE="MIT" -SLOT="0" -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=" - dev-python/packaging[${PYTHON_USEDEP}] - dev-python/setuptools[${PYTHON_USEDEP}] - dev-python/tomli[${PYTHON_USEDEP}] -" -BDEPEND=" - !!<dev-python/setuptools_scm-2 - test? ( - >dev-python/virtualenv-20[${PYTHON_USEDEP}] - dev-vcs/git - !sparc? ( dev-vcs/mercurial ) - )" - -distutils_enable_tests pytest - -EPYTEST_DESELECT=( - # fetching from the Internet - testing/test_regressions.py::test_pip_download - testing/test_setuptools_support.py - # known broken; https://github.com/pypa/setuptools_scm/issues/668 - testing/test_integration.py::test_provides_toml_exta -) diff --git a/dev-python/statsmodels/statsmodels-0.13.2.ebuild b/dev-python/statsmodels/statsmodels-0.13.2.ebuild index 295ea833d346..d017496f5c26 100644 --- a/dev-python/statsmodels/statsmodels-0.13.2.ebuild +++ b/dev-python/statsmodels/statsmodels-0.13.2.ebuild @@ -68,6 +68,7 @@ python_test() { import statsmodels statsmodels.test(extra_args=['-vv', '-n', '${jobs}'], exit=True)" \ || die "tests fail with ${EPYTHON}" + rm -rf statsmodels/.pytest_cache || die popd >/dev/null || die } diff --git a/dev-python/treq/Manifest b/dev-python/treq/Manifest index fb7fdf5fda1a..507bec574157 100644 --- a/dev-python/treq/Manifest +++ b/dev-python/treq/Manifest @@ -1 +1,2 @@ DIST treq-22.1.0.tar.gz 72634 BLAKE2B e59271bbd53124fa6c01cb9fba03d83ba8cdfc1b2be065c649e26dbcd0202473b59fc1762ce02d5d016d1ac5a6a848568b248c316d7ecde8e3f3521cb213d532 SHA512 6c9a49bc4c9e73365275bf841a5a31873c092e33c4978571caae3601d02e9b8d161dcf684c40ccd297d8a8c4dafe62eddb7872a86513598260fe38c98c7c44f5 +DIST treq-22.2.0.tar.gz 72922 BLAKE2B ab4637c801e5e777f81f6e6a6e12e36ef47e052a4103eb70bf4e10d3fb44b60f144f32734625b4babb375acc96e3cad1895634d3d2fc08ac3095769180e65328 SHA512 465a02481a51ac246ac85f561f2e7a59d97aeeda9f0953dd83678ff836802a187a6aedcce830a9e3095a9c72227bd06113610c3be0967f1362a645a31278bde0 diff --git a/dev-python/treq/treq-22.2.0.ebuild b/dev-python/treq/treq-22.2.0.ebuild new file mode 100644 index 000000000000..e5e1a9824053 --- /dev/null +++ b/dev-python/treq/treq-22.2.0.ebuild @@ -0,0 +1,43 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_COMPAT=( python3_{8..10} ) + +inherit distutils-r1 + +DESCRIPTION="A requests-like API built on top of twisted.web's Agent" +HOMEPAGE="https://github.com/twisted/treq https://pypi.org/project/treq/" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86" +IUSE="doc test" +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-python/attrs[${PYTHON_USEDEP}] + >=dev-python/hyperlink-21.0.0[${PYTHON_USEDEP}] + dev-python/incremental[${PYTHON_USEDEP}] + >=dev-python/requests-2.1.0[${PYTHON_USEDEP}] + >=dev-python/twisted-18.7.0[crypt,${PYTHON_USEDEP}] +" +BDEPEND=" + test? ( + dev-python/httpbin[${PYTHON_USEDEP}] + )" + +distutils_enable_sphinx docs + +src_prepare() { + # fix relative path for docs generation + sed -e "s@('..')@('../src')@" -i docs/conf.py || die + distutils-r1_src_prepare +} + +python_test() { + "${EPYTHON}" -m twisted.trial treq || die "Tests failed with ${EPYTHON}" +} diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 2b5acb09d926..cdd57149720d 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -176,7 +176,7 @@ _distutils_set_globals() { # tomli is used to read build-backend from pyproject.toml bdep=' >=dev-python/installer-0.4.0_p20220124[${PYTHON_USEDEP}] - dev-python/tomli[${PYTHON_USEDEP}]' + >=dev-python/tomli-1.2.3[${PYTHON_USEDEP}]' case ${DISTUTILS_USE_PEP517} in flit) bdep+=' @@ -333,11 +333,8 @@ unset -f _distutils_set_globals # (allowing any implementation). If multiple values are specified, # implementations matching any of the patterns will be accepted. # -# The patterns can be either fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate -# appropriately all enabled Python 2/3 implementations (alike -# python_is_python3). Remember to escape or quote the fnmatch patterns -# to prevent accidental shell filename expansion. +# For the pattern syntax, please see _python_impl_matches +# in python-utils-r1.eclass. # # If the restriction needs to apply conditionally to a USE flag, # the variable should be set conditionally as well (e.g. in an early @@ -426,9 +423,13 @@ distutils_enable_sphinx() { python_check_deps() { use doc || return 0 + + local hasv_args=( -b ) + [[ ${EAPI} == 6 ]] && hasv_args=( --host-root ) local p for p in dev-python/sphinx "${_DISTUTILS_SPHINX_PLUGINS[@]}"; do - has_version "${p}[${PYTHON_USEDEP}]" || return 1 + has_version "${hasv_args[@]}" "${p}[${PYTHON_USEDEP}]" || + return 1 done } else @@ -922,6 +923,127 @@ _distutils-r1_backend_to_key() { esac } +# @FUNCTION: _distutils-r1_get_backend +# @INTERNAL +# @DESCRIPTION: +# Read (or guess, in case of setuptools) the build-backend +# for the package in the current directory. +_distutils-r1_get_backend() { + debug-print-function ${FUNCNAME} "${@}" + + local build_backend + if [[ -f pyproject.toml ]]; then + # if pyproject.toml exists, try getting the backend from it + # NB: this could fail if pyproject.toml doesn't list one + build_backend=$( + "${EPYTHON}" - <<-EOF 2>/dev/null + import tomli + print(tomli.load(open("pyproject.toml", "rb")) + ["build-system"]["build-backend"]) + EOF + ) + fi + if [[ -z ${build_backend} && ${DISTUTILS_USE_PEP517} == setuptools && + -f setup.py ]] + then + # use the legacy setuptools backend as a fallback + build_backend=setuptools.build_meta:__legacy__ + fi + if [[ -z ${build_backend} ]]; then + die "Unable to obtain build-backend from pyproject.toml" + fi + + if [[ ${DISTUTILS_USE_PEP517} != standalone ]]; then + # verify whether DISTUTILS_USE_PEP517 was set correctly + local expected_value=$(_distutils-r1_backend_to_key "${build_backend}") + if [[ ${DISTUTILS_USE_PEP517} != ${expected_value} ]]; then + eerror "DISTUTILS_USE_PEP517 does not match pyproject.toml!" + eerror " have: DISTUTILS_USE_PEP517=${DISTUTILS_USE_PEP517}" + eerror "expected: DISTUTILS_USE_PEP517=${expected_value}" + eerror "(backend: ${build_backend})" + die "DISTUTILS_USE_PEP517 value incorrect" + fi + + # fix deprecated backends up + local new_backend= + case ${build_backend} in + flit.buildapi) + new_backend=flit_core.buildapi + ;; + poetry.masonry.api) + new_backend=poetry.core.masonry.api + ;; + esac + + if [[ -n ${new_backend} ]]; then + if [[ ! -f ${T}/.distutils_deprecated_backend_warned ]]; then + eqawarn "${build_backend} backend is deprecated. Please see:" + eqawarn "https://projects.gentoo.org/python/guide/distutils.html#deprecated-pep-517-backends" + eqawarn "The eclass will be using ${new_backend} instead." + > "${T}"/.distutils_deprecated_backend_warned || die + fi + build_backend=${new_backend} + fi + fi + + echo "${build_backend}" +} + +# @FUNCTION: distutils_pep517_install +# @USAGE: [<root>] +# @DESCRIPTION: +# Build the wheel for the package in the current directory using PEP 517 +# backend and install it into <root>. If <root> is not specified, +# ${BUILD_DIR}/install is used. +# +# This function is intended for expert use only. It does not handle +# wrapping executables. +distutils_pep517_install() { + debug-print-function ${FUNCNAME} "${@}" + + local root=${1:-${BUILD_DIR}/install} + local -x WHEEL_BUILD_DIR=${BUILD_DIR}/wheel + mkdir -p "${WHEEL_BUILD_DIR}" || die + + local build_backend=$(_distutils-r1_get_backend) + einfo " Building the wheel for ${PWD#${WORKDIR}/} via ${build_backend}" + local wheel=$( + "${EPYTHON}" - 3>&1 >&2 <<-EOF || die "Wheel build failed" + import ${build_backend%:*} + import os + print(${build_backend/:/.}.build_wheel(os.environ['WHEEL_BUILD_DIR']), + file=os.fdopen(3, 'w')) + EOF + ) + [[ -n ${wheel} ]] || die "No wheel name returned" + + einfo " Installing the wheel to ${root}" + # NB: --compile-bytecode does not produce the correct paths, + # and python_optimize doesn't handle being called outside D, + # so we just defer compiling until the final merge + # NB: we override sys.prefix & sys.exec_prefix because otherwise + # installer would use virtualenv's prefix + local -x PYTHON_PREFIX=${EPREFIX}/usr + "${EPYTHON}" - -d "${root}" "${WHEEL_BUILD_DIR}/${wheel}" --no-compile-bytecode \ + <<-EOF || die "installer failed" + import os, sys + sys.prefix = sys.exec_prefix = os.environ["PYTHON_PREFIX"] + from installer.__main__ import main + main(sys.argv[1:]) + EOF + + # remove installed licenses + find "${root}$(python_get_sitedir)" \ + '(' -path '*.dist-info/COPYING*' -o \ + -path '*.dist-info/LICENSE*' ')' -delete || die + + # clean the build tree; otherwise we may end up with PyPy3 + # extensions duplicated into CPython dists + if [[ ${DISTUTILS_USE_PEP517:-setuptools} == setuptools ]]; then + esetup.py clean -a + fi +} + # @FUNCTION: distutils-r1_python_compile # @USAGE: [additional-args...] # @DESCRIPTION: @@ -965,86 +1087,8 @@ distutils-r1_python_compile() { addpredict /usr/lib/portage/pym addpredict /usr/local # bug 498232 - local -x WHEEL_BUILD_DIR=${BUILD_DIR}/wheel - mkdir -p "${WHEEL_BUILD_DIR}" || die - - local build_backend - if [[ -f pyproject.toml ]]; then - build_backend=$("${EPYTHON}" -c 'import tomli; \ - print(tomli.load(open("pyproject.toml", "rb")) \ - ["build-system"]["build-backend"])' 2>/dev/null) - fi - if [[ -z ${build_backend} && ${DISTUTILS_USE_PEP517} == setuptools && - -f setup.py ]] - then - # use the legacy setuptools backend - build_backend=setuptools.build_meta:__legacy__ - fi - [[ -z ${build_backend} ]] && - die "Unable to obtain build-backend from pyproject.toml" - - if [[ ${DISTUTILS_USE_PEP517} != standalone ]]; then - local expected_value=$(_distutils-r1_backend_to_key "${build_backend}") - if [[ ${DISTUTILS_USE_PEP517} != ${expected_value} ]]; then - eerror "DISTUTILS_USE_PEP517 does not match pyproject.toml!" - eerror " have: DISTUTILS_USE_PEP517=${DISTUTILS_USE_PEP517}" - eerror "expected: DISTUTILS_USE_PEP517=${expected_value}" - eerror "(backend: ${build_backend})" - die "DISTUTILS_USE_PEP517 value incorrect" - fi - - # fix deprecated backends up - local new_backend= - case ${build_backend} in - flit.buildapi) - new_backend=flit_core.buildapi - ;; - poetry.masonry.api) - new_backend=poetry.core.masonry.api - ;; - esac - - if [[ -n ${new_backend} ]]; then - if [[ ! ${_DISTUTILS_DEPRECATED_BACKEND_WARNED} ]]; then - eqawarn "${build_backend} backend is deprecated. Please see:" - eqawarn "https://projects.gentoo.org/python/guide/distutils.html#deprecated-pep-517-backends" - eqawarn "The eclass will be using ${new_backend} instead." - _DISTUTILS_DEPRECATED_BACKEND_WARNED=1 - fi - build_backend=${new_backend} - fi - fi - - einfo " Building the wheel via ${build_backend}" - "${EPYTHON}" -c "import ${build_backend%:*}; \ - import os; \ - ${build_backend/:/.}.build_wheel(os.environ['WHEEL_BUILD_DIR'])" || - die "Wheel build failed" - - local wheel=( "${WHEEL_BUILD_DIR}"/*.whl ) - if [[ ${#wheel[@]} -ne 1 ]]; then - die "Incorrect number of wheels created (${#wheel[@]}): ${wheel[*]}" - fi - local root=${BUILD_DIR}/install - einfo " Installing the wheel to ${root}" - # NB: --compile-bytecode does not produce the correct paths, - # and python_optimize doesn't handle being called outside D, - # so we just defer compiling until the final merge - "${EPYTHON}" -m installer -d "${root}" "${wheel}" \ - --no-compile-bytecode || - die "installer failed" - - # remove installed licenses - find "${root}$(python_get_sitedir)" \ - '(' -path '*.dist-info/COPYING*' -o \ - -path '*.dist-info/LICENSE*' ')' -delete || die - - # clean the build tree; otherwise we may end up with PyPy3 - # extensions duplicated into CPython dists - if [[ ${DISTUTILS_USE_PEP517:-setuptools} == setuptools ]]; then - esetup.py clean -a - fi + distutils_pep517_install "${root}" # copy executables to python-exec directory # we do it early so that we can alter bindir recklessly diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass index 282c449f2a03..4e954f57cd2d 100644 --- a/eclass/python-any-r1.eclass +++ b/eclass/python-any-r1.eclass @@ -271,44 +271,6 @@ python_gen_any_dep() { echo "|| ( ${out})" } -# @FUNCTION: _python_EPYTHON_supported -# @USAGE: <epython> -# @INTERNAL -# @DESCRIPTION: -# Check whether the specified implementation is supported by package -# (specified in PYTHON_COMPAT). Calls python_check_deps() if declared. -_python_EPYTHON_supported() { - debug-print-function ${FUNCNAME} "${@}" - - local EPYTHON=${1} - local i=${EPYTHON/./_} - - case "${i}" in - python*|jython*|pypy*) - ;; - *) - ewarn "Invalid EPYTHON: ${EPYTHON}" - return 1 - ;; - esac - - if has "${i}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then - if python_is_installed "${i}"; then - if declare -f python_check_deps >/dev/null; then - local PYTHON_USEDEP="python_targets_${i}(-)" - local PYTHON_SINGLE_USEDEP="python_single_target_${i}(-)" - python_check_deps - return ${?} - fi - - return 0 - fi - elif ! has "${i}" "${_PYTHON_ALL_IMPLS[@]}"; then - ewarn "Invalid EPYTHON: ${EPYTHON}" - fi - return 1 -} - # @FUNCTION: python_setup # @DESCRIPTION: # Determine what the best installed (and supported) Python @@ -332,27 +294,35 @@ python_setup() { _python_export "${impls[0]}" EPYTHON PYTHON _python_wrapper_setup - einfo "Using ${EPYTHON} to build" + einfo "Using ${EPYTHON} to build (via PYTHON_COMPAT_OVERRIDE)" return fi # first, try ${EPYTHON}... maybe it's good enough for us. - if [[ ${EPYTHON} ]]; then - if _python_EPYTHON_supported "${EPYTHON}"; then + local epython_impl=${EPYTHON/./_} + if [[ ${epython_impl} ]]; then + if ! has "${epython_impl}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then + einfo "EPYTHON (${EPYTHON}) not supported by the package" + elif ! has "${epython_impl}" "${_PYTHON_ALL_IMPLS[@]}"; then + ewarn "Invalid EPYTHON: ${EPYTHON}" + elif _python_run_check_deps "${epython_impl}"; then _python_export EPYTHON PYTHON _python_wrapper_setup - einfo "Using ${EPYTHON} to build" + einfo "Using ${EPYTHON} to build (via EPYTHON)" return fi fi - # fallback to best installed impl. + # fallback to the best installed impl. # (reverse iteration over _PYTHON_SUPPORTED_IMPLS) for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do - _python_export "${_PYTHON_SUPPORTED_IMPLS[i]}" EPYTHON PYTHON - if _python_EPYTHON_supported "${EPYTHON}"; then + local impl=${_PYTHON_SUPPORTED_IMPLS[i]} + # avoid checking EPYTHON twice + [[ ${impl} == ${epython_impl} ]] && continue + _python_export "${impl}" EPYTHON PYTHON + if _python_run_check_deps "${impl}"; then _python_wrapper_setup - einfo "Using ${EPYTHON} to build" + einfo "Using ${EPYTHON} to build (via PYTHON_COMPAT iteration)" return fi done diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass index 40ad4ef4bbf8..bf2fd62fdcba 100644 --- a/eclass/python-r1.eclass +++ b/eclass/python-r1.eclass @@ -289,13 +289,7 @@ _python_validate_useflags() { # are both in PYTHON_COMPAT and match any of the patterns passed # as parameters to the function. # -# The patterns are fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values). Remember to escape -# or quote the fnmatch patterns to prevent accidental shell filename -# expansion. -# -# This is an internal function used to implement python_gen_cond_dep -# and deprecated python_gen_usedep. +# This is an internal function used to implement python_gen_cond_dep. _python_gen_usedep() { debug-print-function ${FUNCNAME} "${@}" @@ -316,46 +310,6 @@ _python_gen_usedep() { echo "${out// /,}" } -# @FUNCTION: python_gen_usedep -# @USAGE: <pattern> [...] -# @DESCRIPTION: -# DEPRECATED. Please use python_gen_cond_dep instead. -# -# Output a USE dependency string for Python implementations which -# are both in PYTHON_COMPAT and match any of the patterns passed -# as parameters to the function. -# -# The patterns are fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values). Remember to escape -# or quote the fnmatch patterns to prevent accidental shell filename -# expansion. -# -# When all implementations are requested, please use ${PYTHON_USEDEP} -# instead. Please also remember to set an appropriate REQUIRED_USE -# to avoid ineffective USE flags. -# -# Example: -# @CODE -# PYTHON_COMPAT=( python{2_7,3_4} ) -# BDEPEND="doc? ( dev-python/epydoc[$(python_gen_usedep 'python2*')] )" -# @CODE -# -# It will cause the dependency to look like: -# @CODE -# BDEPEND="doc? ( dev-python/epydoc[python_targets_python2_7?] )" -# @CODE -python_gen_usedep() { - debug-print-function ${FUNCNAME} "${@}" - - # output only once, during some reasonable phase - # (avoid spamming cache regen runs) - if [[ ${EBUILD_PHASE} == setup ]]; then - eqawarn "python_gen_usedep() is deprecated. Please use python_gen_cond_dep instead." - fi - [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}" - _python_gen_usedep "${@}" -} - # @FUNCTION: python_gen_useflags # @USAGE: [<pattern>...] # @DESCRIPTION: @@ -363,10 +317,8 @@ python_gen_usedep() { # are both in PYTHON_COMPAT and match any of the patterns passed # as parameters to the function. # -# The patterns are fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values). Remember to escape -# or quote the fnmatch patterns to prevent accidental shell filename -# expansion. +# For the pattern syntax, please see _python_impl_matches +# in python-utils-r1.eclass. # # Example: # @CODE @@ -400,10 +352,8 @@ python_gen_useflags() { # of Python implementations which are both in PYTHON_COMPAT and match # any of the patterns passed as the remaining parameters. # -# The patterns are fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values). Remember to escape -# or quote the fnmatch patterns to prevent accidental shell filename -# expansion. +# For the pattern syntax, please see _python_impl_matches +# in python-utils-r1.eclass. # # In order to enforce USE constraints on the packages, verbatim # '${PYTHON_USEDEP}' (quoted!) may be placed in the dependency @@ -434,9 +384,15 @@ python_gen_cond_dep() { _python_verify_patterns "${@}" for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do if _python_impl_matches "${impl}" "${@}"; then - # substitute ${PYTHON_USEDEP} if used - # (since python_gen_usedep() will not return ${PYTHON_USEDEP} - # the code is run at most once) + # substitute ${PYTHON_USEDEP} with USE-dep on *all* matching + # targets, if it is used. this ensures that Portage will + # report all missing USE flags simultaneously rather than + # requesting the user to enable them one by one. + # + # NB: the first call with replace all instances + # of ${PYTHON_USEDEP}, so the condition will be false + # on subsequent loop iterations and _python_gen_usedep() + # will run at most once. if [[ ${dep} == *'${PYTHON_USEDEP}'* ]]; then local usedep=$(_python_gen_usedep "${@}") dep=${dep//\$\{PYTHON_USEDEP\}/${usedep}} @@ -458,10 +414,8 @@ python_gen_cond_dep() { # patterns are passed, the output dependencies will be generated only # for the implementations matching them. # -# The patterns are fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values). Remember to escape -# or quote the fnmatch patterns to prevent accidental shell filename -# expansion. +# For the pattern syntax, please see _python_impl_matches +# in python-utils-r1.eclass. # # Use this function when you need to request different USE flags # on the Python interpreter depending on package's USE flags. If you @@ -514,10 +468,8 @@ python_gen_impl_dep() { # # Optionally, patterns may be specified to restrict the dependency to # a subset of Python implementations supported by the ebuild. -# The patterns are fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values). Remember to escape -# or quote the fnmatch patterns to prevent accidental shell filename -# expansion. +# For the pattern syntax, please see _python_impl_matches +# in python-utils-r1.eclass. # # This should be used along with an appropriate python_check_deps() # that checks which of the any-of blocks were matched, and python_setup @@ -704,10 +656,8 @@ python_foreach_impl() { # The python_check_deps() function in the any-of mode needs to be # accompanied by appropriate any-of dependencies. # -# The patterns are fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values). Remember to escape -# or quote the fnmatch patterns to prevent accidental shell filename -# expansion. +# For the pattern syntax, please see _python_impl_matches +# in python-utils-r1.eclass. # # This function needs to be used when Python is being called outside # of python_foreach_impl calls (e.g. for shared processes like doc @@ -781,12 +731,7 @@ python_setup() { # if python_check_deps() is declared, switch into any-of mode if [[ ${has_check_deps} ]]; then - # first check if the interpreter is installed - python_is_installed "${impl}" || continue - # then run python_check_deps - local PYTHON_USEDEP="python_targets_${impl}(-)" - local PYTHON_SINGLE_USEDEP="python_single_target_${impl}(-)" - python_check_deps || continue + _python_run_check_deps "${impl}" || continue fi found=1 diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass index 574ee9cfc04e..998e6faad841 100644 --- a/eclass/python-single-r1.eclass +++ b/eclass/python-single-r1.eclass @@ -259,40 +259,6 @@ unset -f _python_single_set_globals if [[ ! ${_PYTHON_SINGLE_R1} ]]; then -# @FUNCTION: _python_gen_usedep -# @USAGE: [<pattern>...] -# @INTERNAL -# @DESCRIPTION: -# Output a USE dependency string for Python implementations which -# are both in PYTHON_COMPAT and match any of the patterns passed -# as parameters to the function. -# -# The patterns are fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values). Remember to escape -# or quote the fnmatch patterns to prevent accidental shell filename -# expansion. -# -# This is an internal function used to implement python_gen_cond_dep. -_python_gen_usedep() { - debug-print-function ${FUNCNAME} "${@}" - - local impl matches=() - - _python_verify_patterns "${@}" - for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do - if _python_impl_matches "${impl}" "${@}"; then - matches+=( - "python_single_target_${impl}(-)?" - ) - fi - done - - [[ ${matches[@]} ]] || die "No supported implementations match python_gen_usedep patterns: ${@}" - - local out=${matches[@]} - echo "${out// /,}" -} - # @FUNCTION: python_gen_useflags # @USAGE: [<pattern>...] # @DESCRIPTION: @@ -300,10 +266,8 @@ _python_gen_usedep() { # are both in PYTHON_COMPAT and match any of the patterns passed # as parameters to the function. # -# The patterns are fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values). Remember to escape -# or quote the fnmatch patterns to prevent accidental shell filename -# expansion. +# For the pattern syntax, please see _python_impl_matches +# in python-utils-r1.eclass. # # Example: # @CODE @@ -337,10 +301,8 @@ python_gen_useflags() { # of Python implementations which are both in PYTHON_COMPAT and match # any of the patterns passed as the remaining parameters. # -# The patterns are fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values). Remember to escape -# or quote the fnmatch patterns to prevent accidental shell filename -# expansion. +# For the pattern syntax, please see _python_impl_matches +# in python-utils-r1.eclass. # # In order to enforce USE constraints on the packages, verbatim # '${PYTHON_SINGLE_USEDEP}' and '${PYTHON_USEDEP}' (quoted!) may @@ -372,22 +334,10 @@ python_gen_cond_dep() { _python_verify_patterns "${@}" for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do if _python_impl_matches "${impl}" "${@}"; then - # substitute ${PYTHON_SINGLE_USEDEP} if used - # (since python_gen_usedep() will not return - # ${PYTHON_SINGLE_USEDEP}, the code is run at most once) - if [[ ${dep} == *'${PYTHON_SINGLE_USEDEP}'* ]]; then - local usedep=$(_python_gen_usedep "${@}") - dep=${dep//\$\{PYTHON_SINGLE_USEDEP\}/${usedep}} - fi + local single_usedep="python_single_target_${impl}(-)" local multi_usedep="python_targets_${impl}(-)" - if [[ ${EAPI} != [67] ]]; then - if [[ ${dep} == *\$\{PYTHON_MULTI_USEDEP\}* ]]; then - die "Replace PYTHON_MULTI_USEDEP with PYTHON_USEDEP in EAPI ${EAPI}" - fi - fi - - local subdep=${dep//\$\{PYTHON_MULTI_USEDEP\}/${multi_usedep}} + local subdep=${dep//\$\{PYTHON_SINGLE_USEDEP\}/${single_usedep}} matches+=( "python_single_target_${impl}? ( ${subdep//\$\{PYTHON_USEDEP\}/${multi_usedep}} )" ) fi @@ -405,10 +355,8 @@ python_gen_cond_dep() { # patterns are passed, the output dependencies will be generated only # for the implementations matching them. # -# The patterns are fnmatch-style patterns (matched via bash -# == operator against PYTHON_COMPAT values). Remember to escape -# or quote the fnmatch patterns to prevent accidental shell filename -# expansion. +# For the pattern syntax, please see _python_impl_matches +# in python-utils-r1.eclass. # # Use this function when you need to request different USE flags # on the Python interpreter depending on package's USE flags. If you diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index c8367f8065f4..204392e08da4 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -82,7 +82,11 @@ _python_verify_patterns() { local impl pattern for pattern; do - [[ ${pattern} == -[23] ]] && continue + case ${pattern} in + -[23]|3.[89]|3.10) + continue + ;; + esac for impl in "${_PYTHON_ALL_IMPLS[@]}" "${_PYTHON_HISTORICAL_IMPLS[@]}" do @@ -119,6 +123,8 @@ _python_set_impls() { if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then die 'PYTHON_COMPAT must be an array.' fi + + local obsolete=() if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then for i in "${PYTHON_COMPAT[@]}"; do # check for incorrect implementations @@ -126,7 +132,10 @@ _python_set_impls() { # 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]|python3_10) + pypy3|python2_7|python3_[89]|python3_10) + ;; + jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7]) + obsolete+=( "${i}" ) ;; *) if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \ @@ -140,6 +149,17 @@ _python_set_impls() { done fi + if [[ -n ${obsolete[@]} && ${EBUILD_PHASE} == setup ]]; then + # complain if people don't clean up old impls while touching + # the ebuilds recently. use the copyright year to infer last + # modification + # NB: this check doesn't have to work reliably + if [[ $(head -n 1 "${EBUILD}" 2>/dev/null) == *2022* ]]; then + eqawarn "Please clean PYTHON_COMPAT of obsolete implementations:" + eqawarn " ${obsolete[*]}" + fi + fi + local supp=() unsupp=() for i in "${_PYTHON_ALL_IMPLS[@]}"; do @@ -190,12 +210,14 @@ _python_set_impls() { # Matches if no patterns are provided. # # <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns -# are fnmatch-style. +# can either be fnmatch-style or stdlib versions, e.g. "3.8", "3.9". +# In the latter case, pypy3 will match if there is at least one pypy3 +# version matching the stdlib version. _python_impl_matches() { [[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter" [[ ${#} -eq 1 ]] && return 0 - local impl=${1} pattern + local impl=${1/./_} pattern shift for pattern; do @@ -218,9 +240,17 @@ _python_impl_matches() { fi return 0 ;; + 3.8) + # the only unmasked pypy3 version is pypy3.8 atm + [[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] && + return 0 + ;; + 3.9|3.10) + [[ ${impl} == python${pattern/./_} ]] && return 0 + ;; *) # unify value style to allow lax matching - [[ ${impl/./_} == ${pattern/./_} ]] && return 0 + [[ ${impl} == ${pattern/./_} ]] && return 0 ;; esac done @@ -266,23 +296,6 @@ _python_impl_matches() { # python2.7 # @CODE -# @FUNCTION: python_export -# @USAGE: [<impl>] <variables>... -# @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." - - [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}" - - _python_export "${@}" -} - # @FUNCTION: _python_export # @USAGE: [<impl>] <variables>... # @INTERNAL @@ -333,13 +346,23 @@ _python_export() { ;; PYTHON_SITEDIR) [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it" - PYTHON_SITEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("purelib"))') || die + PYTHON_SITEDIR=$( + "${PYTHON}" - <<-EOF || die + import sysconfig + print(sysconfig.get_path("purelib")) + EOF + ) 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 sysconfig; print(sysconfig.get_path("platinclude"))') || die + PYTHON_INCLUDEDIR=$( + "${PYTHON}" - <<-EOF || die + import sysconfig + print(sysconfig.get_path("platinclude")) + EOF + ) export PYTHON_INCLUDEDIR debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}" @@ -350,7 +373,17 @@ _python_export() { ;; 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 + PYTHON_LIBPATH=$( + "${PYTHON}" - <<-EOF || die + 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 "") + EOF + ) export PYTHON_LIBPATH debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}" @@ -400,7 +433,13 @@ _python_export() { 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 + flags=$( + "${PYTHON}" - <<-EOF || die + import sysconfig + print(sysconfig.get_config_var("ABIFLAGS") + or "") + EOF + ) val=${PYTHON}${flags}-config ;; *) @@ -564,15 +603,6 @@ python_get_scriptdir() { 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} @@ -591,7 +621,12 @@ python_optimize() { 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) + done < <( + "${PYTHON}" - <<-EOF || die + import sys + print("".join(x + "\0" for x in sys.path)) + EOF + ) debug-print "${FUNCNAME}: using sys.path: ${*/%/;}" fi @@ -605,6 +640,7 @@ python_optimize() { local instpath=${d#${D%/}} instpath=/${instpath##/} + einfo "Optimize Python modules for ${instpath}" case "${EPYTHON}" in python2.7|python3.[34]) "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}" @@ -855,22 +891,6 @@ python_doheader() { ) } -# @FUNCTION: python_wrapper_setup -# @USAGE: [<path> [<impl>]] -# @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." - - [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}" - - _python_wrapper_setup "${@}" -} - # @FUNCTION: _python_wrapper_setup # @USAGE: [<path> [<impl>]] # @INTERNAL @@ -978,41 +998,6 @@ _python_wrapper_setup() { export PATH PKG_CONFIG_PATH } -# @FUNCTION: python_is_python3 -# @USAGE: [<impl>] -# @DESCRIPTION: -# Check whether <impl> (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() { - eqawarn "${FUNCNAME} is deprecated, as Python 2 is not supported anymore" - [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}" - - local impl=${1:-${EPYTHON}} - [[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON" - - [[ ${impl} == python3* || ${impl} == pypy3 ]] -} - -# @FUNCTION: python_is_installed -# @USAGE: [<impl>] -# @DESCRIPTION: -# Check whether the interpreter for <impl> (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=( -b ) - [[ ${EAPI} == 6 ]] && hasv_args=( --host-root ) - - 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] <path>... # @DESCRIPTION: @@ -1193,7 +1178,7 @@ python_export_utf8_locale() { debug-print-function ${FUNCNAME} "${@}" # If the locale program isn't available, just return. - type locale >/dev/null || return 0 + type locale &>/dev/null || return 0 if [[ $(locale charmap) != UTF-8 ]]; then # Try English first, then everything else. @@ -1249,10 +1234,24 @@ build_sphinx() { sed -i -e 's:^intersphinx_mapping:disabled_&:' \ "${dir}"/conf.py || die - # not all packages include the Makefile in pypi tarball - "${EPYTHON}" -m sphinx.cmd.build \ - -b html -d "${dir}"/_build/doctrees "${dir}" \ - "${dir}"/_build/html || die + # 1. not all packages include the Makefile in pypi tarball, + # so we call sphinx-build directly + # 2. if autodoc is used, we need to call sphinx via EPYTHON, + # to ensure that PEP 517 venv is respected + # 3. if autodoc is not used, then sphinx might not be installed + # for the current impl, so we need a fallback to sphinx-build + local command=( "${EPYTHON}" -m sphinx.cmd.build ) + if ! "${EPYTHON}" -c "import sphinx.cmd.build" 2>/dev/null; then + command=( sphinx-build ) + fi + command+=( + -b html + -d "${dir}"/_build/doctrees + "${dir}" + "${dir}"/_build/html + ) + echo "${command[@]}" >&2 + "${command[@]}" || die HTML_DOCS+=( "${dir}/_build/html/." ) } @@ -1368,5 +1367,35 @@ eunittest() { return ${?} } +# @FUNCTION: _python_run_check_deps +# @INTERNAL +# @USAGE: <impl> +# @DESCRIPTION: +# Verify whether <impl> is an acceptable choice to run any-r1 style +# code. Checks whether the interpreter is installed, runs +# python_check_deps() if declared. +_python_run_check_deps() { + debug-print-function ${FUNCNAME} "${@}" + + local impl=${1} + local hasv_args=( -b ) + [[ ${EAPI} == 6 ]] && hasv_args=( --host-root ) + + einfo "Checking whether ${impl} is suitable ..." + + local PYTHON_PKG_DEP + _python_export "${impl}" PYTHON_PKG_DEP + ebegin " ${PYTHON_PKG_DEP}" + has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}" + eend ${?} || return 1 + declare -f python_check_deps >/dev/null || return 0 + + local PYTHON_USEDEP="python_targets_${impl}(-)" + local PYTHON_SINGLE_USEDEP="python_single_target_${impl}(-)" + ebegin " python_check_deps" + python_check_deps + eend ${?} +} + _PYTHON_UTILS_R1=1 fi diff --git a/eclass/tests/python-utils-r1.sh b/eclass/tests/python-utils-r1.sh index 7ba4a864ff10..0244ce26ad0f 100755 --- a/eclass/tests/python-utils-r1.sh +++ b/eclass/tests/python-utils-r1.sh @@ -156,11 +156,6 @@ fi test_var PYTHON_PKG_DEP pypy3 '*dev-python/pypy3*:0=' test_var PYTHON_SCRIPTDIR pypy3 /usr/lib/python-exec/pypy3 -test_is "python_is_python3 python2.7" 1 -test_is "python_is_python3 python3.2" 0 -test_is "python_is_python3 pypy" 1 -test_is "python_is_python3 pypy3" 0 - # generic shebangs test_fix_shebang '#!/usr/bin/python' python3.6 '#!/usr/bin/python3.6' test_fix_shebang '#!/usr/bin/python' pypy3 '#!/usr/bin/pypy3' |