File meteo-qt.spec of Package meteo-qt
#
# spec file for package meteo-qt
#
# Copyright (c) 2015 SUSE LINUX Products 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 http://bugs.opensuse.org/
#
%define aname meteo_qt
%define _iconsdir /usr/share/icons
%if 0%{?sle_version} >= 150500 && 0%{?is_opensuse} || 0%{?suse_version} > 1600
%define pythons python311
%endif
Name: meteo-qt
Version: 3.4
Release: 0
License: GPL-3.0
Summary: Weather status system tray application
Url: https://github.com/dglent/meteo-qt
Group: Productivity/Graphics/Visualization/Other
Source: https://github.com/dglent/meteo-qt/archive/v%{version}.tar.gz
BuildRequires: libqt5-linguist-devel
BuildRequires: libqt5-qttools-devel >= 5.14
BuildRequires: %{python_module qt5-devel >= 3}
BuildRequires: %{python_module qt5-devel}
BuildRequires: %{python_module setuptools}
BuildRequires: ImageMagick
BuildRequires: hicolor-icon-theme
BuildRequires: update-desktop-files
BuildRequires: fdupes
Requires: %{python_flavor}-lxml
Requires: %{python_flavor}-qt5
Requires: %{python_flavor}-sip
Requires: %{python_flavor}-urllib3
Recommends: %{name}-lang
Recommends: libqt5-qttranslations
BuildRoot: %{_tmppath}/%{name}-%{version}-build
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
echo 'X-LXQt-Need-Tray=true' >> share/%{name}.desktop
%build
%python_build
%install
%python_install
rm -rf %{buildroot}%{_datadir}/doc/%{name}
rm -f %{buildroot}%{_iconsdir}/%{name}.png
# In newer version there it is called weather-few-clouds.png now
rm -f %{buildroot}%{_iconsdir}/weather-few-clouds.png
cp %{aname}/images/weather-few-clouds.png %{aname}/images/%{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} System Monitor
%fdupes %{buildroot}%{_datadir}
%fdupes %{buildroot}%{python_sitelib}/%{aname}
%find_lang %{name} --with-qt
%if %{?suse_version} < 1330
%post
%desktop_database_post
%icon_theme_cache_post
%endif
%if %{?suse_version} < 1330
%postun
%desktop_database_postun
%icon_theme_cache_postun
%endif
%files
%defattr(-,root,root)
%license LICENSE
%doc CHANGELOG README.md TODO
%{_bindir}/%{name}
%{_datadir}/%{aname}
%{_datadir}/applications/%{name}.desktop
%{_iconsdir}/hicolor/*/apps/%{name}.??g
%{python_sitelib}/%{aname}/
%{python_sitelib}/%{aname}-*-py*.egg-info
%exclude %{_datadir}/%{aname}/translations/
%if 0%{?sle_version} >= 150500 && 0%{?is_opensuse} || 0%{?suse_version} > 1600
%exclude %{python_sitelib}/%{aname}/translations/
%endif
%files lang -f %{name}.lang
%defattr(-,root,root)
%dir %{_datadir}/%{aname}/translations
%if 0%{?sle_version} >= 150500 && 0%{?is_opensuse} || 0%{?suse_version} > 1600
%dir %{python_sitelib}/%{aname}
%dir %{python_sitelib}/%{aname}/translations
%endif