File dupeguru.spec of Package dupeguru

#
# spec file for package dupeguru
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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/
#


Name:           dupeguru
Version:        4.0.4
Release:        0
Summary:        Duplicate Files Finder
License:        GPL-3.0-only
Group:          Productivity/File utilities
URL:            https://dupeguru.voltaicideas.net/
# hscommon and qtlib source is missing in dupeguru's tar file from archive
Source0:        https://github.com/arsenetar/dupeguru/archive/%{version}/%{name}-%{version}.tar.gz
# hscommon and qtlib source is missing in dupeguru's tar file from archive
Source1:        https://github.com/arsenetar/dupeguru/releases/download/%{version}/dupeguru-src-%{version}_RC.tar.gz
BuildRequires:  ImageMagick
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  python-qt5-utils
BuildRequires:  python3-Send2Trash >= 1.3.0
BuildRequires:  python3-Sphinx
BuildRequires:  python3-hsaudiotag3k
BuildRequires:  python3-polib
BuildRequires:  python3-qt5-devel
BuildRequires:  python3-pytest
BuildRequires:  python3-pytest-monkeyplus
BuildRequires:  python3-flake8
Requires:       python3-Send2Trash >= 1.3.0
Requires:       python3-hsaudiotag3k
Requires:       python3-jobprogress
Requires:       python3-polib
Requires:       python3-qt5
Requires:       python3-xml
Provides:       dupeguru-me = %{version}
Provides:       dupeguru-pe = %{version}
Obsoletes:      dupeguru-me < 4.0.3
Obsoletes:      dupeguru-pe < 4.0.3

%description
dupeGuru is a tool to find duplicate files on your computer. It can scan
either filenames or contents. The filename scan features a fuzzy matching
algorithm that can find duplicate filenames even when they are not exactly
the same.

dupeGuru is good with music. It has a special Music mode that can scan tags
and shows music-specific information in the duplicate results window.

dupeGuru is good with pictures. It has a special Picture mode that can scan
pictures fuzzily, allowing you to find pictures that are similar, but not
exactly the same.

%prep
%setup -q -n %{name}-%{version}
%setup -T -D -a 1
###rm -rf hscommon
###mv hscommon-a56aee2f08becba9b968ff96caa3a7f6651a4c74 hscommon

%build
export NO_VENV=true
make %{?_smp_mflags} 

%install
# Create a correct desktop file.
cat > %{name}.desktop << EOF
[Desktop Entry]
Name=dupeGuru
GenericName=Duplicate Files Finder
GenericName[ru]=Поиск одинаковых файлов
Comment=Find duplicate files
Comment[ru]=Поиск одинаковых файлов
Type=Application
Exec=dupeguru
Icon=dupeguru
Categories=System;Utility;Filesystem;
Terminal=false
StartupNotify=true
EOF

# Main install.
install -dm 0755 %{buildroot}{%{_bindir}/,%{python3_sitearch}/%{name}/}
cp -R {core,hscommon,locale,qt,qtlib} \
     %{buildroot}%{python3_sitearch}/%{name}/
install -m0755 run.py %{buildroot}%{python3_sitearch}/%{name}/

# Create a link in bindir.
ln -s %{python3_sitearch}/%{name}/run.py %{buildroot}%{_bindir}/%{name}

# Remove unneeded.
rm -rf %{buildroot}%{python3_sitearch}/%{name}/qtlib/.tx/
rm -rf %{buildroot}%{python3_sitearch}/%{name}/qtlib/locale/
find %{buildroot}%{python3_sitearch}/%{name}/ -type f -name ".gitignore" -delete
find %{buildroot}%{python3_sitearch}/%{name}/ -type f -name "*.c" -delete
find %{buildroot}%{python3_sitearch}/%{name}/ -type f -name "*.h" -delete
find %{buildroot}%{python3_sitearch}/%{name}/ -type f -name "*.po" -delete
find %{buildroot}%{python3_sitearch}/%{name}/ -type f -name "*.pot" -delete

# Python byte compile.
pushd %{buildroot}%{python3_sitearch}/%{name}/
%py3_compile .
popd

# Install icons of various sizes.
install -Dm 644 images/dgse_logo_128.png \
    %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/%{name}.png
for size in 96x96 64x64 48x48 32x32 22x22 16x16 ; do
install -dm 0755 \
    %{buildroot}%{_datadir}/icons/hicolor/${size}/apps
convert -strip -resize ${size} images/dgse_logo_128.png \
    %{buildroot}%{_datadir}/icons/hicolor/${size}/apps/%{name}.png
done

# Install a desktop file.
install -Dm 644 %{name}.desktop \
    %{buildroot}%{_datadir}/applications/%{name}.desktop

# Find duplicate files.
%fdupes -s %{buildroot}

# Find locales.
%find_lang columns
%find_lang core
%find_lang ui

%if 0%{?suse_version} && 0%{?suse_version} < 1330
%post
%icon_theme_cache_post

%postun
%icon_theme_cache_postun
%endif

%files -f columns.lang -f core.lang -f ui.lang
%license LICENSE
%doc CREDITS README.md
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/*/%{name}.*
%{python3_sitearch}/%{name}/

%changelog
openSUSE Build Service is sponsored by