File ayatana-settings.spec of Package ayatana-settings

#
# spec file for package ayatana-settings
#
# Copyright (c) 2022-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 http://bugs.opensuse.org/
#

# Compatibility with *SuSE 15.
%if 0%{suse_version} && 0%{suse_version} < 1550
%define python_compileall \
%{python_expand for d in %{buildroot}%{$python_sitelib} %{buildroot}%{$python_sitearch}; do \
  if [ -d $d ]; then \
    find $d -name '*.pyc' -delete; \
    $python -m compileall $d; \
    $python -O -m compileall $d; \
  fi; \
done \
} \
%{nil}
%endif

%define skip_python2  1

Name:             ayatana-settings
Version:          23.10.13
Release:          0
Summary:          Ayatana Indicators Settings
License:          GPL-3.0-only
Group:            System/GUI/Other
URL:              https://github.com/AyatanaIndicators/ayatana-settings
Source0:          https://github.com/AyatanaIndicators/ayatana-settings/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:          %{name}-rpmlintrc
BuildArch:        noarch
BuildRequires:    python-rpm-macros
BuildRequires:    fdupes
# For directory owning.
BuildRequires:    hicolor-icon-theme
BuildRequires:    %{python_module setuptools}
BuildRequires:    %{python_module polib}
# For testing. Disabled, since tests are not yet provided.
# If re-enabling, remember to remove the percent escape.
#BuildRequires:   %%{python_module pytest}
Requires:         python-psutil
Requires:         ayatana-settings-common
Requires(post):   update-alternatives
Requires(postun): update-alternatives
%if "%{python_flavor}" == "python3" || "%{python_provides}" == "python3"
Provides:         ayatana-settings = %{version}-%{release}
Obsoletes:        ayatana-settings < %{version}-%{release}
%endif
Recommends:       ayatana-settings-lang

%python_subpackages

%description
Ayatana Settings allows you to configure all your Ayatana system
indicators.

%package -n ayatana-settings-common
Summary:          Common files for %{name}

%description -n ayatana-settings-common
Ayatana Settings allows you to configure all your Ayatana system
indicators.

This package contains common files for ayatana-settings.

%lang_package -n ayatana-settings

%prep
%setup -q

# Remove hashbangs on scripts installed into sitelib.
find 'ayatanasettings' -type 'f' -iname '*.py' -exec sed -i -e '0,/^\s*#!\s*\/.*$/d' '{}' '+'

# Also remove executable flags.
find 'ayatanasettings' -type 'f' -iname '*.py' -exec chmod -x '{}' '+'

%build
%python_build

%install
%python_install
%python_compileall
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_clone -a %{buildroot}%{_bindir}/ayatana-settings
%python_clone -a %{buildroot}%{_mandir}/man8/ayatana-settings.8

%find_lang %{name}

# Disabled, package does not provide tests yet.
#%%check
#%%pytest_arch

%post
%{python_install_alternative ayatana-settings ayatana-settings.8%{ext_man} }

%postun
%python_uninstall_alternative ayatana-settings

%files %{python_files}
%license COPYING
%python_alternative %{_bindir}/ayatana-settings
%python_alternative %{_mandir}/man8/ayatana-settings.8%{ext_man}
%{python_sitelib}/ayatanasettings
%{python_sitelib}/ayatana_settings-%{version}*-info

%files -n ayatana-settings-common
%license COPYING
%doc AUTHORS ChangeLog README.md
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/applications/ayatana-settings.desktop
%{_datadir}/ayatana-settings/

%files -n ayatana-settings-lang -f %{name}.lang

%changelog
openSUSE Build Service is sponsored by