%{!?__python2: %global __python2 %__python} %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %if 0%{?fedora} %bcond_without python3 %else %bcond_with python3 %endif Name: python-keyutils Version: 0.3 Release: 1%{?dist} Summary: Python bindings for the keyutils package License: ASL 2.0 URL: https://github.com/sassoftware/%{name} Source0: https://pypi.python.org/packages/source/k/keyutils/keyutils-%{version}.tar.gz # Copied from current setup.py upstream. Patch0: keyutils-0.3-utf8-readme.patch BuildRequires: keyutils-libs-devel BuildRequires: python2-devel %if %{with python3} BuildRequires: python3-devel %endif # with python3 %description python-keyutils is a set of python bindings for keyutils, a key management suite that leverages the infrastructure provided by the Linux kernel for safely storing and retrieving sensitive infromation in your programs. %package -n python2-keyutils Summary: Python2 bindings for the keyutils package %description -n python2-keyutils python-keyutils is a set of python bindings for keyutils, a key management suite that leverages the infrastructure provided by the Linux kernel for safely storing and retrieving sensitive infromation in your programs. %if %{with python3} %package -n python3-keyutils Summary: Python3 bindings for the keyutils package %description -n python3-keyutils python-keyutils is a set of python bindings for keyutils, a key management suite that leverages the infrastructure provided by the Linux kernel for safely storing and retrieving sensitive infromation in your programs. %endif # with python3 %prep %setup -q -n keyutils-%{version} %patch0 -p1 -b utf8-readme %if %{with python3} rm -rf %{py3dir} cp -a . %{py3dir} %endif # with python3 %build CFLAGS="%{optflags}" %{__python2} setup.py build %if %{with python3} pushd %{py3dir} CFLAGS="%{optflags}" %{__python3} setup.py build popd %endif # with python3 %install # Must do the python3 install first because the scripts in /usr/bin are # overwritten with every setup.py install (and we want the python2 version # to be the default for now). %if %{with python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root %{buildroot} popd %endif # with python3 %{__python2} setup.py install -O1 --skip-build --root %{buildroot} %check #{__python2} test/testBasic.py %if %{with python3} pushd %{py3dir} #{__python3} test/testBasic.py popd %endif %files %license LICENSE %doc README.rst ChangeLog TODO AUTHORS PKG-INFO %{python2_sitearch}/* %if %{with python3} %files -n python3-keyutils %license LICENSE %doc README.rst ChangeLog TODO AUTHORS PKG-INFO %{python3_sitearch}/* %endif # with python3 %changelog * Tue Apr 05 2016 Ben Boeckel - 0.3-1 - initial package