%if 0%{?fedora} %global with_python3 1 %endif # Define modern python2 macros for el6. %if 0%{?rhel} && 0%{?rhel} <= 6 %{!?__python2: %global __python2 /usr/bin/python2} %{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} %{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} %endif %global srcname ansi2html Name: python-ansi2html Version: 1.1.0 Release: 1%{?dist} Summary: Python module that converts text with ANSI color to HTML Group: Development/Libraries License: GPLv3+ URL: http://github.com/ralphbean/ansi2html Source0: http://pypi.python.org/packages/source/a/ansi2html/ansi2html-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: python-nose BuildRequires: python-mock BuildRequires: python-six %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-nose BuildRequires: python3-mock BuildRequires: python3-six %endif %if %{?rhel}%{!?rhel:0} >= 6 BuildRequires: python-ordereddict Requires: python-ordereddict %endif Requires: python Requires: python-setuptools Requires: python-six %description The ansi2html module can convert text with ANSI color codes to HTML. %if 0%{?with_python3} %package -n python3-ansi2html Summary: Python 3 module that converts text with ANSI color to HTML Group: Development/Libraries %if 0%{?with_python3} Requires: python3 Requires: python3-setuptools Requires: python3-six %endif %description -n python3-ansi2html The ansi2html module can convert text with ANSI color codes to HTML. %endif %prep %setup -q -n %{srcname}-%{version} # Remove bundled egg-info just in case it is included. rm -rf *.egg* %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} %endif %check PYTHONPATH=. nosetests tests/*.py %if 0%{?with_python3} pushd %{py3dir} PYTHONPATH=. nosetests-%{python3_version} tests/*.py popd %endif %build %{__python2} setup.py build %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd %endif %install %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --skip-build --root=%{buildroot} mv %{buildroot}/%{_bindir}/ansi2html %{buildroot}/%{_bindir}/python3-ansi2html mkdir -p %{buildroot}/%{_mandir}/man1/ mv man/ansi2html.1 %{buildroot}/%{_mandir}/man1/python3-ansi2html.1 popd %endif # Note that this have to come after the py3 block so that the # _bindir/python3-ansi2html switch-a-roo can work. %{__python2} setup.py install --skip-build --root=%{buildroot} mkdir -p %{buildroot}/%{_mandir}/man1/ mv man/ansi2html.1 %{buildroot}/%{_mandir}/man1/ansi2html.1 %files %doc LICENSE README.rst %{python2_sitelib}/ansi2html %{python2_sitelib}/ansi2html-%{version}-* %{_bindir}/ansi2html %{_mandir}/man1/ansi2html* %if 0%{?with_python3} %files -n python3-ansi2html %doc LICENSE README.rst %{python3_sitelib}/ansi2html %{python3_sitelib}/ansi2html-%{version}-* %{_bindir}/python3-ansi2html %{_mandir}/man1/python3-ansi2html* %endif %changelog * Mon Mar 30 2015 Ralph Bean - 1.1.0-1 - new version * Wed Jan 28 2015 Ralph Bean - 1.0.6-6 - Bump spec for testing. * Mon Oct 13 2014 Ralph Bean - 1.0.6-5 - Modernized python2 macros. - Remove any bundled egg-info. - BR on python2-devel. * Wed Aug 27 2014 Ralph Bean - 1.0.6-4 - Added explicit dependency on python(3)-setuptools. * Sat Jun 07 2014 Fedora Release Engineering - 1.0.6-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild * Tue May 27 2014 Kalev Lember - 1.0.6-2 - Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4 * Tue Jan 28 2014 Ralph Bean - 1.0.6-1 - Latest upstream. * Sat Oct 12 2013 Ralph Bean - 1.0.5-1 - Latest upstream with configurable color scheme. * Sat Oct 12 2013 Ralph Bean - 1.0.3-1 - Latest upstream with a tweak to setup.py * Fri Oct 04 2013 Ralph Bean - 1.0.2-1 - Latest upstream. - Manpages now included. * Thu Sep 26 2013 Ralph Bean - 0.10.0-3 - Latest upstream with a superior internal state model thanks to Sebastian Pipping. * Sun Aug 04 2013 Fedora Release Engineering - 0.9.4-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild * Tue Mar 26 2013 Ralph Bean - 0.9.4-2 - Removed python3 rhel conditional. * Mon Feb 25 2013 Ralph Bean - 0.9.4-1 - Latest upstream fixes encoding issues. * Thu Feb 14 2013 Fedora Release Engineering - 0.9.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild * Wed Sep 26 2012 Ralph Bean - 0.9.2-1 - New upstream - Fixes dict ordering issues. - Solves some encoding issues. * Mon Aug 6 2012 David Malcolm - 0.9.1-8 - fix dict ordering issues * Sat Aug 04 2012 David Malcolm - 0.9.1-7 - rebuild for https://fedoraproject.org/wiki/Features/Python_3.3 * Sat Jul 21 2012 Fedora Release Engineering - 0.9.1-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild * Mon Jul 09 2012 Ralph Bean - 0.9.1-5 - Re-enabled tests. * Mon Jul 09 2012 Ralph Bean - 0.9.1-4 - Temporarily removed both sets of tests until python-mock problems are sorted out. * Mon Jul 09 2012 Ralph Bean - 0.9.1-3 - Temporarily removed python3 tests until python3-mock is available. * Mon Jul 09 2012 Ralph Bean - 0.9.1-2 - Added requirements python-mock and python-ordereddict. * Mon Jul 09 2012 Ralph Bean - 0.9.1-1 - Latest upstream version. * Tue Jun 26 2012 Ralph Bean - 0.9.0-4 - Only Require python3 for python3-ansi2html. * Wed May 23 2012 Ralph Bean - 0.9.0-3 - Fix executable python2/python3 confusion. - More explicit ownership of dirs in python_sitelib. - Removed mixed use of tabs and spaces. * Wed May 09 2012 Ralph Bean - 0.9.0-2 - python3 support. * Wed May 09 2012 Ralph Bean - 0.9.0-1 - Packaged latest upstream version. - Removed unnecessary defattr and buildroot - New dependency on python-six * Fri Feb 3 2012 Ralph Bean - 0.8.3-1 - Included tests in check section. - More concise file ownership declarations. - Resolved license ambiguity in upstream. - Removed shebang from non-executable file. * Mon Jan 30 2012 Ralph Bean - 0.8.2-1 - Updated ansi2html version to latest 0.8.2. - Added _bindir entry for the ansi2html console-script. - Removed dependency on genshi. - Removed references to now EOL fedora 12. * Wed Sep 15 2010 Ralph Bean - 0.5.2-1 - Updated spec based on comments from Mark McKinstry * Tue Sep 7 2010 Ralph Bean - 0.5.1-1 - Initial RPM packaging