%global pypi_name bash8 %if 0%{?fedora} %global with_python3 1 %endif Name: python-%{pypi_name} Version: 0.1.1 Release: 3%{?dist} Summary: A pep8 equivalent for bash scripts License: ASL 2.0 URL: http://www.openstack.org/ Source0: https://pypi.python.org/packages/source/b/%{pypi_name}/%{pypi_name}-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-oslo-sphinx BuildRequires: python-babel BuildRequires: python-pbr BuildRequires: python-sphinx %if 0%{?with_python3} BuildRequires: python3-devel BuildRequires: python3-pbr %endif # if with_python3 %description A pep8 equivalent for bash scripts %if 0%{?with_python3} %package -n python3-%{pypi_name} Summary: A pep8 equivalent for bash scripts Requires: python3-pbr %description -n python3-%{pypi_name} A pep8 equivalent for bash scripts %endif # if with_python3 %prep %setup -q -n %{pypi_name}-%{version} # Remove bundled egg-info rm -rf %{pypi_name}.egg-info # drop shebang line in non-executable file pushd bash8 sed '1{\@^#!/usr/bin/env python@d}' bash8.py > bash8.new touch -r bash8.py bash8.new mv bash8.new bash8.py popd %if 0%{?with_python3} rm -rf %{py3dir} cp -a . %{py3dir} find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' %endif # with_python3 %build %{__python2} setup.py build # generate html docs and man page sphinx-build doc/source html sphinx-build -b man doc/source man # remove the sphinx-build leftovers rm -rf html/.{doctrees,buildinfo} %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd %endif # with_python3 %check %{__python2} setup.py test %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py build popd %endif # with_python3 %install %{__python2} setup.py install --skip-build --root %{buildroot} mkdir -p %{buildroot}%{_mandir}/man1/ cp man/bash8.1 %{buildroot}%{_mandir}/man1/ %if 0%{?with_python3} pushd %{py3dir} %{__python3} setup.py install --skip-build --root %{buildroot} popd %endif # with_python3 %files %doc html README.rst %{!?_licensedir:%global license %%doc} %license LICENSE %{_bindir}/%{pypi_name} %{python2_sitelib}/%{pypi_name} %{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info %{_mandir}/man1/bash8.1* %if 0%{?with_python3} %files -n python3-%{pypi_name} %license LICENSE %doc html README.rst %{python3_sitelib}/* %endif # with_python3 %changelog * Wed Aug 12 2015 Frederic Lepied 0.1.1-3 - added a %check section * Wed Aug 12 2015 Frederic Lepied 0.1.1-2 - added man page - added python3 sub-package * Sat May 23 2015 Haïkel Guémar - 0.1.1-1 - Initial package.