%global with_python3 0%{?fedora} >= 17 %global commit 5b281884e5e4016becae7f5119c61ff09c864f59 %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: python-evdev Version: 0.4.1 Release: 1%{?dist} Summary: Python bindings for the Linux input handling subsystem License: BSD URL: http://pythonhosted.org/evdev/ Source0: https://github.com/gvalkov/%{name}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz Group: Development/Libraries BuildRequires: python2-devel python-setuptools kernel-headers python-sphinx %if 0%{?with_python3} BuildRequires: python3-devel python3-setuptools %endif %description Python-evdev provides bindings to the generic input event interface in Linux. The evdev interface serves the purpose of passing events generated in the kernel directly to userspace through character devices that are typically located in /dev/input/. Python-evdev also comes with bindings to uinput, the userspace input subsystem. Uinput allows userspace programs to create and handle input devices from which input events can be directly injected into the input subsystem. %if 0%{?with_python3} %package -n python3-evdev Summary: Python 3.x bindings for the Linux input handling subsystem Group: Development/Libraries %description -n python3-evdev Python-evdev provides bindings to the generic input event interface in Linux. The evdev interface serves the purpose of passing events generated in the kernel directly to userspace through character devices that are typically located in /dev/input/. Python-evdev also comes with bindings to uinput, the userspace input subsystem. Uinput allows userspace programs to create and handle input devices from which input events can be directly injected into the input subsystem. %endif %prep %setup -q -n %{name}-%{commit} %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} %endif %build CFLAGS="%{optflags}" %{__python} setup.py build # sphinx.autodoc must be able to import our newly built extension modules # and setting PYTHONPATH doesn't cut it for some reason bdir=$(readlink -f $(ls -1d build/lib.*/evdev/../)) sed -i -e "/sys.path.insert.*/a sys.path.insert(0, \"$bdir\")" doc/conf.py make -C doc/ text %if 0%{?with_python3} pushd %{py3dir} CFLAGS="%{optflags}" %{__python3} setup.py build popd %endif %install %{__python} setup.py install -O1 --skip-build --root %{buildroot} %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root %{buildroot} popd %endif %files %doc README.rst LICENSE bin/evtest.py %doc doc/_build/text/{index,moduledoc}.txt %{python_sitearch}/* %if 0%{?with_python3} %files -n python3-evdev %doc README.rst LICENSE bin/evtest.py %doc doc/_build/text/{index,moduledoc}.txt %{python3_sitearch}/* %endif %changelog * Wed Jul 24 2013 Georgi Valkov - 0.4.1-1 - Initial version