File polychromatic.spec of Package polychromatic

# Thanks to Son_Goku on #opensuse-buildservice (freenode) (https://paste.fedoraproject.org/516838/83214922/)
%{!?__python3: %global __python3 /usr/bin/python3}
%{!?python3_sitelib: %global python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python3_sitearch: %global python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?python3_version: %global python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])")}
%{!?python3_version_nodots: %global python3_version_nodots %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3].replace('.',''))")}
%{!?py3dir: %global py3dir %{_builddir}/python3-%{name}-%{version}-%{release}}
%{!?py3_build: %global py3_build CFLAGS="%{optflags}" %{__python3} setup.py build}
%{!?py3_install: %global py3_install %{__python3} setup.py install --skip-build --root %{buildroot}}

# TODO: Use %elif below once openSUSE stable supports this (15.4 doesn't)

%if 0%{?mageia}
# Mageia doesn't have typelib(AppIndicator3)
%global __requires_exclude typelib\\(AppIndicator3\\)
%endif

#define gitcommit 71244ffd267a30278878adffe0c92bee1af7d1c9

Name: polychromatic
Version: 0.9.5
Release: 1%{?dist}
Summary: RGB lighting management front-end application for OpenRazer

License: GPL-3.0
URL: https://github.com/polychromatic/polychromatic

%if 0%{?gitcommit:1}
Source0: https://github.com/polychromatic/polychromatic/archive/%{gitcommit}.tar.gz
%else
Source0: https://github.com/polychromatic/polychromatic/archive/v%{version}.tar.gz
%endif

BuildArch: noarch

Requires: python3
Requires: python3-colorama
Requires: python3-colour
Requires: python3-setproctitle
Requires: python3-requests
Requires: python3-openrazer
%if 0%{?mageia}
Requires: python3-qt6
%else
Requires: python3-PyQt6
%endif
%if 0%{?suse_version}
Requires: libQt6Svg6
%endif # TODO: %elif
%if 0%{?fedora}
Requires: qt6-qtsvg
%endif
%if 0%{?fedora}
Requires: python3-pyqt6-webengine
%endif # TODO: %elif
%if 0%{?mageia}
Requires: python3-qt6-webenginewidgets
%endif # TODO: %elif
%if 0%{?suse_version}
Requires: qt6-webengine
Requires: python3-PyQt6-WebEngine
%endif
%if 0%{?suse_version}
Requires: typelib(AppIndicator3)
%endif # TODO: %elif
%if 0%{?fedora}
Requires: libappindicator-gtk3
%endif
BuildRequires: rsync
BuildRequires: python3
BuildRequires: intltool
BuildRequires: meson

%description
RGB lighting management front-end application for OpenRazer with a
graphical, command line and tray applet interface.

%prep
%if 0%{?gitcommit:1}
%autosetup -n polychromatic-%{gitcommit}
%else
%autosetup -n polychromatic-%{version}
%endif

%build
%meson
%meson_build

%install
%meson_install

%find_lang polychromatic

%clean
rm -rf $RPM_BUILD_ROOT


%files -f polychromatic.lang
%defattr(-,root,root,-)
%{_sysconfdir}/xdg/autostart/polychromatic-autostart.desktop
%{_bindir}/polychromatic-*
%{_datadir}/applications/polychromatic.desktop
%{_datadir}/icons/hicolor/
%{_datadir}/polychromatic/
%{_datadir}/metainfo/
%{python3_sitelib}/polychromatic/
%{_mandir}/man1/polychromatic-*

%changelog
* Wed Feb 08 2017 Luca Weiss <luca@z3ntu.xyz> 0.3.6.1.git-1
- Initial RPM release
openSUSE Build Service is sponsored by