%global with_python3 0%{?fedora} >= 17 %global commit 2120a4884086b30a18aa12460ce618fbd7219943 %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: python-evdev Version: 0.4.6 Release: 1%{?dist} Summary: Python bindings to the Linux input handling subsystem License: BSD URL: http://python-evdev.readthedocs.org/en/latest/ 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 This package 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/`` This package also comes with bindings to *uinput*, the userspace input subsystem. *Uinput* allows userspace programs to create and handle input devices that can inject events directly 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 This package 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/`` This package also comes with bindings to *uinput*, the userspace input subsystem. *Uinput* allows userspace programs to create and handle input devices that can inject events directly into the input subsystem. %endif %prep %setup -q -n %{name}-%{commit} %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} %endif %build #----------------------------------------------------------------------------- # Build extension modules CFLAGS="%{optflags}" %{__python} setup.py build #----------------------------------------------------------------------------- # Generate documentation. The `sphinx.autodoc' extension must be able # to import our newly built extension modules. builddir=$(readlink -f $(ls -1d build/lib.*/evdev/../)) sed -i -e "/sys.path.insert.*/a sys.path.insert(0, \"$builddir\")" 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/apidoc.txt %doc doc/_build/text/index.txt %doc doc/_build/text/tutorial.txt %{python_sitearch}/* %if 0%{?with_python3} %files -n python3-evdev %doc README.rst LICENSE bin/evtest.py %doc doc/_build/text/apidoc.txt %doc doc/_build/text/index.txt %doc doc/_build/text/tutorial.txt %{python3_sitearch}/* %endif %changelog * Tue Oct 07 2014 Georgi Valkov - 0.4.6-1 - Initial version