6 Commits

Author SHA256 Message Date
b686383587 Accepting request 1318930 from devel:languages:python
- update to 25.11.0:
  * Enable base 3.14 support
  * Add support for the new Python 3.14 t-string syntax
    introduced by PEP 750
  * Fix bug where comments between `# fmt: off` and `# fmt: on`
    were reformatted
  * Comments containing fmt directives now preserve their exact
    formatting instead of being normalized
  * Add `no_cache` option to control caching behavior.

OBS-URL: https://build.opensuse.org/request/show/1318930
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-black?expand=0&rev=36
2025-11-24 13:05:13 +00:00
b2ae651af2 - update to 25.11.0:
* Enable base 3.14 support
  * Add support for the new Python 3.14 t-string syntax
    introduced by PEP 750
  * Fix bug where comments between `# fmt: off` and `# fmt: on`
    were reformatted
  * Comments containing fmt directives now preserve their exact
    formatting instead of being normalized
  * Add `no_cache` option to control caching behavior.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-black?expand=0&rev=79
2025-11-20 21:35:25 +00:00
947481aa62 Accepting request 1306430 from devel:languages:python
- update to 25.9.0:
  * Remove support for pre-python 3.7 `await/async` as soft
    keywords/variable names
  * Fix crash while formatting a long `del` statement containing
    tuples
  * Fix crash while formatting expressions using the walrus
    operator in complex `with` statements
  * Handle `# fmt: skip` followed by a comment at the end of file
  * Fix crash when a tuple appears in the `as` clause of a `with`
    statement
  * Fix crash when tuple is used as a context manager inside a
    `with` statement
  * Fix crash when formatting a `\` followed by a `
