Blob Blame Raw
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%global sname openstack-doc-tools
%global module os_doc_tools

%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_with    python2
%bcond_without python3
%bcond_without python2
%bcond_with    python3

Name:           python-openstack-doc-tools
Version:        1.8.0
Release:        6%{?dist}
Summary:        Tools for OpenStack Documentation
License:        ASL 2.0
Url:  {sname}
BuildArch:      noarch

%if %{with python2}
%package -n python2-%{sname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{sname}}

BuildRequires:  python2-devel
BuildRequires:  python2-pyyaml
BuildRequires:  python2-demjson
BuildRequires:  python2-docutils
BuildRequires:  python2-lxml
BuildRequires:  python2-mock
BuildRequires:  python2-pbr
BuildRequires:  python2-setuptools
BuildRequires:  python2-testrepository
BuildRequires:  python2-sphinx
BuildRequires:  python2-openstackdocstheme
Requires:       python2-pbr
Requires:       python2-iso8601
Requires:       python2-lxml
Requires:       python2-demjson
Requires:       python2-docutils
Requires:       python2-sphinx
Requires:       python2-pyyaml

%description -n python2-%{sname}

%package -n python-%{sname}-doc
Summary:    %{summary} - documentation

%description -n python-%{sname}-doc

This package contains the documentation.

%if %{with python3}
%package -n python3-%{sname}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{sname}}

BuildRequires:  python3-devel
BuildRequires:  python3-PyYAML
BuildRequires:  python3-demjson
BuildRequires:  python3-docutils
BuildRequires:  python3-lxml
BuildRequires:  python3-mock
BuildRequires:  python3-pbr
BuildRequires:  python3-setuptools
BuildRequires:  python3-testrepository
BuildRequires:  python3-sphinx
BuildRequires:  python3-openstackdocstheme
Requires:       python3-pbr
Requires:       python3-iso8601
Requires:       python3-lxml
Requires:       python3-demjson
Requires:       python3-docutils
Requires:       python3-sphinx
Requires:       python3-PyYAML
BuildArch:      noarch

%description -n python3-%{sname}


Tools used by the OpenStack Documentation Project.

%autosetup -n %{sname}-%{upstream_version}
# Let's handle dependencies ourseleves
rm -f *requirements.txt

%if %{with python2}
%if %{with python3}

# generate html docs
%if %{with python2}
%{__python2} build_sphinx
%if %{with python3}
%{__python3} build_sphinx
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

BINARIES="doc-tools-build-rst doc-tools-check-languages \
openstack-indexpage openstack-jsoncheck"

%if %{with python3}
for binary in $BINARIES; do
  cp %{buildroot}/%{_bindir}/$binary %{buildroot}/%{_bindir}/$binary-3
  ln -sf %{_bindir}/$binary-3 %{buildroot}/%{_bindir}/$binary-%{python3_version}

%if %{with python2}
for binary in $BINARIES; do
  cp %{buildroot}/%{_bindir}/$binary %{buildroot}/%{_bindir}/$binary-2
  ln -sf %{_bindir}/$binary-2 %{buildroot}/%{_bindir}/$binary-%{python2_version}

# We don't need the additional scripts added to /usr/share
rm -rf %{buildroot}%{_datadir}/%{sname}

# We don't want to run the sitemap tests, it is not included in the package
rm -f test/ test/

%if %{with python3}
PYTHON=python3 %{__python3} testr
rm -rf .testrepository
%if %{with python2}
PYTHON=python2 %{__python2} testr

%if %{with python2}
%files -n python2-%{sname}
%license LICENSE
%doc README.rst

%files -n python-%{sname}-doc
%license LICENSE
%doc doc/build/html

%if %{with python3}
%files -n python3-%{sname}
%license LICENSE
%doc README.rst

* Tue Feb 26 2019 Javier Peña <> - 1.8.0-6
- Remove python2 subpackage from Fedora

* Sat Feb 02 2019 Fedora Release Engineering <> - 1.8.0-5
- Rebuilt for

* Tue Aug 07 2018 Javier Peña <>
- Fixed rawhide build (bz#1605806)

* Sat Jul 14 2018 Fedora Release Engineering <> - 1.8.0-3
- Rebuilt for

* Tue Jun 19 2018 Miro Hrončok <> - 1.8.0-2
- Rebuilt for Python 3.7

* Thu May 10 2018 Javier Peña <> - 1.8.0-1
- Updated to upstream release 1.8.0

* Fri Feb 09 2018 Fedora Release Engineering <> - 1.3.0-5
- Rebuilt for

* Fri Jan 26 2018 Iryna Shcherbina <> - 1.3.0-4
- Update Python 2 dependency declarations to new packaging standards

* Thu Jul 27 2017 Fedora Release Engineering <> - 1.3.0-3
- Rebuilt for

* Tue Jan 31 2017 Javier Peña <> - 1.3.0-2
- Added missing requirements

* Wed Jan 25 2017 Javier Peña <> - 1.3.0-1
- Initial package.