%global commit0 04a2f9cd8ad421035dc7f9b3509800727a987da7 %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) %global owner puiterwijk %global srcname openidc-client %global sum A python OpenID Connect client with token caching and management # sitelib for noarch packages, sitearch for others (remove the unneeded one) %{!?__python2: %global __python2 %__python} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %if 0%{?fedora} %bcond_without python3 %else %bcond_with python3 %endif Name: python-%{srcname} Version: 0.1 Release: 1%{?dist} Summary: %{sum} License: MIT URL: https://github.com/%{owner}/python-%{srcname} Source0: https://github.com/%{owner}/%{name}/archive/%{commit0}.tar.gz BuildArch: noarch BuildRequires: python2-devel, python-mock, python-requests %if %{with python3} BuildRequires: python3-devel, python3-requests %endif # with python3 %description %{sum} %if %{with python3} %package -n python3-%{srcname} Summary: %{sum} %description -n python3-%{srcname} %{sum} %endif # with python3 %prep #%autosetup -c %setup -qc -n %{name}-%{commit0} mv %{name}-%{commit0} python2 %if %{with python3} cp -a python2 python3 %endif # with python3 %build pushd python2 popd %if %{with python3} pushd python3 popd %endif # with python3 %install rm -rf $RPM_BUILD_ROOT # 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 python3 %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %endif # with python3 pushd python2 %{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %check pushd python2 %{__python2} -m unittest discover popd %if %{with python3} pushd python3 %{__python3} -m unittest discover popd %endif mv python2/{README.md,COPYING} . %files %license COPYING %doc README.md # For noarch packages: sitelib %{python2_sitelib}/* %if %{with python3} %files -n python3-openidc-client %license COPYING %doc README.md # For noarch packages: sitelib %{python3_sitelib}/* %endif # with python3 %changelog * Mon Mar 20 2017 Mohan Boddu - Initial packaging of python-openidc-client