File calise.spec of Package calise

%include %{_rpmconfigdir}/macros.python

%define name calise
%define version 0.4.2
%define unmangled_version 0.4.2
%define release 1

Summary: Automatically adjust backlight using the built-in camera
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{unmangled_version}.tar.gz
Source1: calise-rpmlintrc

PreReq:         %fillup_prereq
PreReq:         %insserv_prereq

License: GPL-3.0
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
Vendor: Nicolò Barbon <smilzoboboz@gmail.com>
Url: http://calise.sourceforge.net/
BuildRequires: systemd
BuildRequires: python-qt4 python-devel python-xdg dbus-1-python python-gobject2 python-Distutils2 python-distutils-extra gcc xorg-x11-libX11-devel python-devel kernel-devel intltool update-desktop-files kde4-filesystem fdupes

Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

Patch0: buildfix.diff


%description
Calise is a tool to adapt your screen's brightness to your environment by taking samples with your webcam.

%prep
%setup -n %{name}-%{unmangled_version}
%patch0 -p1

%build
env CFLAGS="$RPM_OPT_FLAGS" python setup.py build

%install
python setup.py install -O1 --root=$RPM_BUILD_ROOT

/usr/bin/install -c -D -m 644 other/systemd_scripts/calised.service $RPM_BUILD_ROOT/%{_unitdir}/calised.service

rm $RPM_BUILD_ROOT/%{_datadir}/doc/calise/README

%suse_update_desktop_file  -u -r %{name} System HardwareSettings

%fdupes $RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%pre
%service_add_pre calised.service

%post
%service_add_post calised.service

%preun
%service_del_preun calised.service

%postun
%service_del_postun calised.service


%files
%defattr(-,root,root)
%doc README udevrulegen.sh INSTALL tool/caliseProfileUpdater.py
%dir %{python_sitearch}/calise
%dir %{_datadir}/icons/hicolor/24x24
%dir %{_datadir}/icons/hicolor/24x24/apps
%config %{_sysconfdir}/dbus-1/system.d/org.calise.conf
%{_bindir}/calise
%{_bindir}/calised
%{_unitdir}/calised.service
%{python_sitearch}/calise-0.4.2-py2.7.egg-info
%{python_sitearch}/calise/*
%{_datadir}/applications/calise.desktop
%{_datadir}/icons/hicolor/16x16/apps/calise.png
%{_datadir}/icons/hicolor/22x22/apps/calise.png
%{_datadir}/icons/hicolor/24x24/apps/calise.png
%{_datadir}/icons/hicolor/32x32/apps/calise.png
%{_datadir}/icons/hicolor/48x48/apps/calise.png
%{_datadir}/icons/hicolor/scalable/apps/calise.svg
%{_datadir}/locale/it/LC_MESSAGES/calise.mo
%{_datadir}/man/man1/calise.1.gz
%{_datadir}/man/man1/calised.1.gz