File catfish.spec of Package catfish

#
# spec file for package catfish
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define series 1.4
Name:           catfish
Version:        1.4.5
Release:        0
Summary:        Versatile File Searching Tool
License:        GPL-2.0-only
Group:          Productivity/File utilities
URL:            https://launchpad.net/catfish-search
Source:         https://launchpad.net/%{name}-search/%{series}/%{version}/+download/%{name}-%{version}.tar.gz
BuildRequires:  fdupes
# Needed for typelib() - Requires.
BuildRequires:  gobject-introspection
BuildRequires:  hicolor-icon-theme
BuildRequires:  intltool
BuildRequires:  python3-distutils-extra
# Checking module dependencies...
BuildRequires:  python3-gobject
BuildRequires:  python3-pexpect
BuildRequires:  python3-xml
BuildRequires:  typelib(Gtk) = 3.0
BuildRequires:  update-desktop-files
Requires:       findutils-locate
#uildRequires:  zeitgeist
# ...OK
Requires:       gdk-pixbuf-loader-rsvg
Requires:       gnome-icon-theme-symbolic
Requires:       gsettings-backend-dconf
Requires:       python3-cairo
Requires:       python3-gobject
Requires:       python3-gobject-Gdk
Requires:       python3-gobject-cairo
Requires:       python3-pexpect
Requires:       python3-xml
Requires:       sudo
Recommends:     %{name}-lang
Suggests:       zeitgeist
BuildArch:      noarch
%if 0%{?suse_version} >= 1550 || 0%{?sle_version} >= 150200
BuildRequires:  rsvg-convert
%else
BuildRequires:  rsvg-view
%endif

%description
Catfish is a GTK+ search utility written in python. It's search is powered
by find and locate, with search suggestions provided by zeitgeist.

%lang_package

%prep
%autosetup
grep -rl '^#!' | xargs sed -i '/^#!/s/env.*py.*/python3/'

%build
%py3_build

%install
#%%py3_install
python3 ./setup.py install -O1 \
    --prefix=%{_prefix} \
    --root=%{buildroot}
rm -rf %{buildroot}%{_datadir}/doc/%{name}
grep -rl '^#!' %{buildroot}%{python3_sitelib}/%{name}*/ | xargs chmod 0755
sed -i "s/\(Exec=\).*/\1%{name}/" %{buildroot}%{_datadir}/applications/%{name}.desktop
for i in 16 24 32 48; do
    install -dm 0755 %{buildroot}%{_datadir}/icons/hicolor/$i\x$i/apps
    rsvg-convert -h $i -w $i data/media/catfish.svg -o %{buildroot}%{_datadir}/icons/hicolor/$i\x$i/apps/%{name}.png
done
%suse_update_desktop_file -r %{name} GNOME Utility Filesystem

%find_lang %{name}

# Python byte compile.
pushd %{buildroot}%{python3_sitelib}/%{name}_lib/__pycache__
%py3_compile -O ..
popd
%fdupes %{buildroot}%{python3_sitelib}/%{name}_lib/__pycache__/

%files
%license COPYING
%doc AUTHORS ChangeLog README
%{_bindir}/%{name}
%{_datadir}/%{name}/
%dir %{_datadir}/metainfo
%{_datadir}/metainfo/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.??g
%{python3_sitelib}/%{name}
%{python3_sitelib}/%{name}_lib
%{python3_sitelib}/%{name}-%{version}-py%{py3_ver}.egg-info
%{_mandir}/man?/%{name}.?%{?ext_man}

%files lang -f %{name}.lang

%changelog
openSUSE Build Service is sponsored by