From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 4077E15814C for ; Tue, 10 Oct 2023 20:47:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 758CF2BC017; Tue, 10 Oct 2023 20:47:24 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5CDD22BC017 for ; Tue, 10 Oct 2023 20:47:24 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9A12A335CB9 for ; Tue, 10 Oct 2023 20:47:23 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 108A410D2 for ; Tue, 10 Oct 2023 20:47:22 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1696970838.88375f2b92ba6c710b1d3eef9210ef21f83ccd66.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/mypy/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/mypy/metadata.xml dev-python/mypy/mypy-1.6.0.ebuild X-VCS-Directories: dev-python/mypy/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 88375f2b92ba6c710b1d3eef9210ef21f83ccd66 X-VCS-Branch: master Date: Tue, 10 Oct 2023 20:47:22 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 74c870ad-c40e-45fe-90b5-bc9bd0c5577d X-Archives-Hash: 022d6d674ccfc7fc47956da33fa3e3d9 commit: 88375f2b92ba6c710b1d3eef9210ef21f83ccd66 Author: Eli Schwartz gmail com> AuthorDate: Mon Sep 4 03:51:17 2023 +0000 Commit: Michał Górny gentoo org> CommitDate: Tue Oct 10 20:47:18 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88375f2b dev-python/mypy: add native extensions support mypy can compile itself via mypyc, which requires that it fully pass mypy typechecking; this means we need to have type stubs for its runtime dependencies. Signed-off-by: Eli Schwartz gmail.com> Closes: https://github.com/gentoo/gentoo/pull/32598 Signed-off-by: Michał Górny gentoo.org> dev-python/mypy/metadata.xml | 7 +++++++ dev-python/mypy/mypy-1.6.0.ebuild | 41 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/dev-python/mypy/metadata.xml b/dev-python/mypy/metadata.xml index 01c4182eef50..4d450db3cd4d 100644 --- a/dev-python/mypy/metadata.xml +++ b/dev-python/mypy/metadata.xml @@ -12,4 +12,11 @@ https://github.com/python/mypy/issues https://mypy.readthedocs.io/ + + + Compiles native C extensions (speedups, instead of using Python + fallback code). + + + diff --git a/dev-python/mypy/mypy-1.6.0.ebuild b/dev-python/mypy/mypy-1.6.0.ebuild index de2eae6aae16..7259aa487598 100644 --- a/dev-python/mypy/mypy-1.6.0.ebuild +++ b/dev-python/mypy/mypy-1.6.0.ebuild @@ -3,6 +3,7 @@ EAPI=8 +DISTUTILS_EXT=1 DISTUTILS_USE_PEP517=setuptools PYTHON_COMPAT=( python3_{10..12} ) @@ -22,6 +23,7 @@ SRC_URI=" LICENSE="MIT" SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +IUSE="+native-extensions" # stubgen collides with this package: https://bugs.gentoo.org/585594 RDEPEND=" @@ -34,19 +36,33 @@ RDEPEND=" ' 3.{9..10}) " BDEPEND=" + native-extensions? ( + dev-python/types-psutil[${PYTHON_USEDEP}] + dev-python/types-setuptools[${PYTHON_USEDEP}] + ) test? ( >=dev-python/attrs-18.0[${PYTHON_USEDEP}] >=dev-python/filelock-3.3.0[${PYTHON_USEDEP}] >=dev-python/lxml-4.4.0[${PYTHON_USEDEP}] >=dev-python/pytest-7.4.0[${PYTHON_USEDEP}] >=dev-python/pytest-xdist-1.18[${PYTHON_USEDEP}] + >=dev-python/py-1.5.2[${PYTHON_USEDEP}] + dev-python/six[${PYTHON_USEDEP}] + >=dev-python/virtualenv-16.0.0[${PYTHON_USEDEP}] ) " distutils_enable_tests pytest -# this requires packaging a lot of type stubs -export MYPY_USE_MYPYC=0 +# frustratingly, mypyc produces non-deterministic output. If ccache is enabled it will be a waste of time, +# but simultaneously it might trash your system and fill up the cache with a giant wave of non-reproducible +# test files +export CCACHE_DISABLE=1 + +src_compile() { + local -x MYPY_USE_MYPYC=$(usex native-extensions 1 0) + distutils-r1_src_compile +} python_test() { local EPYTEST_DESELECT=( @@ -60,5 +76,24 @@ python_test() { # Some mypy/test/testcmdline.py::PythonCmdlineSuite tests # fail with high COLUMNS values local -x COLUMNS=80 - epytest -n "$(makeopts_jobs)" --dist=worksteal + + # The tests depend on having in-source compiled extensions if you want to + # test those compiled extensions. Various crucial test dependencies aren't + # installed. Even pyproject.toml is needed because that's where pytest args + # are in. Hack them into the build directory and delete them afterwards. + # See: https://github.com/python/mypy/issues/16143 + local -x MYPY_TEST_PREFIX="${S}" + cd "${BUILD_DIR}/install$(python_get_sitedir)" || die + cp -r "${S}"/{conftest.py,pyproject.toml} . || die + + local failed= + nonfatal epytest -n "$(makeopts_jobs)" --dist=worksteal || failed=1 + + rm conftest.py pyproject.toml || die + # leftover test files + rm -r mypyc/lib-rt/build || die + rm mypyc/lib-rt/test_capi*.so || die + rm mypyc/external/googletest/make/*.[ao] || die + + [[ ${failed} ]] && die "epytest failed with ${EPYTHON}" }