python313Packages.tendo: fix build with python 3.13 (#407885)

authored by Sandro and committed by GitHub fa9ba604 059f376f

+187
+4
pkgs/development/python-modules/tendo/default.nix
··· 19 19 hash = "sha256-ZOozMGxAKcEtmUEzHCFSojKc+9Ha+T2MOTmMvdMqNuQ="; 20 20 }; 21 21 22 + patches = [ 23 + ./fix-python-313-build.patch 24 + ]; 25 + 22 26 postPatch = '' 23 27 # marken broken and not required 24 28 sed -i '/setuptools_scm_git_archive/d' pyproject.toml
+183
pkgs/development/python-modules/tendo/fix-python-313-build.patch
··· 1 + From 938d220ce48859cfbb117fb8df42c94c64b88043 Mon Sep 17 00:00:00 2001 2 + From: Leona Maroni <dev@leona.is> 3 + Date: Mon, 11 Nov 2024 12:03:54 +0000 4 + Subject: [PATCH] Enable support for python 3.13 and 3.13 (#96) 5 + 6 + adapter from 938d220ce48859cfbb117fb8df42c94c64b88043 7 + 8 + --- 9 + .gitignore | 1 + 10 + pyproject.toml | 18 ++++++----- 11 + setup.cfg | 3 ++ 12 + src/tendo/tee.py | 4 +-- 13 + tox.ini | 67 +++++++++++++++++++-------------------- 14 + 5 files changed, 49 insertions(+), 44 deletions(-) 15 + 16 + index 215dce7..a1f51a7 100644 17 + --- a/.gitignore 18 + +++ b/.gitignore 19 + @@ -29,3 +29,4 @@ test-distribute.sh 20 + /.pytest_cache 21 + venv/* 22 + src/tendo/_version.py 23 + +coverage.lcov 24 + diff --git a/pyproject.toml b/pyproject.toml 25 + index ef76df7..ad86d7d 100644 26 + --- a/pyproject.toml 27 + +++ b/pyproject.toml 28 + @@ -10,18 +10,20 @@ build-backend = "setuptools.build_meta" 29 + [tool.black] 30 + target-version = ["py38"] 31 + 32 + +[tool.coverage.report] 33 + +exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"] 34 + +fail_under = 100 35 + +skip_covered = true 36 + +show_missing = true 37 + + 38 + [tool.coverage.run] 39 + -source_pkgs = ["tendo"] 40 + -branch = true 41 + +source = ["src"] 42 + +# Do not use branch until bug is fixes: 43 + +# https://github.com/nedbat/coveragepy/issues/605 44 + +branch = false 45 + parallel = true 46 + concurrency = ["multiprocessing", "thread"] 47 + 48 + -[tool.coverage.paths] 49 + -source = ["src", ".tox/*/site-packages"] 50 + - 51 + -[tool.coverage.report] 52 + -exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:"] 53 + - 54 + [tool.isort] 55 + profile = "black" 56 + add_imports = "from __future__ import annotations" 57 + diff --git a/setup.cfg b/setup.cfg 58 + index 0a6d8c0..bf97071 100644 59 + --- a/setup.cfg 60 + +++ b/setup.cfg 61 + @@ -23,6 +23,8 @@ classifier = 62 + Programming Language :: Python :: 3.9 63 + Programming Language :: Python :: 3.10 64 + Programming Language :: Python :: 3.11 65 + + Programming Language :: Python :: 3.12 66 + + Programming Language :: Python :: 3.13 67 + Topic :: Software Development :: Libraries :: Python Modules 68 + Topic :: Internet :: WWW/HTTP 69 + 70 + @@ -52,6 +54,7 @@ test = 71 + coverage[toml]>=6.5.0 72 + coveralls~=3.3.1 73 + pre-commit>=3.3.3 74 + + pip 75 + pytest-cache~=1.0 76 + pytest-cov~=3.0.0 77 + pytest-html~=3.1.1 78 + diff --git a/src/tendo/tee.py b/src/tendo/tee.py 79 + index 04d21cf..5b08794 100755 80 + --- a/src/tendo/tee.py 81 + +++ b/src/tendo/tee.py 82 + @@ -3,7 +3,7 @@ 83 + import codecs 84 + import logging 85 + import os 86 + -import pipes 87 + +from shlex import quote 88 + import subprocess 89 + import sys 90 + import time 91 + @@ -57,7 +57,7 @@ def system2( 92 + # because collections.Iterable seems to be missing on Debian Python 2.5.5 93 + # (but not on OS X 10.8 with Python 2.5.6) 94 + if hasattr(cmd, "__iter__"): 95 + - cmd = " ".join(pipes.quote(s) for s in cmd) 96 + + cmd = " ".join(quote(s) for s in cmd) 97 + 98 + t = time.process_time() 99 + output = [] 100 + diff --git a/tox.ini b/tox.ini 101 + index 5faabef..7f81e8b 100644 102 + --- a/tox.ini 103 + +++ b/tox.ini 104 + @@ -11,45 +11,44 @@ isolated_build = True 105 + 106 + [testenv] 107 + sitepackages=False 108 + +commands_pre = 109 + + # safety measure to assure we do not accidentally run tests with broken dependencies 110 + + {envpython} -m pip check 111 + + # cleaning needed to prevent errors between runs 112 + + sh -c "rm -f {envdir}/.coverage.* 2>/dev/null || true" 113 + +commands= 114 + + # We add coverage options but not making them mandatory as we do not want to force 115 + + # pytest users to run coverage when they just want to run a single test with `pytest -k test` 116 + + coverage run -m pytest {posargs:} 117 + + # needed for upload to codecov.io 118 + + {py,py39,py310,py311,py312,py313}: sh -c "coverage combine -q --data-file={envdir}/.coverage {envdir}/.coverage.* && coverage xml --data-file={envdir}/.coverage -o {envdir}/coverage.xml --ignore-errors --fail-under=0 && COVERAGE_FILE={envdir}/.coverage coverage lcov --fail-under=0 --ignore-errors -q && COVERAGE_FILE={envdir}/.coverage coverage report --fail-under=0 --ignore-errors" 119 + + # lcov needed for vscode integration due to https://github.com/ryanluker/vscode-coverage-gutters/issues/403 120 + +editable = true 121 + +extras = test 122 + passenv = 123 + - CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437 124 + - FORCE_COLOR 125 + - HOME 126 + - LANG 127 + - LC_ALL 128 + - LC_CTYPE 129 + - NO_COLOR 130 + - PYENV_VERSION 131 + - PYTEST_* # allows developer to define their own preferences 132 + - PYTEST_REQPASS # needed for CI 133 + - PY_* 134 + - PY_COLORS 135 + - REQUESTS_CA_BUNDLE # https proxies 136 + - RTD_TOKEN 137 + - RTOX* 138 + - SSH_AUTH_SOCK 139 + - SSL_CERT_FILE # https proxies 140 + + CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437 141 + + FORCE_COLOR 142 + + HOME 143 + + NO_COLOR 144 + + PYTEST_* # allows developer to define their own preferences 145 + + PYTEST_REQPASS # needed for CI 146 + + PYTHON* # PYTHONPYCACHEPREFIX, PYTHONIOENCODING, PYTHONBREAKPOINT,... 147 + + PY_COLORS 148 + + RTD_TOKEN 149 + + REQUESTS_CA_BUNDLE # https proxies 150 + + SETUPTOOLS_SCM_DEBUG 151 + + SSL_CERT_FILE # https proxies 152 + + SSH_AUTH_SOCK # may be needed by git 153 + + LANG 154 + + LC_* 155 + setenv = 156 + - COVERAGE_FILE={env:COVERAGE_FILE:{toxworkdir}/.coverage.{envname}} 157 + - COVERAGE_PROCESS_START={toxinidir}/pyproject.toml 158 + -commands= 159 + - coverage run -m pytest --color=yes --html={envlogdir}/report.html --self-contained-html 160 + - # --pyargs tendo 161 + + COVERAGE_FILE = {env:COVERAGE_FILE:{envdir}/.coverage.{envname}} 162 + + COVERAGE_PROCESS_START={toxinidir}/pyproject.toml 163 + + PIP_DISABLE_PIP_VERSION_CHECK = 1 164 + allowlist_externals = 165 + sh 166 + -deps = 167 + - --editable .[test] 168 + 169 + -[testenv:coverage] 170 + -description = Combines and displays coverage results 171 + -commands = 172 + - sh -c "coverage combine .tox/.coverage.*" 173 + - # needed by codecov github actions: 174 + - coverage xml 175 + - # just for humans running it: 176 + - coverage report --skip-covered --fail-under=43 177 + -deps = 178 + - coverage[toml]>=6.5.0 179 + + 180 + 181 + [testenv:docs] 182 + changedir=docs 183 +