%global _empty_manifest_terminate_build 0
%global pypi_name black

Name:           python-%{pypi_name}
Version:        25.1.0
Release:        2
Summary:        The uncompromising code formatter
License:        MIT
URL:            https://github.com/psf/black
Source0:        %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
Patch0:         backport-CVE-2026-32274.patch

BuildArch:      noarch

BuildRequires:  python3-devel

# Base build requires
BuildRequires:	python3-setuptools
BuildRequires:	python3-setuptools_scm	
BuildRequires:	python3-pip
BuildRequires:	python3-wheel
BuildRequires:	python3-hatch-vcs
BuildRequires:	python3-hatchling
BuildRequires:	python3-hatch-fancy-pypi-readme

%global _description %{expand:
Black is the uncompromising Python code formatter. By using it, you agree to
cease control over minutiae of hand-formatting. In return, Black gives you
speed, determinism, and freedom from pycodestyle nagging about formatting.
You will save time and mental energy for more important matters.}

%description %_description


%package -n     python3-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}

%description -n python3-%{pypi_name} %_description

%prep
%autosetup -p1 -n %{pypi_name}-%{version}

%build
%pyproject_build

%install
%pyproject_install

for exe in black blackd; do
  ln -sr %{buildroot}%{_bindir}/${exe}{,-%{python3_version}}
done

%files -n python3-%{pypi_name}
%license LICENSE
%doc README.md
%{_bindir}/black
%{_bindir}/black-%{python3_version}
%{_bindir}/blackd
%{_bindir}/blackd-%{python3_version}
%{python3_sitelib}/_black_version.py
%{python3_sitelib}/__pycache__/*
%{python3_sitelib}/black*
%{python3_sitelib}/blib2to3/*

%changelog
* Mon Jun 15 2026 infra_team <zhaiwenjie1@huawei.com> - 25.1.0-2
- fix CVE: CVE-2026-32274
- Prevent path traversal in cache file names from --python-cell-magics option
- Fix Jupyter notebook magic masking collisions that could corrupt cells

* Wed May 14 2025 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 25.1.0-1
- Update package to version 25.1.0
  Normalize casing of Unicode escape characters in strings to lowercase
  Fix inconsistencies in whether certain strings are detected as docstrings
  Consistently add trailing commas to typed function parameters
  Remove redundant parentheses in if guards for case blocks
  Add parentheses to if clauses in case blocks when the line is too long
  Whitespace before # fmt: skip comments is no longer normalized
  Fix line length computation for certain expressions that involve the power operator
  Check if there is a newline before the terminating quotes of a docstring
  Fix type annotation spacing between * and more complex type variable tuple

* Mon Oct 21 2024 jiangxinyu <jiangxinyu@kylinos.cn> - 24.10.0-1
- Update package to version 24.10.0
- Fix crashes involving comments in parenthesised return types or X | Y style unions
  Fix bug where the cache was shared between runs with and without --unstable

* Fri Sep 6 2024 wuzhaomin <wuzhaomin@kylinos.cn> - 24.8.0-1
- update version to 24.8.0
- Fix another f-string regression (#4339)
- Add caution to the playground mention (#4352)
- Fix use of deprecated ast.Str (#4393)
- Fix wheel build by using newer manylinux image (#4394)
- fix: avoid formatting backslash strings inside f-strings (#4401)
- Fix incorrect linenos on fstring tokens with escaped newlines (#4423) 

* Sat May 11 2024 wangxiaomeng <wangxiaomeng@kylinos.cn> - 24.4.2-1
- Update package to version 24.4.2
  - Fix regression where certain complex f-strings failed to parse (#4332)
  - Fix bad performance on certain complex string literals (#4331)
  - Add support for the new Python 3.12 f-string syntax introduced by PEP 701 (#3822)
  - Fix crash involving indented dummy functions containing newlines (#4318)
  - Add support for type parameter defaults, a new syntactic feature added to Python 3.13 by PEP 696 (#4327)
  - Fix unwanted crashes caused by AST equivalency check (#4290)
  - Fix catastrophic performance on docstrings that contain large numbers of leading tab characters. This fixes CVE-2024-21503.

* Wed Apr 17 2024 yanjianqing <yanjianqing@kylinos.cn> - 24.2.0-2
- Fix CVE-2024-21503

* Fri Feb 23 2024 chendexi <chendexi@kylinos.cn> - 24.2.0-1
- Update package to version 24.2.0

* Mon Jul 10 2023 Dongxing Wang <dxwangk@isoftstone.com> - 23.3.0-5
- Add the black extra package file list

* Fri Jul 7 2023 Dongxing Wang <dxwangk@isoftstone.com> - 23.3.0-4
- Fix the black package name

* Wed Jul 5 2023 li-miaomiao_zhr <mmlidc@isoftstone.com> - 23.3.0-3
- Change the software packaging name to "python3 black"

* Mon Jun 26 2023 li-miaomiao_zhr <mmlidc@isoftstone.com> - 23.3.0-2
- add dependency of python-hatch-fancy-pypi-readme

* Mon Jun 19 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 23.11.0-1
- Update package to version 23.11.0

* Wed Jun 7 2023 li-miaomiao_zhr <mmlidc@isoftstone.com> - 23.3.0-1
- fix issue:add package python-black of version 23.3.0 to warehouse of src-openEuler