` followed
    by a comment
  * Fix crash on a `\r
  * Fix crash on `await ...` (where `...` is a literal
    `Ellipsis`)
  * Fix crash on parenthesized expression inside a type parameter
    bound
  * Fix crash when using line ranges excluding indented single
    line decorated items
  * (#4670)
  * Fix a bug where one-liner functions/conditionals marked with
    `# fmt: skip` would still be formatted
  * Improve `multiline_string_handling` with ternaries and
    dictionaries
  * Fix a bug where `string_processing` would not split f-strings
    directly after expressions
  * Wrap the `in` clause of comprehensions across lines if

OBS-URL: https://build.opensuse.org/request/show/1306430
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-black?expand=0&rev=35
2025-09-23 14:05:53 +00:00
f6cd2027bf - update to 25.9.0:
* Remove support for pre-python 3.7 `await/async` as soft
    keywords/variable names
  * Fix crash while formatting a long `del` statement containing
    tuples
  * Fix crash while formatting expressions using the walrus
    operator in complex `with` statements
  * Handle `# fmt: skip` followed by a comment at the end of file
  * Fix crash when a tuple appears in the `as` clause of a `with`
    statement
  * Fix crash when tuple is used as a context manager inside a
    `with` statement
  * Fix crash when formatting a `\` followed by a `
` followed
    by a comment
  * Fix crash on a `\r
  * Fix crash on `await ...` (where `...` is a literal
    `Ellipsis`)
  * Fix crash on parenthesized expression inside a type parameter
    bound
  * Fix crash when using line ranges excluding indented single
    line decorated items
  * (#4670)
  * Fix a bug where one-liner functions/conditionals marked with
    `# fmt: skip` would still be formatted
  * Improve `multiline_string_handling` with ternaries and
    dictionaries
  * Fix a bug where `string_processing` would not split f-strings
    directly after expressions
  * Wrap the `in` clause of comprehensions across lines if

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-black?expand=0&rev=77
2025-09-22 07:35:41 +00:00
f4d89a7c92 Accepting request 1286790 from devel:languages:python
- Instead of skipping the test, apply upstream fix as
  update-PEP-701.patch (code from gh#psf/black!4690).

OBS-URL: https://build.opensuse.org/request/show/1286790
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-black?expand=0&rev=34
2025-06-23 12:55:41 +00:00
0a29e7c4f2 - Instead of skipping the test, apply upstream fix as
update-PEP-701.patch (code from gh#psf/black!4690).

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-black?expand=0&rev=74
2025-06-18 20:27:43 +00:00
5 changed files with 69 additions and 223 deletions

Binary file not shown.

3
black-25.11.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9a323ac32f5dc75ce7470501b887250be5005a01602e931a15e45593f70f6e08
size 655669

View File

@@ -1,213 +0,0 @@
From df50f6c30c696d4f9121e6cd8e885a05dce39360 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mark=C3=A9ta=20Cal=C3=A1bkov=C3=A1?=
<meggy.calabkova@gmail.com>
Date: Fri, 7 Feb 2025 17:05:43 +0100
Subject: [PATCH 1/4] mix_stderr parameter was removed from click 8.2.0
---
tests/test_black.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_black.py b/tests/test_black.py
index 31bc34d4b89..8fa352e3d22 100644
--- a/tests/test_black.py
+++ b/tests/test_black.py
@@ -114,7 +114,7 @@ class BlackRunner(CliRunner):
"""Make sure STDOUT and STDERR are kept separate when testing Black via its CLI."""
def __init__(self) -> None:
- super().__init__(mix_stderr=False)
+ super().__init__()
def invokeBlack(
From a65eb895e13263dc700cfbf60db0376e15957c4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mark=C3=A9ta=20Cal=C3=A1bkov=C3=A1?=
<meggy.calabkova@gmail.com>
Date: Mon, 10 Feb 2025 11:12:17 +0100
Subject: [PATCH 2/4] make the call conditional on click version
---
tests/test_black.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/test_black.py b/tests/test_black.py
index 8fa352e3d22..cbb5006d070 100644
--- a/tests/test_black.py
+++ b/tests/test_black.py
@@ -14,6 +14,7 @@
from concurrent.futures import ThreadPoolExecutor
from contextlib import contextmanager, redirect_stderr
from dataclasses import fields, replace
+from importlib.metadata import version as imp_version
from io import BytesIO
from pathlib import Path, WindowsPath
from platform import system
@@ -26,6 +27,7 @@
from click import unstyle
from click.testing import CliRunner
from pathspec import PathSpec
+from packaging.version import Version
import black
import black.files
@@ -114,7 +116,10 @@ class BlackRunner(CliRunner):
"""Make sure STDOUT and STDERR are kept separate when testing Black via its CLI."""
def __init__(self) -> None:
- super().__init__()
+ if Version(imp_version('click')) >= Version('8.2.0'):
+ super().__init__()
+ else:
+ super().__init__(mix_stderr=False)
def invokeBlack(
From bdc188f550709e40b86f97777465e4068c61c261 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
<66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Mon, 10 Feb 2025 11:02:28 +0000
Subject: [PATCH 3/4] [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---
tests/test_black.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_black.py b/tests/test_black.py
index cbb5006d070..9870cec4c26 100644
--- a/tests/test_black.py
+++ b/tests/test_black.py
@@ -26,8 +26,8 @@
import pytest
from click import unstyle
from click.testing import CliRunner
-from pathspec import PathSpec
from packaging.version import Version
+from pathspec import PathSpec
import black
import black.files
From 3dfacb5f34476b8c1ff28b5eb05cb85ff7418a66 Mon Sep 17 00:00:00 2001
From: MeggyCal <MeggyCal@users.noreply.github.com>
Date: Mon, 17 Feb 2025 12:01:26 +0100
Subject: [PATCH 4/4] double quotes
---
tests/test_black.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_black.py b/tests/test_black.py
index 9870cec4c26..4bdbdbba5cf 100644
--- a/tests/test_black.py
+++ b/tests/test_black.py
@@ -116,7 +116,7 @@ class BlackRunner(CliRunner):
"""Make sure STDOUT and STDERR are kept separate when testing Black via its CLI."""
def __init__(self) -> None:
- if Version(imp_version('click')) >= Version('8.2.0'):
+ if Version(imp_version("click")) >= Version("8.2.0"):
super().__init__()
else:
super().__init__(mix_stderr=False)
From 17101f151b407cb3346b0a472d9e32d7a56d5aca Mon Sep 17 00:00:00 2001
From: "Michael R. Crusoe" <michael.crusoe@gmail.com>
Date: Thu, 27 Feb 2025 15:17:21 +0100
Subject: [PATCH] additional fix for click 8.2.0
---
tests/test_black.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/tests/test_black.py b/tests/test_black.py
index 4bdbdbba5cf..ca19c17678b 100644
--- a/tests/test_black.py
+++ b/tests/test_black.py
@@ -192,10 +192,10 @@ def test_piping(self) -> None:
input=BytesIO(source.encode("utf-8")),
)
self.assertEqual(result.exit_code, 0)
- self.assertFormatEqual(expected, result.output)
- if source != result.output:
- black.assert_equivalent(source, result.output)
- black.assert_stable(source, result.output, DEFAULT_MODE)
+ self.assertFormatEqual(expected, result.stdout)
+ if source != result.stdout:
+ black.assert_equivalent(source, result.stdout)
+ black.assert_stable(source, result.stdout, DEFAULT_MODE)
def test_piping_diff(self) -> None:
diff_header = re.compile(
@@ -215,7 +215,7 @@ def test_piping_diff(self) -> None:
black.main, args, input=BytesIO(source.encode("utf-8"))
)
self.assertEqual(result.exit_code, 0)
- actual = diff_header.sub(DETERMINISTIC_HEADER, result.output)
+ actual = diff_header.sub(DETERMINISTIC_HEADER, result.stdout)
actual = actual.rstrip() + "\n" # the diff output has a trailing space
self.assertEqual(expected, actual)
@@ -300,7 +300,7 @@ def test_expression_diff(self) -> None:
self.assertEqual(result.exit_code, 0)
finally:
os.unlink(tmp_file)
- actual = result.output
+ actual = result.stdout
actual = diff_header.sub(DETERMINISTIC_HEADER, actual)
if expected != actual:
dump = black.dump_to_file(actual)
@@ -409,7 +409,7 @@ def test_skip_magic_trailing_comma(self) -> None:
self.assertEqual(result.exit_code, 0)
finally:
os.unlink(tmp_file)
- actual = result.output
+ actual = result.stdout
actual = diff_header.sub(DETERMINISTIC_HEADER, actual)
actual = actual.rstrip() + "\n" # the diff output has a trailing space
if expected != actual:
@@ -1831,7 +1831,7 @@ def test_bpo_2142_workaround(self) -> None:
self.assertEqual(result.exit_code, 0)
finally:
os.unlink(tmp_file)
- actual = result.output
+ actual = result.stdout
actual = diff_header.sub(DETERMINISTIC_HEADER, actual)
self.assertEqual(actual, expected)
@@ -1841,7 +1841,7 @@ def compare_results(
) -> None:
"""Helper method to test the value and exit code of a click Result."""
assert (
- result.output == expected_value
+ result.stdout == expected_value
), "The output did not match the expected value."
assert result.exit_code == expected_exit_code, "The exit code is incorrect."
From 7cf419741ab55028519f43524c3414a759aaa984 Mon Sep 17 00:00:00 2001
From: Daniel Garcia Moreno <daniel.garcia@suse.com>
Date: Mon, 12 May 2025 13:49:11 +0200
Subject: [PATCH] Update test_code_option_safe to work with click 8.2.0
---
tests/test_black.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/test_black.py b/tests/test_black.py
index acafb521619..f5c950244ef 100644
--- a/tests/test_black.py
+++ b/tests/test_black.py
@@ -1907,7 +1907,8 @@ def test_code_option_safe(self) -> None:
args = ["--safe", "--code", code]
result = CliRunner().invoke(black.main, args)
- self.compare_results(result, error_msg, 123)
+ assert error_msg == result.output
+ assert result.exit_code == 123
def test_code_option_fast(self) -> None:
"""Test that the code option ignores errors when the sanity checks fail."""

View File

@@ -1,3 +1,64 @@
-------------------------------------------------------------------
Thu Nov 20 21:35:02 UTC 2025 - Dirk Müller <dmueller@suse.com>
- update to 25.11.0:
* Enable base 3.14 support
* Add support for the new Python 3.14 t-string syntax
introduced by PEP 750
* Fix bug where comments between `# fmt: off` and `# fmt: on`
were reformatted
* Comments containing fmt directives now preserve their exact
formatting instead of being normalized
* Add `no_cache` option to control caching behavior.
-------------------------------------------------------------------
Mon Sep 22 07:34:17 UTC 2025 - Dirk Müller <dmueller@suse.com>
- update to 25.9.0:
* Remove support for pre-python 3.7 `await/async` as soft
keywords/variable names
* Fix crash while formatting a long `del` statement containing
tuples
* Fix crash while formatting expressions using the walrus
operator in complex `with` statements
* Handle `# fmt: skip` followed by a comment at the end of file
* Fix crash when a tuple appears in the `as` clause of a `with`
statement
* Fix crash when tuple is used as a context manager inside a
`with` statement
* Fix crash when formatting a `\` followed by a `
` followed
by a comment
* Fix crash on a `\r
* Fix crash on `await ...` (where `...` is a literal
`Ellipsis`)
* Fix crash on parenthesized expression inside a type parameter
bound
* Fix crash when using line ranges excluding indented single
line decorated items
* (#4670)
* Fix a bug where one-liner functions/conditionals marked with
`# fmt: skip` would still be formatted
* Improve `multiline_string_handling` with ternaries and
dictionaries
* Fix a bug where `string_processing` would not split f-strings
directly after expressions
* Wrap the `in` clause of comprehensions across lines if
necessary
* Remove parentheses around multiple exception types in
`except` and `except*` without `as`.
* Rewrite tokenizer to improve performance and compliance
* Fix bug where certain unusual expressions (e.g., lambdas)
were not accepted in type parameter bounds and defaults.
* Avoid using an extra process when running with only one
worker
- drop update-PEP-701.patch, click-820.patch: upstream
-------------------------------------------------------------------
Wed Jun 18 20:26:19 UTC 2025 - Matej Cepl <mcepl@cepl.eu>
- Instead of skipping the test, apply upstream fix as
update-PEP-701.patch (code from gh#psf/black!4690).
-------------------------------------------------------------------
Wed Jun 18 07:27:52 UTC 2025 - Matej Cepl <mcepl@cepl.eu>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-black
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -24,14 +24,12 @@
%{?sle15_python_module_pythons}
Name: python-black
Version: 25.1.0
Version: 25.11.0
Release: 0
Summary: A code formatter written in, and written for Python
License: MIT
URL: https://github.com/psf/black
Source: https://files.pythonhosted.org/packages/source/b/black/black-%{version}.tar.gz
# PATCH-FIX-UPSTREAM click-820.patch gh#psf/black#4577, gh#psf/black#4591, gh#psf/black#4666
Patch0: click-820.patch
BuildRequires: %{python_module aiohttp >= 3.3.2}
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module click >= 8.0.0}
@@ -44,6 +42,7 @@ BuildRequires: %{python_module pathspec >= 0.9.0}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module platformdirs >= 2}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module pytokens >= 0.1.10}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -53,6 +52,7 @@ Requires: python-mypy_extensions >= 0.4.3
Requires: python-packaging
Requires: python-pathspec >= 0.9.0
Requires: python-platformdirs >= 2
Requires: python-pytokens >= 0.1.10
%if %{with libalternatives}
BuildRequires: alts
@@ -96,9 +96,7 @@ export PATH=$PATH:~/bin
# test_expression_diff - sometimes fails on async timing in OBS
# test_bpo_2142_workaround fails on arm
skiptests="test_expression_diff or test_bpo_2142_workaround"
# gh#psf/black#4698
skiptests+=" or test_simple_format"
%pytest -k "not ($skiptests)"
%pytest
%pre
# If libalternatives is used: Removing old update-alternatives entries.