%global pypi_name ruff

Name:           python-%{pypi_name}
Version:        0.11.10
Release:        2
Summary:        An extremely fast Python linter, written in Rust.
License:        MIT
URL:            https://github.com/astral-sh/ruff
Source0:        %{pypi_source}
Source1:        cargo-vendor-cache
Patch1:         0001-set-cargo-vendor-cache-for-local-build.patch

BuildRequires:  rust-packaging
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-pip
BuildRequires:  python3-wheel
BuildRequires:	python3-hatchling
BuildRequires:	python3-maturin

%description
An extremely fast Python linter, written in Rust.

%package -n     python3-%{pypi_name}
Summary:        %{summary}
Provides:       python-ruff = %{version}-%{release}
%description -n python3-%{pypi_name}
An extremely fast Python linter, written in Rust.


%prep
%autosetup -p1 -n %{pypi_name}-%{version}
tar xzvf %{SOURCE1} -C .

%build
export RUSTFLAGS="%{build_rustflags}"
%pyproject_build

%install
%pyproject_install

rm -f %{buildroot}%{python3_sitearch}/rust-toolchain.toml

%files -n python3-%{pypi_name}
%doc README.md
%license LICENSE
%{_bindir}/ruff
%{python3_sitearch}/%{pypi_name}
%{python3_sitearch}/%{pypi_name}*.dist-info/

%changelog
* Sat Aug 01 2026 Funda Wang <fundawang@yeah.net> - 0.11.10-2
- drop useless rust-toolchain.toml

* Mon May 19 2025 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 0.11.10-1
- Update package with version 0.11.10
  Implement a recursive check for RUF060
  Default to latest supported Python version for version-related syntax errors
  Implement deferred annotations for Python 3.14
  Add new rule in-empty-collection (RUF060)
  Make duplicate parameter names a semantic error
  Avoid adding whitespace to the end of a docstring after an escaped quote
  Implement invalid-rule-code as RUF102
  Support slices in RUF005

* Thu Oct 24 2024 Dongxing Wang <dongxing.wang_a@thundersoft.com> - 0.7.0-1
- Update package to version 0.7.0
  Add support for extensionless Python files for server
  Fix configuration inheritance for configurations specified in the LSP settings
  Fix placement of inline parameter comments
  Add a subcommand to generate dependency graphs
  Add Python version support to ruff analyze CLI
  Add exclude support to ruff analyze
  Fix parentheses around return type annotations
  Fix codeblock dynamic line length calculation for indented docstring examples
  Refurb implement hardcoded-string-charset
  Refurb Count codepoints not bytes for slice-to-remove-prefix-or-suffix

* Wed Mar 27 2024 GuoCe <guoce@kylinos.cn> - 0.3.4-1
- Update package to version 0.3.4
- Add yaml file

* Fri Mar 15 2024 jiangxinyu <jiangxinyu@kylinos.cn> - 0.3.2-1
- Update package to version 0.3.2
- Fix trailing kwargs end of line comment after slash

* Sun Jul 2 2023 Dongxing Wang <dxwangk@isoftstone.com> - 0.0.276-1
- Initial package