283051a
Name:           python-black
59c7d7f
Version:        24.1.1
f7653ce
Release:        %autorelease
33708b5
Summary:        The uncompromising code formatter
33708b5
License:        MIT
bd67c1e
URL:            https://github.com/psf/black
b55f0c8
Source:         %{pypi_source black}
0bc7fdd
33708b5
BuildArch:      noarch
aa60c12
0bc7fdd
BuildRequires:  python3-devel
33708b5
f0c2f90
# test requirements (upstream mixed with coverage, we hand-pick what we need only):
f0c2f90
BuildRequires:  python3-pytest
f0c2f90
4a42f16
# the black[jupyter] extra is allowed by default
4a42f16
# disable to avoid the ipython-black bootstrap loop
4a42f16
# note that tests/test_no_ipynb.py only runs without jupyter
4a42f16
# extra paranoid packagers can build this both with and without to run all tests
4a42f16
%bcond jupyter  1
4a42f16
7a9f4f4
# uvloop is sometimes not ready for new Python, e.g. https://bugzilla.redhat.com/2203920
7a9f4f4
%bcond uvloop   1
27b3868
27b3868
bd67c1e
%global _description %{expand:
33708b5
Black is the uncompromising Python code formatter. By using it, you agree to
33708b5
cease control over minutiae of hand-formatting. In return, Black gives you
33708b5
speed, determinism, and freedom from pycodestyle nagging about formatting.
bd67c1e
You will save time and mental energy for more important matters.}
bd67c1e
bd67c1e
%description %_description
bd67c1e
33708b5
283051a
%package -n     black
33708b5
Summary:        %{summary}
283051a
Recommends:     black+d = %{version}-%{release}
283051a
%py_provides    python3-black
a6dc783
40b498c
# The [python2] extra was removed in 22.1.0
40b498c
# This can be safely removed in Fedora 39+
283051a
Obsoletes:      black+python2 < 22.1.0
40b498c
283051a
%description -n black %_description
33708b5
33708b5
33708b5
%prep
283051a
%autosetup -n black-%{version} -p1
bd67c1e
bd0e874
bd67c1e
%generate_buildrequires
27b3868
%global extras_without_d colorama%{?with_jupyter:,jupyter}%{?with_uvloop:,uvloop}
f63ae5f
%pyproject_buildrequires -rx d,%{extras_without_d}
bd67c1e
33708b5
33708b5
%build
bd67c1e
%pyproject_wheel
bd67c1e
33708b5
33708b5
%install
bd67c1e
%pyproject_install
0bc7fdd
%pyproject_save_files 'black*' '_black*' blib2to3
bd67c1e
7ec1706
for exe in black blackd; do
0bc7fdd
  ln -sr %{buildroot}%{_bindir}/${exe}{,-%{python3_version}}
0bc7fdd
done
33708b5
bd67c1e
33708b5
%check
aa60c12
export PIP_INDEX_URL=http://host.invalid./
aa60c12
export PIP_NO_DEPS=yes
2602bf1
%pytest -Wdefault -rs --run-optional %{!?with_jupyter:no_}jupyter
bd67c1e
33708b5
283051a
%files -n black -f %{pyproject_files}
33708b5
%license LICENSE
33708b5
%doc README.md
33708b5
%{_bindir}/black
33708b5
%{_bindir}/black-%{python3_version}
bd67c1e
283051a
%pyproject_extras_subpkg -n black d
f0c2f90
%{_bindir}/blackd
f0c2f90
%{_bindir}/blackd-%{python3_version}
f0c2f90
283051a
%pyproject_extras_subpkg -n black %{extras_without_d}
f0c2f90
33708b5
33708b5
%changelog
f7653ce
%autochangelog