From fef9b28eeb4cf4e1d753347f91a7ca31aa8cb70ecd2247dbef5d9e8b357b34c5 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 9 May 2023 22:35:22 +0000 Subject: [PATCH] Accepting request 1085164 from home:ojkastl_buildservice:Branch_devel_languages_python add patch to replace hardcoded python3 executable name OBS-URL: https://build.opensuse.org/request/show/1085164 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-subprocess-tee?expand=0&rev=16 --- ...y-do-not-use-python3-rather-use-sys..patch | 43 +++++++++++++++++++ python-subprocess-tee.changes | 8 ++++ python-subprocess-tee.spec | 2 + 3 files changed, 53 insertions(+) create mode 100644 0001-test-test_unit.py-do-not-use-python3-rather-use-sys..patch diff --git a/0001-test-test_unit.py-do-not-use-python3-rather-use-sys..patch b/0001-test-test_unit.py-do-not-use-python3-rather-use-sys..patch new file mode 100644 index 0000000..ed1d93e --- /dev/null +++ b/0001-test-test_unit.py-do-not-use-python3-rather-use-sys..patch @@ -0,0 +1,43 @@ +From 8dcde7134573acb506c7f34746573cbaeccf9b4d Mon Sep 17 00:00:00 2001 +From: Johannes Kastl +Date: Fri, 5 May 2023 20:11:37 +0200 +Subject: [PATCH] test/test_unit.py: do not use python3, rather use + sys.executable to use the same python version this test is running with + +Signed-off-by: Johannes Kastl +--- + test/test_unit.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/test/test_unit.py b/test/test_unit.py +index 1dd4d2f..652fce9 100644 +--- a/test/test_unit.py ++++ b/test/test_unit.py +@@ -1,5 +1,6 @@ + """Unittests.""" + import subprocess ++import sys + from typing import Dict + + import pytest +@@ -30,7 +31,7 @@ def test_run_list() -> None: + # NOTICE: subprocess.run() does fail to capture any output when cmd is + # a list and you specific shell=True. Still, when not mentioning shell, + # it does work. +- cmd = ["python3", "--version"] ++ cmd = [sys.executable, "--version"] + old_result = subprocess.run( + cmd, + # shell=True, +@@ -47,7 +48,7 @@ def test_run_list() -> None: + + def test_run_echo(capsys: CaptureFixture[str]) -> None: + """Validate run call with echo dumps command.""" +- cmd = ["python3", "--version"] ++ cmd = [sys.executable, "--version"] + old_result = subprocess.run( + cmd, + # shell=True, +-- +2.40.1 + diff --git a/python-subprocess-tee.changes b/python-subprocess-tee.changes index 60e41f9..f8c750d 100644 --- a/python-subprocess-tee.changes +++ b/python-subprocess-tee.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri May 5 18:13:11 UTC 2023 - Johannes Kastl + +- add patch + 0001-test-test_unit.py-do-not-use-python3-rather-use-sys..patch + to replace hardcoded python3 executable name + (see https://github.com/pycontribs/subprocess-tee/pull/107) + ------------------------------------------------------------------- Fri May 5 10:39:38 UTC 2023 - Johannes Kastl diff --git a/python-subprocess-tee.spec b/python-subprocess-tee.spec index 95fd79d..03acb38 100644 --- a/python-subprocess-tee.spec +++ b/python-subprocess-tee.spec @@ -24,6 +24,7 @@ Summary: Captures the output of subprocesses in real-time License: MIT URL: https://github.com/pycontribs/subprocess-tee Source: https://files.pythonhosted.org/packages/source/s/subprocess-tee/subprocess-tee-%{version}.tar.gz +Patch1: 0001-test-test_unit.py-do-not-use-python3-rather-use-sys..patch BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest} BuildRequires: %{python_module rich} @@ -50,6 +51,7 @@ to provide instant feedback (progress) related to what is happening. %prep %setup -q -n subprocess-tee-%{version} +%patch1 -p1 %build %pyproject_wheel