%{!?__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 %global pkgname tree-format %global commit 4c6de1074d96129b7e03eecdf42fac2cde3b5151 %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: python-%{pkgname} Version: 0.1.2 Release: 1%{?dist} Summary: Python library to generate nicely formatted trees, like the UNIX tree command License: ASL 2.0 URL: https://github.com/jml/tree-format Source0: https://github.com/jml/%{pkgname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python2-testtools %if %{with python3} BuildRequires: python3-devel BuildRequires: python3-testtools %endif # with python3 %description Python library to generate nicely formatted trees, like the UNIX `tree` command %package -n python2-%{pkgname} Summary: %{summary} %{?python_provide:%python_provide python2-%{pkgname}} %description -n python2-%{pkgname} Python library to generate nicely formatted trees, like the UNIX `tree` command %if %{with python3} %package -n python3-%{pkgname} Summary: %{summary} %{?python_provide:%python_provide python3-%{pkgname}} %description -n python3-%{pkgname} Python library to generate nicely formatted trees, like the UNIX `tree` command %endif # with python3 %prep %autosetup -n %{pkgname}-%{commit} %build %{py2_build} %if %{with python3} %{py3_build} %endif # with python3 %install %if %{with python3} %{py3_install} %endif # with python3 %{py2_install} %check %{__python2} setup.py test %if %{with python3} %{__python3} setup.py test %endif %files -n python2-%{pkgname} %license LICENSE %{python2_sitelib}/* %if %{with python3} %files -n python3-%{pkgname} %license LICENSE %{python3_sitelib}/* %endif # with python3 %changelog * Thu Mar 1 2018 Brett Lentz - 0.1.2-1 - initial package