%if 0%{?fedora} > 12 %global with_python3 1 %else %{!?python_sitearch: %global python_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %endif # python3 not currently supported upstream, leaving macros in preparation # for upstream support in the future. %global with_python3 0 %global upstream_name texttable Name: python-%{upstream_name} Version: 0.8.1 Release: 4%{?dist} Summary: Python module to generate a formatted text table, using ASCII characters Group: Development/Libraries License: LGPLv2+ URL: http://foutaise.org/code/ Source0: https://pypi.python.org/packages/source/t/texttable/texttable-0.8.1.tar.gz Patch0: texttable-0.8.1-remove-main-from-lib.patch BuildRequires: python-devel python-setuptools BuildArch: noarch %if 0%{?with_python3} BuildRequires: python3-devel python3-setuptools # For /usr/bin/2to3 BuildRequires: python-tools %endif # if with_python3 %description Python module to generate a formatted text table, using ASCII characters %if 0%{?with_python3} %package -n python3-%{upstream_name} Summary: Python module to generate a formatted text table, using ASCII characters Group: Development/Languages %description -n python3-%{upstream_name} Python module to generate a formatted text table, using ASCII characters %endif #if with_python3 %prep %setup -q -n %{upstream_name}-%{version} %patch0 -p0 %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} 2to3 --write --nobackups %{py3dir} %endif # with_python3 %build CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build %if 0%{?with_python3} pushd %{py3dir} CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build popd %endif # with_python3 %install rm -rf $RPM_BUILD_ROOT %{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT popd %endif # with_python3 %files %doc PKG-INFO %{python2_sitelib}/texttable* %if 0%{?with_python3} %files -n python3-%{upstream_name} %doc PKG-INFO %{python3_sitelib}/texttable* %endif # with_python3 %changelog * Tue Aug 12 2014 Adam Miller - 0.8.1-4 - Patch to remove "__main__" and /usr/bin/env from non-executable library * Mon Aug 11 2014 Adam Miller - 0.8.1-3 - Fix description for rpmlin errors, fix files listing * Fri Aug 08 2014 Adam Miller - 0.8.1-2 - Fixed __python vs __python2 macros, BuildArch: noarch * Wed Jul 23 2014 Adam Miller - 0.8.1-1 - Initial package for Fedora