%{!?__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.5 Release: 1%{?dist} Summary: Python bindings for the keyutils package License: ASL 2.0 URL: https://github.com/sassoftware/%{name} Source0: https://pypi.io/packages/source/k/keyutils/keyutils-%{version}.tar.gz BuildRequires: gcc BuildRequires: keyutils-libs-devel BuildRequires: python2-devel BuildRequires: python2-pytest-runner %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-pytest-runner %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} %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 python2 install first because the scripts in /usr/bin are # overwritten with every setup.py install (and we want the python3 version # to be the default for now). %{__python2} setup.py install -O1 --skip-build --root %{buildroot} %if %{with python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root %{buildroot} popd %endif # with python3 %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 * Sun Oct 14 2018 Ben Boeckel - 0.5-1 - update to 0.5 * Sun Jan 22 2017 Ben Boeckel - 0.4-1 - update to 0.4 * Tue Apr 05 2016 Ben Boeckel - 0.3-1 - initial package