diff --git a/fix-cli-test-fails-with-yes.patch b/fix-cli-test-fails-with-yes.patch new file mode 100644 index 0000000..84f3a70 --- /dev/null +++ b/fix-cli-test-fails-with-yes.patch @@ -0,0 +1,50 @@ +From de71f131cd845ba76ae288292d7c3338716b82fd Mon Sep 17 00:00:00 2001 +From: Firas AlShafei +Date: Thu, 22 May 2025 21:20:19 -0500 +Subject: [PATCH] ci: add --yes flag to build tests to prevent interactive + prompt failures + +--- + src/towncrier/test/test_build.py | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +Index: towncrier-24.8.0/src/towncrier/test/test_build.py +=================================================================== +--- towncrier-24.8.0.orig/src/towncrier/test/test_build.py ++++ towncrier-24.8.0/src/towncrier/test/test_build.py +@@ -1143,7 +1143,7 @@ class TestCli(TestCase): + ), + ) + +- result = runner.invoke(_main, ["--date", "01-01-2001"], catch_exceptions=False) ++ result = runner.invoke(_main, ["--date", "01-01-2001", "--yes"], catch_exceptions=False) + + with open("foo/newsfragments/123.feature", "w") as f: + f.write("Adds levitation") +@@ -1319,7 +1319,7 @@ class TestCli(TestCase): + dedent=True, + ) + +- result = runner.invoke(_main, ["--date", "01-01-2001"], catch_exceptions=False) ++ result = runner.invoke(_main, ["--date", "01-01-2001", "--yes"], catch_exceptions=False) + self.assertEqual(0, result.exit_code, result.output) + output = read("NEWS.rst") + +@@ -1373,7 +1373,7 @@ class TestCli(TestCase): + dedent=True, + ) + +- result = runner.invoke(_main, ["--date", "01-01-2001"], catch_exceptions=False) ++ result = runner.invoke(_main, ["--date", "01-01-2001", "--yes"], catch_exceptions=False) + self.assertEqual(0, result.exit_code, result.output) + output = read("NEWS.md") + +@@ -1425,7 +1425,7 @@ class TestCli(TestCase): + dedent=True, + ) + +- result = runner.invoke(_main, ["--date", "01-01-2001"], catch_exceptions=False) ++ result = runner.invoke(_main, ["--date", "01-01-2001", "--yes"], catch_exceptions=False) + self.assertEqual(0, result.exit_code, result.output) + output = read("NEWS.md") + diff --git a/python-towncrier.changes b/python-towncrier.changes index 381db03..35acdf1 100644 --- a/python-towncrier.changes +++ b/python-towncrier.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Jul 21 04:35:04 UTC 2025 - Steve Kowalik + +- Update URL. +- Add patch support-click-8.2.patch: + * Support Click 8.2+ changes. +- Add patch fix-cli-test-fails-with-yes.patch: + * Invoke ourselves with --yes to avoid interactive prompts. + ------------------------------------------------------------------- Tue Apr 8 11:25:44 UTC 2025 - Ben Greiner diff --git a/python-towncrier.spec b/python-towncrier.spec index 8ab9ab4..a10310c 100644 --- a/python-towncrier.spec +++ b/python-towncrier.spec @@ -22,9 +22,12 @@ Version: 24.8.0 Release: 0 Summary: Building newsfiles for your project License: MIT -Group: Development/Languages/Python -URL: https://github.com/hawkowl/towncrier +URL: https://github.com/twisted/towncrier Source: https://files.pythonhosted.org/packages/source/t/towncrier/towncrier-%{version}.tar.gz +# PATCH-FIX-UPSTREAM Based on gh#twisted/towncrier#709/commits/2fee0e7f103161175424867c9716339a196bc957 +Patch0: support-click-8.2.patch +# PATCH-FIX-UPSTREAM Based on gh#twisted/towncrier#709/commits/de71f131cd845ba76ae288292d7c3338716b82fd +Patch1: fix-cli-test-fails-with-yes.patch BuildRequires: %{python_module Jinja2} BuildRequires: %{python_module click} BuildRequires: %{python_module hatchling} @@ -58,7 +61,7 @@ BuildRequires: %{python_module pytest} Building newsfiles for your project. %prep -%setup -q -n towncrier-%{version} +%autosetup -p1 -n towncrier-%{version} %build %pyproject_wheel diff --git a/support-click-8.2.patch b/support-click-8.2.patch new file mode 100644 index 0000000..79d539c --- /dev/null +++ b/support-click-8.2.patch @@ -0,0 +1,36 @@ +From 2fee0e7f103161175424867c9716339a196bc957 Mon Sep 17 00:00:00 2001 +From: Firas AlShafei +Date: Thu, 22 May 2025 21:17:15 -0500 +Subject: [PATCH] ci: fix clirunner + +- Adapt CliRunner for different Click library versions to correctly handle error messages. +--- + src/towncrier/test/test_check.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +Index: towncrier-24.8.0/src/towncrier/test/test_check.py +=================================================================== +--- towncrier-24.8.0.orig/src/towncrier/test/test_check.py ++++ towncrier-24.8.0/src/towncrier/test/test_check.py +@@ -245,7 +245,12 @@ class TestChecker(TestCase): + """ + No failure when output is piped causing None encoding for stdout. + """ +- runner = CliRunner() ++ try: ++ runner = CliRunner(mix_stderr=False) ++ except TypeError: ++ # Fallback for older Click versions (or unexpected signature) ++ print("TypeError with mix_stderr=False, falling back to echo_stdin=True") ++ runner = CliRunner(echo_stdin=True) + + with runner.isolated_filesystem(): + create_project("pyproject.toml", main_branch="master") +@@ -257,7 +262,6 @@ class TestChecker(TestCase): + call(["git", "add", fragment_path]) + call(["git", "commit", "-m", "add a newsfragment"]) + +- runner = CliRunner(mix_stderr=False) + result = runner.invoke(towncrier_check, ["--compare-with", "master"]) + + self.assertEqual(0, result.exit_code)