Compare commits
13 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| b8afd8695a | |||
| 53ba09dde6 | |||
| dd9e2c8e76 | |||
| 02a2af6828 | |||
| 6051bd01e7 | |||
| a5b2843e7a | |||
| c069a853e7 | |||
| dd9e7cc361 | |||
| f76ee8ef20 | |||
| 6233d0b7c9 | |||
| 172927fd4b | |||
| e1fc277706 | |||
| 3951bf6272 |
@@ -1,3 +0,0 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
|
||||||
oid sha256:a0c9c4a0771afc6919578cec71ce82a3e31e054904e7197deacbc9382671c41f
|
|
||||||
size 634292
|
|
||||||
BIN
black-25.1.0.tar.gz
LFS
Normal file
BIN
black-25.1.0.tar.gz
LFS
Normal file
Binary file not shown.
112
click-820.patch
Normal file
112
click-820.patch
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
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 | 28 +++++++++++++++++-----------
|
||||||
|
1 file changed, 17 insertions(+), 11 deletions(-)
|
||||||
|
|
||||||
|
Index: black-25.1.0/tests/test_black.py
|
||||||
|
===================================================================
|
||||||
|
--- black-25.1.0.orig/tests/test_black.py 2020-02-02 01:00:00.000000000 +0100
|
||||||
|
+++ black-25.1.0/tests/test_black.py 2025-06-18 22:23:10.051582946 +0200
|
||||||
|
@@ -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
|
||||||
|
@@ -25,6 +26,7 @@
|
||||||
|
import pytest
|
||||||
|
from click import unstyle
|
||||||
|
from click.testing import CliRunner
|
||||||
|
+from packaging.version import Version
|
||||||
|
from pathspec import PathSpec
|
||||||
|
|
||||||
|
import black
|
||||||
|
@@ -114,7 +116,10 @@
|
||||||
|
"""Make sure STDOUT and STDERR are kept separate when testing Black via its CLI."""
|
||||||
|
|
||||||
|
def __init__(self) -> None:
|
||||||
|
- super().__init__(mix_stderr=False)
|
||||||
|
+ if Version(imp_version("click")) >= Version("8.2.0"):
|
||||||
|
+ super().__init__()
|
||||||
|
+ else:
|
||||||
|
+ super().__init__(mix_stderr=False)
|
||||||
|
|
||||||
|
|
||||||
|
def invokeBlack(
|
||||||
|
@@ -187,10 +192,10 @@
|
||||||
|
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(
|
||||||
|
@@ -210,7 +215,7 @@
|
||||||
|
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)
|
||||||
|
|
||||||
|
@@ -295,7 +300,7 @@
|
||||||
|
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)
|
||||||
|
@@ -404,7 +409,7 @@
|
||||||
|
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:
|
||||||
|
@@ -1826,7 +1831,7 @@
|
||||||
|
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)
|
||||||
|
|
||||||
|
@@ -1836,7 +1841,7 @@
|
||||||
|
) -> 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."
|
||||||
|
|
||||||
|
@@ -1913,7 +1918,8 @@
|
||||||
|
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."""
|
||||||
@@ -1,3 +1,103 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
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>
|
||||||
|
|
||||||
|
- Skip test_simple_format tests, which is failing with 3.13.5
|
||||||
|
(gh#psf/black#4698).
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon May 12 11:01:03 UTC 2025 - Daniel Garcia <daniel.garcia@suse.com>
|
||||||
|
|
||||||
|
- Use libalternatives instead of update-alternatives
|
||||||
|
- Add upstream click-820.patch to make it work with latest
|
||||||
|
python-click
|
||||||
|
gh#psf/black#4577, gh#psf/black#4591, gh#psf/black#4666
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Feb 10 09:37:29 UTC 2025 - Nico Krapp <nico.krapp@suse.com>
|
||||||
|
|
||||||
|
- Update to 25.1.0:
|
||||||
|
Highlights:
|
||||||
|
* Normalize casing of Unicode escape characters in strings to lowercase (#2916)
|
||||||
|
* Fix inconsistencies in whether certain strings are detected as docstrings (#4095)
|
||||||
|
* Consistently add trailing commas to typed function parameters (#4164)
|
||||||
|
* Remove redundant parentheses in if guards for case blocks (#4214)
|
||||||
|
* Add parentheses to if clauses in case blocks when the line is too long (#4269)
|
||||||
|
* Whitespace before # fmt: skip comments is no longer normalized (#4146)
|
||||||
|
* Fix line length computation for certain expressions that involve the power operator (#4154)
|
||||||
|
* Check if there is a newline before the terminating quotes of a docstring (#4185)
|
||||||
|
* Fix type annotation spacing between * and more complex type variable tuple (#4440)
|
||||||
|
* Remove parentheses around sole list items (#4312)
|
||||||
|
* Generic function definitions are now formatted more elegantly: parameters are
|
||||||
|
split over multiple lines first instead of type parameter definitions (#4553)
|
||||||
|
Stable style:
|
||||||
|
* Fix formatting cells in IPython notebooks with magic methods and starting or trailing
|
||||||
|
empty lines (#4484)
|
||||||
|
* Fix crash when formatting with statements containing tuple generators/unpacking
|
||||||
|
(#4538)
|
||||||
|
Preview style:
|
||||||
|
* Fix/remove string merging changing f-string quotes on f-strings with internal quotes
|
||||||
|
(#4498)
|
||||||
|
* Collapse multiple empty lines after an import into one (#4489)
|
||||||
|
* Prevent string_processing and wrap_long_dict_values_in_parens from removing
|
||||||
|
parentheses around long dictionary values (#4377)
|
||||||
|
* Move wrap_long_dict_values_in_parens from the unstable to preview style (#4561)
|
||||||
|
Packaging:
|
||||||
|
* Store license identifier inside the License-Expression metadata field, see
|
||||||
|
PEP 639. (#4479)
|
||||||
|
Performance:
|
||||||
|
* Speed up the is_fstring_start function in Black's tokenizer (#4541)
|
||||||
|
Integrations:
|
||||||
|
* If using stdin with --stdin-filename set to a force excluded path, stdin won't be
|
||||||
|
formatted. (#4539)
|
||||||
|
- update requirements from pyproject.toml
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Sep 27 01:22:37 UTC 2024 - Yogalakshmi Arunachalam <yarunachalam@suse.com>
|
||||||
|
|
||||||
|
- Update to 24.8.0
|
||||||
|
Stable style
|
||||||
|
* Fix crash when # fmt: off is used before a closing parenthesis
|
||||||
|
or bracket. (#4363)
|
||||||
|
Parser
|
||||||
|
* Fix regression where Black failed to parse a multiline f-string
|
||||||
|
containing another multiline string (#4339)
|
||||||
|
* Fix regression where Black failed to parse an escaped single
|
||||||
|
quote inside an f-string (#4401)
|
||||||
|
* Fix bug with Black incorrectly parsing empty lines with
|
||||||
|
a backslash (#4343)
|
||||||
|
* Fix bugs with Black's tokenizer not handling \{
|
||||||
|
inside f-strings very well (#4422)
|
||||||
|
* Fix incorrect line numbers in the tokenizer for certain
|
||||||
|
tokens within f-strings (#4423)
|
||||||
|
Performance
|
||||||
|
* Improve performance when a large directory is listed
|
||||||
|
in .gitignore (#4415)
|
||||||
|
Blackd
|
||||||
|
* Fix blackd (and all extras installs) for docker container (#4357)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Jul 21 16:03:44 UTC 2024 - Andrea Manzini <andrea.manzini@suse.com>
|
||||||
|
|
||||||
|
- update to 24.4.2
|
||||||
|
* Fix regression where certain complex f-strings failed to parse
|
||||||
|
* Fix bad performance on certain complex string literals
|
||||||
|
- update to 24.4.1
|
||||||
|
* Add support for the new Python 3.12 f-string syntax introduced by PEP 701
|
||||||
|
* Fix crash involving indented dummy functions containing newlines
|
||||||
|
* Add support for type parameter defaults, a new syntactic feature added
|
||||||
|
to Python 3.13 by PEP 696
|
||||||
|
- update to 24.4.0
|
||||||
|
* Fix unwanted crashes caused by AST equivalency check
|
||||||
|
* if guards in case blocks are now wrapped in parentheses when the line is too long.
|
||||||
|
* Stop moving multiline strings to a new line unless inside brackets
|
||||||
|
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Mar 17 19:11:13 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
Sun Mar 17 19:11:13 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-black
|
# spec file for package python-black
|
||||||
#
|
#
|
||||||
# Copyright (c) 2024 SUSE LLC
|
# Copyright (c) 2025 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@@ -16,50 +16,55 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%if 0%{?suse_version} > 1500
|
||||||
|
%bcond_without libalternatives
|
||||||
|
%else
|
||||||
|
%bcond_with libalternatives
|
||||||
|
%endif
|
||||||
|
|
||||||
%{?sle15_python_module_pythons}
|
%{?sle15_python_module_pythons}
|
||||||
Name: python-black
|
Name: python-black
|
||||||
Version: 24.3.0
|
Version: 25.1.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: A code formatter written in, and written for Python
|
Summary: A code formatter written in, and written for Python
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/psf/black
|
URL: https://github.com/psf/black
|
||||||
Source: https://files.pythonhosted.org/packages/source/b/black/black-%{version}.tar.gz
|
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
|
||||||
|
# PATCH-FIX-UPSTREAM update-PEP-701.patch gh#psf/black#4698 mcepl@suse.com
|
||||||
|
# Fix f-string format spec test failure
|
||||||
|
Patch1: update-PEP-701.patch
|
||||||
BuildRequires: %{python_module aiohttp >= 3.3.2}
|
BuildRequires: %{python_module aiohttp >= 3.3.2}
|
||||||
BuildRequires: %{python_module aiohttp_cors}
|
|
||||||
BuildRequires: %{python_module attrs >= 18.1.0}
|
|
||||||
BuildRequires: %{python_module base >= 3.8}
|
BuildRequires: %{python_module base >= 3.8}
|
||||||
BuildRequires: %{python_module click >= 8.0.0}
|
BuildRequires: %{python_module click >= 8.0.0}
|
||||||
BuildRequires: %{python_module hatch-fancy-pypi-readme}
|
BuildRequires: %{python_module hatch-fancy-pypi-readme}
|
||||||
BuildRequires: %{python_module hatch_vcs}
|
BuildRequires: %{python_module hatch_vcs}
|
||||||
BuildRequires: %{python_module hatchling >= 1.8.0}
|
BuildRequires: %{python_module hatchling >= 1.8.0}
|
||||||
BuildRequires: %{python_module mypy_extensions >= 0.4.3}
|
BuildRequires: %{python_module mypy_extensions >= 0.4.3}
|
||||||
BuildRequires: %{python_module packaging}
|
BuildRequires: %{python_module packaging >= 22.0}
|
||||||
BuildRequires: %{python_module pathspec >= 0.9.0}
|
BuildRequires: %{python_module pathspec >= 0.9.0}
|
||||||
BuildRequires: %{python_module pip}
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module platformdirs >= 2}
|
BuildRequires: %{python_module platformdirs >= 2}
|
||||||
BuildRequires: %{python_module pytest}
|
BuildRequires: %{python_module pytest}
|
||||||
BuildRequires: %{python_module tomli >= 1.1.0}
|
|
||||||
%if 0%{?suse_version} > 1500
|
|
||||||
BuildRequires: %{python_module typing_extensions >= 3.10.0.0 if %python-base < 3.11}
|
|
||||||
%endif
|
|
||||||
BuildRequires: %{python_module wheel}
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
Requires: python-aiohttp >= 3.3.2
|
Suggests: python-aiohttp >= 3.10.0
|
||||||
Requires: python-aiohttp_cors
|
|
||||||
Requires: python-attrs >= 18.1.0
|
|
||||||
Requires: python-click >= 8.0.0
|
Requires: python-click >= 8.0.0
|
||||||
Requires: python-mypy_extensions >= 0.4.3
|
Requires: python-mypy_extensions >= 0.4.3
|
||||||
Requires: python-packaging
|
Requires: python-packaging
|
||||||
Requires: python-pathspec >= 0.9.0
|
Requires: python-pathspec >= 0.9.0
|
||||||
Requires: python-platformdirs >= 2
|
Requires: python-platformdirs >= 2
|
||||||
Requires: python-tomli >= 1.1.0
|
|
||||||
|
%if %{with libalternatives}
|
||||||
|
BuildRequires: alts
|
||||||
|
Requires: alts
|
||||||
|
%else
|
||||||
Requires(post): update-alternatives
|
Requires(post): update-alternatives
|
||||||
Requires(postun): update-alternatives
|
Requires(postun): update-alternatives
|
||||||
BuildArch: noarch
|
|
||||||
%if 0%{?python_version_nodots} < 311
|
|
||||||
Requires: python-typing_extensions >= 3.10.0.0
|
|
||||||
%endif
|
%endif
|
||||||
|
BuildArch: noarch
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@@ -87,14 +92,18 @@ also recognizes YAPF's block comments to the same effect.
|
|||||||
|
|
||||||
%check
|
%check
|
||||||
# Copy one of the executable scripts into the PATH
|
# Copy one of the executable scripts into the PATH
|
||||||
mkdir ~/bin
|
mkdir -p ~/bin
|
||||||
cp $(ls %{buildroot}%{_bindir}/black-* | head -1) ~/bin/black
|
cp $(ls %{buildroot}%{_bindir}/black-* | head -1) ~/bin/black
|
||||||
export PATH=$PATH:~/bin
|
export PATH=$PATH:~/bin
|
||||||
|
|
||||||
# test_expression_diff - sometimes fails on async timing in OBS
|
# test_expression_diff - sometimes fails on async timing in OBS
|
||||||
# test_bpo_2142_workaround fails on arm
|
# test_bpo_2142_workaround fails on arm
|
||||||
skiptests="test_expression_diff or test_bpo_2142_workaround"
|
skiptests="test_expression_diff or test_bpo_2142_workaround"
|
||||||
%pytest -k "not ($skiptests)"
|
%pytest
|
||||||
|
|
||||||
|
%pre
|
||||||
|
# If libalternatives is used: Removing old update-alternatives entries.
|
||||||
|
%python_libalternatives_reset_alternative black
|
||||||
|
|
||||||
%post
|
%post
|
||||||
%python_install_alternative black blackd
|
%python_install_alternative black blackd
|
||||||
|
|||||||
37
update-PEP-701.patch
Normal file
37
update-PEP-701.patch
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
From ea716905a9d784734aa3f561a01f3447aaecd2ea Mon Sep 17 00:00:00 2001
|
||||||
|
From: GiGaGon <107241144+MeGaGiGaGon@users.noreply.github.com>
|
||||||
|
Date: Wed, 11 Jun 2025 10:50:20 -0700
|
||||||
|
Subject: [PATCH] Update pep_701.py
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/data/cases/pep_701.py | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
Index: black-25.1.0/tests/data/cases/pep_701.py
|
||||||
|
===================================================================
|
||||||
|
--- black-25.1.0.orig/tests/data/cases/pep_701.py 2020-02-02 01:00:00.000000000 +0100
|
||||||
|
+++ black-25.1.0/tests/data/cases/pep_701.py 2025-06-18 22:23:12.605019361 +0200
|
||||||
|
@@ -74,9 +74,9 @@
|
||||||
|
x = f"a{2+2:=^{foo(x+y**2):something else}one more}b"
|
||||||
|
f'{(abc:=10)}'
|
||||||
|
|
||||||
|
-f"This is a really long string, but just make sure that you reflow fstrings {
|
||||||
|
+f"""This is a really long string, but just make sure that you reflow fstrings {
|
||||||
|
2+2:d
|
||||||
|
-}"
|
||||||
|
+}"""
|
||||||
|
f"This is a really long string, but just make sure that you reflow fstrings correctly {2+2:d}"
|
||||||
|
|
||||||
|
f"{2+2=}"
|
||||||
|
@@ -213,9 +213,9 @@
|
||||||
|
x = f"a{2+2:=^{foo(x+y**2):something else}one more}b"
|
||||||
|
f"{(abc:=10)}"
|
||||||
|
|
||||||
|
-f"This is a really long string, but just make sure that you reflow fstrings {
|
||||||
|
+f"""This is a really long string, but just make sure that you reflow fstrings {
|
||||||
|
2+2:d
|
||||||
|
-}"
|
||||||
|
+}"""
|
||||||
|
f"This is a really long string, but just make sure that you reflow fstrings correctly {2+2:d}"
|
||||||
|
|
||||||
|
f"{2+2=}"
|
||||||
Reference in New Issue
Block a user