%global pypi_name htmlmin
%global desc A configurable HTML Minifier with safety features.
%global github_owner mankyd
%global github_name %{pypi_name}
%global commit 220b1d16442eb4b6fafed338ee3b61f698a01e63
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: python-%{pypi_name}
Version: 0.1.12
Release: 1.git%{shortcommit}%{?dist}
Summary: HTML Minifier
License: BSD
URL: https://pypi.python.org/pypi/%{pypi_name}
Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{commit}/%{github_name}-%{commit}.tar.gz
BuildArch: noarch
%description
%{desc}
%package -n python2-%{pypi_name}
BuildRequires: python2-devel
Summary: %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
%{desc}
%package -n python3-%{pypi_name}
Summary: %{summary}
BuildRequires: python3-devel
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name}
%{desc}
%package doc
Summary: %{summary}
BuildRequires: python-sphinx
%description doc
%{desc}
Documentation package.
%prep
%setup -q -n %{github_name}-%{commit}
rm -rf *.egg-info
%build
%py2_build
%py3_build
# Build doc
cd docs
make html
make man
# Remove hidden dir in doc not to install it
rm -rf _build/html/.buildinfo
%install
%py2_install
%py3_install
# Install man
mkdir -p %{buildroot}%{_mandir}/man1
install -p -m0644 docs/_build/man/htmlmin.1 %{buildroot}%{_mandir}/man1
%check
%{__python2} setup.py test
%{__python3} setup.py test
%files -n python2-%{pypi_name}
%license LICENSE
%doc README.rst
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python2_version}.egg-info/
%{python2_sitelib}/%{pypi_name}/
%files -n python3-%{pypi_name}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/
%{python3_sitelib}/%{pypi_name}/
%{_bindir}/htmlmin
%{_mandir}/man1/*
%files doc
%license LICENSE
%doc docs/_build/html
%changelog
* Wed Jan 03 2018 Julien Enselme <jujens@jujens.eu> - 0.1.12-1.git220b1d1
- Update to 0.1.12
* Thu Oct 05 2017 Julien Enselme <jujens@jujens.eu> - 0.1.11-1.gitab91ff0
- Update to 0.1.11
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.10-5.gitcc611c3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 0.1.10-4.gitcc611c3
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.10-3.gitcc611c3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Sat Mar 12 2016 Julien Enselme <jujens@jujens.eu> 0.1.10-2.gitcc611c3
- Remove hidden dir in doc package
* Wed Mar 09 2016 Julien Enselme <jujens@jujens.eu> - 0.1.10-1.gitcc611c3
- Initial packaging