File gis-weather.spec of Package gis-weather

#
# spec file for package gis-weather
#
# 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/
#


Name:           gis-weather
Version:        @SERVICE@
Release:        0
Summary:        Customizable weather widget
License:        GPL-3.0-only
Group:          Productivity/Graphics/Visualization/Graph
URL:            https://github.com/RingOV/gis-weather
Source:         %{name}-%{version}.tar.xz
Source1:        %{name}-rpmlintrc
BuildRequires:  dos2unix
BuildRequires:  fdupes
# Needed for typelib() - Requires.
BuildRequires:  gobject-introspection
BuildRequires:  hicolor-icon-theme
BuildRequires:  icoutils
BuildRequires:  update-desktop-files
Requires:       python3-cairo
Requires:       python3-gobject-cairo
Requires:       python3-gobject-Gdk
BuildArch:      noarch

%description
Customizable weather widget.
Features
  * View weather for several days
  * Detailed weather forecast for today and tomorrow
  * Fast switching between cities
  * Select the background and theme weather icons
  * "Compass" with the wind direction, with adjustable angle of rotation
  * Highlighting the high wind
  * Support weather services:
    * Gismeteo.com
    * AccuWeather.com
    * OpenWeatherMap.org
    * Yr.no
  * Support SVG and widget scale
  * Indicator to panel
  * Presets

%prep
%setup -q
find themes -type f -perm 0755 -print -exec chmod 0644 {} \;

%build

%install
cat > %{name} <<-EOF
#!/bin/sh
exec python3 /usr/share/%{name}/%{name}.py \$*
EOF
install -Dm 0755 %{name} %{buildroot}%{_bindir}/%{name}
install -dm 0755 %{buildroot}%{_datadir}/%{name}
echo rpm > %{buildroot}%{_datadir}/%{name}/package
cp -a {dialogs,%{name}.py,i18n,icon.png,services,themes,utils} %{buildroot}%{_datadir}/%{name}/

# non-executable-script
grep -rl '^#!/' %{buildroot}%{_datadir}/%{name}/ | xargs chmod 0755
# env-script-interpreter
grep -rl '^#!/' %{buildroot}%{_datadir}/%{name}/ | xargs sed -i '/^#!/s/env.*py.*/python3/'
# wrong-script-end-of-line-encoding
dos2unix -v -o %{buildroot}%{_datadir}/%{name}/dialogs/settings_dialog.py

icotool -x icon.ico
for i in 16 32 48 64 128 ; do
  install -Dm 0644 icon_*_$i\x$i\x32.png %{buildroot}%{_datadir}/icons/hicolor/$i\x$i/apps/%{name}.png
done

%fdupes %{buildroot}%{_datadir}/%{name}
%suse_update_desktop_file -c %{name} "Gis Weather" "Customizable weather widget" %{name} %{name}
%suse_update_desktop_file -r -C "Weather widget" %{name} GTK GNOME Utility DesktopUtility

%files
%doc README.md
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/%{name}
%{_datadir}/icons/hicolor/*/apps/%{name}.??g

%changelog
openSUSE Build Service is sponsored by