%global _empty_manifest_terminate_build 0
%define srcname fuzzyfinder
Name:		python-%{srcname}
Version:	2.3.0
Release:	1
Summary:	Fuzzy Finder implemented in Python.
License:	BSD-3-Clause
URL:		https://github.com/amjith/fuzzyfinder
Source0:	%{pypi_source %{srcname}} 
BuildArch:	noarch
BuildRequires:	python3-pip python3-wheel

%description
Fuzzy Finder implemented in Python.Matches partial string entries from a list of strings. Works similar to fuzzy finder in SublimeText and Vim’s Ctrl-P plugin.

%package -n python3-fuzzyfinder
Summary:	Fuzzy Finder implemented in Python.
Provides:	python-fuzzyfinder
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools

%description -n python3-fuzzyfinder
Fuzzy Finder implemented in Python.Matches partial string entries from a list of strings. Works similar to fuzzy finder in SublimeText and Vim’s Ctrl-P plugin.

%package help
Summary:	Development documents and examples for fuzzyfinder
Provides:	python3-fuzzyfinder-doc

%description help
Man pages and other related documents.

%prep
%autosetup -n fuzzyfinder-%{version}
# setuptools-scm cannot detect version from tarball, set it manually
cat > fuzzyfinder/_version.py << _EOF_
__version__ = "%{version}"
_EOF_
cat > setup.cfg << 'EOF'
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
EOF
sed -i 's/dynamic = \["version"\]/version = "%{version}"/' pyproject.toml
sed -i '/setuptools-scm/d' pyproject.toml

%build
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_build

%install
%pyproject_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-fuzzyfinder -f filelist.lst
%dir %{python3_sitelib}/*
%{python3_sitelib}/docs/__pycache__/*
%{python3_sitelib}/fuzzyfinder/__pycache__/*
%{python3_sitelib}/tests/__pycache__/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Fri Jun 26 2026 lichenguang <lichenguang@kylinos.cn> - 2.3.0-1
- Update to version 2.3.0
-  Type annotations added by @nacezavrtanik
-  Bugfix/makefile fix by @nacezavrtanik
-  Dependencies update by @nacezavrtanik
-  Documentation updates by @nacezavrtanik
-  Feature/highlight enhancement by @nacezavrtanik
-  mypy integrated into workflow by @nacezavrtanik

* Sun Dec 22 2024 sqfu <dev01203@linx-info.com> - 2.2.0-1
- update to 2.2.0
- ignore_case kwarg added to control case sensitivity
- enable syntax highlighting for python code snippet

* Tue May 10 2022 xigaoxinyan <xigaoxinyan@h-partners.com> - 2.1.0-2
- License compliance rectification

* Tue Jul 06 2021 Python_Bot <Python_Bot@openeuler.org> - 2.1.0-1
- Package Spec generated