%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%global sname openstack-doc-tools
%global module os_doc_tools
%if 0%{?fedora} >= 24
%global with_python3 1
%endif
Name: python-openstack-doc-tools
Version: 1.3.0
Release: 2%{?dist}
Summary: Tools for OpenStack Documentation
License: ASL 2.0
Url: https://launchpad.net/%{sname}
Source0: http://tarballs.openstack.org/%{sname}/%{sname}-%{upstream_version}.tar.gz
BuildArch: noarch
%package -n python2-%{sname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{sname}}
BuildRequires: python2-devel
BuildRequires: python-babel
BuildRequires: PyYAML
BuildRequires: python-demjson
BuildRequires: python-docutils
BuildRequires: python-mock
BuildRequires: python-pbr
BuildRequires: python-setuptools
BuildRequires: python-testrepository
Requires: PyYAML
Requires: python-sphinx
Requires: python-cliff-tablib
Requires: python-docutils
Requires: python-iso8601
Requires: python-lxml
Requires: python-oslo-config
Requires: python-oslo-sphinx
%description -n python2-%{sname}
%{description}
%package -n python-%{sname}-doc
Summary: %{summary} - documentation
BuildRequires: python-sphinx
BuildRequires: python-oslo-sphinx
%description -n python-%{sname}-doc
%{description}
This package contains the documentation.
%if 0%{?with_python3}
%package -n python3-%{sname}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{sname}}
BuildRequires: python3-devel
BuildRequires: python3-babel
BuildRequires: python3-PyYAML
BuildRequires: python3-sphinx
BuildRequires: python3-demjson
BuildRequires: python3-docutils
BuildRequires: python3-mock
BuildRequires: python3-oslo-sphinx
BuildRequires: python3-pbr
BuildRequires: python3-setuptools
BuildRequires: python3-testrepository
Requires: python3-PyYAML
Requires: python3-sphinx
Requires: python3-cliff-tablib
Requires: python3-docutils
Requires: python3-iso8601
Requires: python3-lxml
Requires: python3-oslo-config
Requires: python3-oslo-sphinx
BuildArch: noarch
%description -n python3-%{sname}
%{description}
%endif
%description
Tools used by the OpenStack Documentation Project.
%prep
%autosetup -n %{sname}-%{upstream_version}
# Let's handle dependencies ourseleves
rm -f *requirements.txt
%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif
# generate html docs
%{__python2} setup.py build_sphinx
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%install
BINARIES="doc-tools-build-rst doc-tools-check-languages doc-tools-update-cli-reference \
openstack-auto-commands openstack-indexpage openstack-jsoncheck"
%if 0%{?with_python3}
%py3_install
for binary in $BINARIES; do
cp %{buildroot}/%{_bindir}/$binary %{buildroot}/%{_bindir}/$binary-3
ln -sf %{_bindir}/$binary-3 %{buildroot}/%{_bindir}/$binary-%{python3_version}
done
%endif
%py2_install
for binary in $BINARIES; do
cp %{buildroot}/%{_bindir}/$binary %{buildroot}/%{_bindir}/$binary-2
ln -sf %{_bindir}/$binary-2 %{buildroot}/%{_bindir}/$binary-%{python2_version}
done
# We don't need the additional scripts added to /usr/share
rm -rf %{buildroot}%{_datadir}/%{sname}
%check
%if 0%{?with_python3}
%{__python3} setup.py testr
rm -rf .testrepository
%endif
%{__python2} setup.py testr
%files -n python2-%{sname}
%license LICENSE
%doc README.rst
%{_bindir}/doc-tools-build-rst
%{_bindir}/doc-tools-build-rst-2
%{_bindir}/doc-tools-build-rst-%{python2_version}
%{_bindir}/doc-tools-check-languages
%{_bindir}/doc-tools-check-languages-2
%{_bindir}/doc-tools-check-languages-%{python2_version}
%{_bindir}/doc-tools-update-cli-reference
%{_bindir}/doc-tools-update-cli-reference-2
%{_bindir}/doc-tools-update-cli-reference-%{python2_version}
%{_bindir}/openstack-auto-commands
%{_bindir}/openstack-auto-commands-2
%{_bindir}/openstack-auto-commands-%{python2_version}
%{_bindir}/openstack-indexpage
%{_bindir}/openstack-indexpage-2
%{_bindir}/openstack-indexpage-%{python2_version}
%{_bindir}/openstack-jsoncheck
%{_bindir}/openstack-jsoncheck-2
%{_bindir}/openstack-jsoncheck-%{python2_version}
%{python2_sitelib}/%{module}
%{python2_sitelib}/autogenerate_config_docs
%{python2_sitelib}/*.egg-info
%files -n python-%{sname}-doc
%license LICENSE
%doc doc/build/html
%if 0%{?with_python3}
%files -n python3-%{sname}
%license LICENSE
%doc README.rst
%{_bindir}/doc-tools-build-rst-3
%{_bindir}/doc-tools-build-rst-%{python3_version}
%{_bindir}/doc-tools-check-languages-3
%{_bindir}/doc-tools-check-languages-%{python3_version}
%{_bindir}/doc-tools-update-cli-reference-3
%{_bindir}/doc-tools-update-cli-reference-%{python3_version}
%{_bindir}/openstack-auto-commands-3
%{_bindir}/openstack-auto-commands-%{python3_version}
%{_bindir}/openstack-indexpage-3
%{_bindir}/openstack-indexpage-%{python3_version}
%{_bindir}/openstack-jsoncheck-3
%{_bindir}/openstack-jsoncheck-%{python3_version}
%{python3_sitelib}/%{module}
%{python3_sitelib}/autogenerate_config_docs
%{python3_sitelib}/*.egg-info
%endif
%changelog
* Tue Jan 31 2017 Javier Peña <jpena@redhat.com> - 1.3.0-2
- Added missing requirements
* Wed Jan 25 2017 Javier Peña <jpena@redhat.com> - 1.3.0-1
- Initial package.