%global modname binaryornot %global sum A pure Python package to check if a file is binary or text %if 0%{?fedora} %global with_python3 1 %endif Name: python-binaryornot Version: 0.4.0 Release: 2%{?dist} Summary: %{sum} License: BSD URL: http://pypi.python.org/pypi/BinaryOrNot Source0: https://pypi.python.org/packages/source/b/binaryornot/binaryornot-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-chardet >= 2.0.0 BuildRequires: python2-hypothesis BuildRequires: python-sphinx %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-chardet >= 2.0.0 BuildRequires: python3-hypothesis %endif %description Ultra-lightweight pure Python package to guess whether a file is binary or text, using a heuristic similar to Perl's pp_fttext and its analysis by @eliben. Has tests for these file types: * Text: .txt, .css, .json, .svg, .js, .lua, .pl, .rst * Binary: .png, .gif, .jpg, .tiff, .bmp, .DS_Store, .eot, .otf, .ttf, .woff, .rgb Has tests for numerous encodings. %package -n python2-%{modname} Summary: %{sum} Requires: python-chardet >= 2.0.0 %{?python_provide:%python_provide python2-%{modname}} %description -n python2-%{modname} Ultra-lightweight pure Python package to guess whether a file is binary or text, using a heuristic similar to Perl's pp_fttext and its analysis by @eliben. Has tests for these file types: * Text: .txt, .css, .json, .svg, .js, .lua, .pl, .rst * Binary: .png, .gif, .jpg, .tiff, .bmp, .DS_Store, .eot, .otf, .ttf, .woff, .rgb Has tests for numerous encodings. %if 0%{?with_python3} %package -n python3-%{modname} Summary: %{sum} Requires: python3-chardet >= 2.0.0 %{?python_provide:%python_provide python3-%{modname}} %description -n python3-binaryornot Ultra-lightweight pure Python package to guess whether a file is binary or text, using a heuristic similar to Perl's pp_fttext and its analysis by @eliben. Has tests for these file types: * Text: .txt, .css, .json, .svg, .js, .lua, .pl, .rst * Binary: .png, .gif, .jpg, .tiff, .bmp, .DS_Store, .eot, .otf, .ttf, .woff, .rgb Has tests for numerous encodings. %endif %package -n python-%{modname}-docs Summary: Documentation for python-binaryornot %description -n python-%{modname}-docs Documentation for python-binaryornot %prep %autosetup -n %{modname}-%{version} rm -rf %{modname}.egg-info %build %py2_build %if 0%{?with_python3} %py3_build %endif make -C docs html PYTHONPATH=$(pwd) %install %py2_install %if 0%{?with_python3} %py3_install %endif %check %{__python2} setup.py test %if 0%{?with_python3} %{__python3} setup.py test %endif rm -rf docs/_build/html/.buildinfo %files -n python2-%{modname} %doc README.rst %license LICENSE %{python2_sitelib}/%{modname}/ %{python2_sitelib}/%{modname}-%{version}* %if 0%{?with_python3} %files -n python3-%{modname} %doc README.rst %license LICENSE %{python3_sitelib}/%{modname}/ %{python3_sitelib}/%{modname}-%{version}-* %endif %files -n python-%{modname}-docs %doc docs/_build/html %changelog * Mon Nov 30 2015 Pierre-Yves Chibon - 0.4.0-2 - Update the spec to the latest guidelines, generating two sub-packages one for py2 and one for py3 - Build the doc and place it in a -docs sub-package * Fri Nov 27 2015 Pierre-Yves Chibon - 0.4.0-1 - initial package for Fedora