File meteo-qt.spec of Package meteo-qt

#
# spec file for package meteo-qt
#
# 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/
#


%define aname meteo_qt
%define _iconsdir %{_datadir}/icons
Name:           meteo-qt
Version:        @SERVICE@
Release:        0
Summary:        Weather status system tray application
License:        GPL-3.0-only
Group:          Productivity/Graphics/Visualization/Other
URL:            https://github.com/dglent/meteo-qt
Source:         %{name}-%{version}.tar.xz
BuildRequires:  ImageMagick
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  libqt5-qttools-devel
BuildRequires:  python3-qt5-devel
BuildRequires:  python3-setuptools
BuildRequires:  update-desktop-files
BuildRequires:  cmake(Qt5LinguistTools)
Requires:       python3-lxml
Requires:       python3-qt5
Requires:       python3-sip
Requires:       python3-urllib3
Recommends:     %{name}-lang
BuildArch:      noarch
%if 0%{?suse_version} >= 1500
BuildRequires:  ImageMagick-config-7-SUSE
%endif

%description
A Qt system tray application for the weather status

%lang_package

%prep
%setup -q
sed -i 's/\(lrelease\)/\1-qt5/' setup.py
echo 'X-LXQt-Need-Tray=true' >> share/%{name}.desktop

%build
python3 setup.py build

%install
python3 setup.py install -O1 \
        --skip-build \
        --root=%{buildroot}
rm -rf %{buildroot}%{_datadir}/doc/%{name}
rm -f %{buildroot}%{_iconsdir}/%{name}.png
for i in 16 24 32; do
    install -dm 0755 %{buildroot}%{_iconsdir}/hicolor/$i\x$i/apps
    convert -scale $i\x$i %{aname}/images/%{name}.png %{buildroot}%{_iconsdir}/hicolor/$i\x$i/apps/%{name}.png
done
install -Dm 0644 %{aname}/images/%{name}.png %{buildroot}%{_iconsdir}/hicolor/48x48/apps/%{name}.png
#grep -rl '^#!' %%{buildroot}%%{python3_sitelib}/%%{aname}/ | xargs chmod 0755

%suse_update_desktop_file -r %{name} Qt System TrayIcon
%fdupes %{buildroot}%{_datadir}
%fdupes %{buildroot}%{python3_sitelib}/%{aname}

%find_lang %{name} --with-qt

%if 0%{?suse_version} < 1500
%post
%icon_theme_cache_post

%postun
%icon_theme_cache_postun
%endif

%files
%license LICENSE
%doc CHANGELOG README.md TODO
%{_bindir}/%{name}
%{_datadir}/%{aname}
%{_datadir}/applications/%{name}.desktop
%{_iconsdir}/hicolor/*/apps/%{name}.??g
%{python3_sitelib}/%{aname}/
%{python3_sitelib}/%{aname}-*-py%{py3_ver}.egg-info
%exclude %{_datadir}/%{aname}/translations/

%files lang -f %{name}.lang
%dir %{_datadir}/%{aname}/translations

%changelog
openSUSE Build Service is sponsored by