diff options
| author | root <root@alpha.trunkmasters.com> | 2026-06-04 05:48:38 -0500 |
|---|---|---|
| committer | root <root@alpha.trunkmasters.com> | 2026-06-04 05:48:38 -0500 |
| commit | bfd9c39e4712ebdb442d4ca0673061faed1e70e1 (patch) | |
| tree | 0d7a74b4463ee387f9cf9368ceb1b757f694f72a /dev-python/mccabe | |
| parent | f716a9fe6455d39eef01e718aae68dae61c19704 (diff) | |
| download | baldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.tar.gz baldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.tar.xz baldeagleos-repo-bfd9c39e4712ebdb442d4ca0673061faed1e70e1.zip | |
Revert "Adding metadata"
This reverts commit f716a9fe6455d39eef01e718aae68dae61c19704.
Diffstat (limited to 'dev-python/mccabe')
| -rw-r--r-- | dev-python/mccabe/Manifest | 1 | ||||
| -rw-r--r-- | dev-python/mccabe/files/mccabe-0.7.0-fix-tests-without-hypothesmith.patch | 74 | ||||
| -rw-r--r-- | dev-python/mccabe/mccabe-0.7.0.ebuild | 35 | ||||
| -rw-r--r-- | dev-python/mccabe/metadata.xml | 13 |
4 files changed, 123 insertions, 0 deletions
diff --git a/dev-python/mccabe/Manifest b/dev-python/mccabe/Manifest new file mode 100644 index 000000000000..7d09297cd122 --- /dev/null +++ b/dev-python/mccabe/Manifest @@ -0,0 +1 @@ +DIST mccabe-0.7.0.tar.gz 9658 BLAKE2B b4664a00d4760e2f662681875b548b67ad76d6b8a0ee46bf160e3232ad75172512ad7b4a99759dc13607cf06f3c772210b76a7051582d0bbd221091772543c07 SHA512 3e4141033c63434fad183f62dece872554302aeee8cb789586ac7d6d748d198799e2797df1d58458f4d431734f8899f11022d76666c848d43e6271304776346d diff --git a/dev-python/mccabe/files/mccabe-0.7.0-fix-tests-without-hypothesmith.patch b/dev-python/mccabe/files/mccabe-0.7.0-fix-tests-without-hypothesmith.patch new file mode 100644 index 000000000000..18728fe59826 --- /dev/null +++ b/dev-python/mccabe/files/mccabe-0.7.0-fix-tests-without-hypothesmith.patch @@ -0,0 +1,74 @@ +diff --git a/test_mccabe.py b/test_mccabe.py +index fe6e8d3..14d8012 100644 +--- a/test_mccabe.py ++++ b/test_mccabe.py +@@ -241,37 +241,38 @@ class RegressionTests(unittest.TestCase): + + # This test uses the Hypothesis and Hypothesmith libraries to generate random + # syntatically-valid Python source code and applies McCabe on it. +-@settings( +- max_examples=1000, # roughly 1k tests/minute, or half that under coverage +- derandomize=False, # deterministic mode to avoid CI flakiness +- deadline=None, # ignore Hypothesis' health checks; we already know that +- suppress_health_check=HealthCheck.all(), # this is slow and filter-heavy. +-) +-@given( +- # Note that while Hypothesmith might generate code unlike that written by +- # humans, it's a general test that should pass for any *valid* source code. +- # (so e.g. running it against code scraped of the internet might also help) +- src_contents=hypothesmith.from_grammar() | hypothesmith.from_node(), +- max_complexity=st.integers(min_value=1), +-) +-@pytest.mark.skipif(not hypothesmith, reason="hypothesmith could not be imported") +-def test_idempotent_any_syntatically_valid_python( +- src_contents: str, max_complexity: int +-) -> None: +- """Property-based tests for mccabe. +- +- This test case is based on a similar test for Black, the code formatter. +- Black's test was written by Zac Hatfield-Dodds, the author of Hypothesis +- and the Hypothesmith tool for source code generation. You can run this +- file with `python`, `pytest`, or (soon) a coverage-guided fuzzer Zac is +- working on. +- """ +- +- # Before starting, let's confirm that the input string is valid Python: +- compile(src_contents, "<string>", "exec") # else bug is in hypothesmith +- +- # Then try to apply get_complexity_number to the code... +- get_code_complexity(src_contents, max_complexity) ++if hypothesmith: ++ @settings( ++ max_examples=1000, # roughly 1k tests/minute, or half that under coverage ++ derandomize=False, # deterministic mode to avoid CI flakiness ++ deadline=None, # ignore Hypothesis' health checks; we already know that ++ suppress_health_check=HealthCheck.all(), # this is slow and filter-heavy. ++ ) ++ @given( ++ # Note that while Hypothesmith might generate code unlike that written by ++ # humans, it's a general test that should pass for any *valid* source code. ++ # (so e.g. running it against code scraped of the internet might also help) ++ src_contents=hypothesmith.from_grammar() | hypothesmith.from_node(), ++ max_complexity=st.integers(min_value=1), ++ ) ++ @pytest.mark.skipif(not hypothesmith, reason="hypothesmith could not be imported") ++ def test_idempotent_any_syntatically_valid_python( ++ src_contents: str, max_complexity: int ++ ) -> None: ++ """Property-based tests for mccabe. ++ ++ This test case is based on a similar test for Black, the code formatter. ++ Black's test was written by Zac Hatfield-Dodds, the author of Hypothesis ++ and the Hypothesmith tool for source code generation. You can run this ++ file with `python`, `pytest`, or (soon) a coverage-guided fuzzer Zac is ++ working on. ++ """ ++ ++ # Before starting, let's confirm that the input string is valid Python: ++ compile(src_contents, "<string>", "exec") # else bug is in hypothesmith ++ ++ # Then try to apply get_complexity_number to the code... ++ get_code_complexity(src_contents, max_complexity) + + + if __name__ == "__main__": diff --git a/dev-python/mccabe/mccabe-0.7.0.ebuild b/dev-python/mccabe/mccabe-0.7.0.ebuild new file mode 100644 index 000000000000..354831ad94e5 --- /dev/null +++ b/dev-python/mccabe/mccabe-0.7.0.ebuild @@ -0,0 +1,35 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{13..14} ) +DISTUTILS_USE_PEP517=setuptools + +inherit distutils-r1 pypi + +DESCRIPTION="flake8 plugin: McCabe complexity checker" +HOMEPAGE=" + https://github.com/PyCQA/mccabe/ + https://pypi.org/project/mccabe/ +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~x64-macos ~x64-solaris" + +RDEPEND=" + dev-python/flake8[${PYTHON_USEDEP}] +" + +BDEPEND=" + test? ( + dev-python/hypothesis[${PYTHON_USEDEP}] + ) +" + +PATCHES=( + "${FILESDIR}/${P}-fix-tests-without-hypothesmith.patch" +) + +distutils_enable_tests pytest diff --git a/dev-python/mccabe/metadata.xml b/dev-python/mccabe/metadata.xml new file mode 100644 index 000000000000..3c742067aa3e --- /dev/null +++ b/dev-python/mccabe/metadata.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>python@gentoo.org</email> + <name>Python</name> + </maintainer> + <stabilize-allarches/> + <upstream> + <remote-id type="pypi">mccabe</remote-id> + <remote-id type="github">PyCQA/mccabe</remote-id> + </upstream> +</pkgmetadata> |
