forked from pool/python-black
Compare commits
9 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| fd3f5314f8 | |||
| 00b5fcb8c1 | |||
| 67f07faedc | |||
| 12dbb9a243 | |||
| 4de8aee8eb | |||
| 2538c47b8f | |||
| 26ca7ee935 | |||
| cf2dc2d33c | |||
| 93edfe795b |
BIN
black-24.4.2.tar.gz
LFS
BIN
black-24.4.2.tar.gz
LFS
Binary file not shown.
BIN
black-25.1.0.tar.gz
LFS
Normal file
BIN
black-25.1.0.tar.gz
LFS
Normal file
Binary file not shown.
213
click-820.patch
Normal file
213
click-820.patch
Normal file
@@ -0,0 +1,213 @@
|
||||
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."""
|
||||
@@ -1,18 +1,95 @@
|
||||
-------------------------------------------------------------------
|
||||
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
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* Stop moving multiline strings to a new line unless inside brackets
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# 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
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -16,50 +16,52 @@
|
||||
#
|
||||
|
||||
|
||||
%if 0%{?suse_version} > 1500
|
||||
%bcond_without libalternatives
|
||||
%else
|
||||
%bcond_with libalternatives
|
||||
%endif
|
||||
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-black
|
||||
Version: 24.4.2
|
||||
Version: 25.1.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 aiohttp_cors}
|
||||
BuildRequires: %{python_module attrs >= 18.1.0}
|
||||
BuildRequires: %{python_module base >= 3.8}
|
||||
BuildRequires: %{python_module click >= 8.0.0}
|
||||
BuildRequires: %{python_module hatch-fancy-pypi-readme}
|
||||
BuildRequires: %{python_module hatch_vcs}
|
||||
BuildRequires: %{python_module hatchling >= 1.8.0}
|
||||
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 pip}
|
||||
BuildRequires: %{python_module platformdirs >= 2}
|
||||
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: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-aiohttp >= 3.3.2
|
||||
Requires: python-aiohttp_cors
|
||||
Requires: python-attrs >= 18.1.0
|
||||
Suggests: python-aiohttp >= 3.10.0
|
||||
Requires: python-click >= 8.0.0
|
||||
Requires: python-mypy_extensions >= 0.4.3
|
||||
Requires: python-packaging
|
||||
Requires: python-pathspec >= 0.9.0
|
||||
Requires: python-platformdirs >= 2
|
||||
Requires: python-tomli >= 1.1.0
|
||||
|
||||
%if %{with libalternatives}
|
||||
BuildRequires: alts
|
||||
Requires: alts
|
||||
%else
|
||||
Requires(post): update-alternatives
|
||||
Requires(postun): update-alternatives
|
||||
BuildArch: noarch
|
||||
%if 0%{?python_version_nodots} < 311
|
||||
Requires: python-typing_extensions >= 3.10.0.0
|
||||
%endif
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
@@ -87,15 +89,21 @@ also recognizes YAPF's block comments to the same effect.
|
||||
|
||||
%check
|
||||
# Copy one of the executable scripts into the PATH
|
||||
mkdir ~/bin
|
||||
mkdir -p ~/bin
|
||||
cp $(ls %{buildroot}%{_bindir}/black-* | head -1) ~/bin/black
|
||||
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)"
|
||||
|
||||
%pre
|
||||
# If libalternatives is used: Removing old update-alternatives entries.
|
||||
%python_libalternatives_reset_alternative black
|
||||
|
||||
%post
|
||||
%python_install_alternative black blackd
|
||||
|
||||
|
||||
Reference in New Issue
Block a user