%global python3_pkgversion 3.11 %global pypiname Send2Trash Name: python-send2trash Version: 1.8.2 Release: 2.ac17.py3.11%{?dist} Summary: Python library to natively send files to Trash License: BSD-3-Clause URL: https://github.com/hsoft/send2trash # PyPI sdist lacks tests Source0: %url/archive/%{version}/%{pypiname}-%{version}.tar.gz BuildArch: noarch BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-pytest %description Send2Trash is a small package that sends files to the Trash (or Recycle Bin) natively and on all platforms. On OS X, it uses native FSMoveObjectToTrashSync Cocoa calls, on Windows, it uses native (and ugly) SHFileOperation win32 calls. On other platforms, if PyGObject and GIO are available, it will use this. Otherwise, it will fallback to its own implementation of the trash specifications from freedesktop.org. %package -n python%{python3_pkgversion}-send2trash Summary: Python library to natively send files to Trash Provides: python3-%{pypiname} == %{version}-%{release} %{?python_provide:%python_provide python3-%{pypiname}} %{?python_provide:%python_provide python3-send2trash} %description -n python%{python3_pkgversion}-send2trash Send2Trash is a small package that sends files to the Trash (or Recycle Bin) natively and on all platforms. On OS X, it uses native FSMoveObjectToTrashSync Cocoa calls, on Windows, it uses native (and ugly) SHFileOperation win32 calls. On other platforms, if PyGObject and GIO are available, it will use this. Otherwise, it will fallback to its own implementation of the trash specifications from freedesktop.org. %generate_buildrequires %pyproject_buildrequires %prep %setup -q -n send2trash-%{version} %build %pyproject_wheel %install %pyproject_install %pyproject_save_files send2trash %check %pytest for b in $(find %{buildroot}%{_bindir}/ -type f) ; do mv "$b" $(sed -re "s|(.*)$|\1-%{python3_pkgversion}|"<<<"$b"); done for m in $(find %{buildroot}%{_mandir}/ -type f) ; do mv "$m" $(sed -re "s|(.*).([1-8])(.*)$|\1-%{python3_pkgversion}.\2\3|"<<<"$m"); done for m in $(find %{buildroot}%{_datadir}/locale/* -type f) ; do mv "$m" $(sed -re "s|(.*).mo$|\1-%{python3_pkgversion}.mo|"<<<"$m"); done for l in $(find %{buildroot}/usr/lib64/lib* -type f -o -type l) ; do mv "$l" $(sed -re "s|(.*).so(.*)$|\1-py%{python3_pkgversion}.so\2|"<<<"$l"); done for p in $(find %{buildroot}/usr/lib64/pkgconfig/* -type f) ; do mv "$p" $(sed -re "s|(.*).pc$|\1-py%{python3_pkgversion}.pc|"<<<"$p"); done %files -n python%{python3_pkgversion}-send2trash -f %{pyproject_files} %doc README.rst CHANGES.rst %{_bindir}/send2trash-%{python3_pkgversion} %changelog * Sat May 25 2024 Ding-Yi Chen - 1.8.2-2.ac17.py3.11 - Cut corner packaging