File meteo-qt.spec of Package meteo-qt

#
# spec file for package meteo-qt
#
# Copyright (c) 2023 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 aname meteo_qt
%define _iconsdir %{_datadir}/icons
Name:           meteo-qt
Version:        @SERVICE@
Release:        0
Summary:        Weather status system tray application
License:        GPL-3.0-or-later
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-linguist-devel
BuildRequires:  libqt5-qttools-devel
BuildRequires:  python3-qt5-devel
BuildRequires:  python3-setuptools
BuildRequires:  update-desktop-files
Requires:       python3-lxml
Requires:       python3-qt5
Requires:       python3-sip
Requires:       python3-urllib3
Recommends:     %{name}-lang
BuildArch:      noarch

%description
A Qt system tray application for the weather status

%lang_package

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

%build
%python3_build

%install
%python3_install
rm -rfv %{buildroot}%{_datadir}/doc/%{name}
rm -fv %{buildroot}%{_iconsdir}/weather-few-clouds.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/weather-few-clouds.png %{buildroot}%{_iconsdir}/hicolor/$i\x$i/apps/%{name}.png
done
install -Dm 0644 %{aname}/images/weather-few-clouds.png %{buildroot}%{_iconsdir}/hicolor/48x48/apps/%{name}.png

%suse_update_desktop_file -r %{name} Utility DesktopUtility
%fdupes -s %{buildroot}

%find_lang %{name} --with-qt

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

%files lang -f %{name}.lang
%dir %{_datadir}/%{aname}
%dir %{_datadir}/%{aname}/translations
%if 0%{?suse_version} >= 1550
%dir %{python3_sitelib}/%{aname}
%dir %{python3_sitelib}/%{aname}/translations
%endif

%changelog
openSUSE Build Service is sponsored by