Blame python-renderspec.spec

d81aa2
%global pypi_name renderspec
d81aa2
%global common_desc\
d81aa2
renderspec is a tool to convert a .spec.j2 Jinja2 template to a rpm .spec file\
d81aa2
which is usable for different distributions and follow their policies and\
d81aa2
processes.
d81aa2
acd097
%if 0%{?fedora} || 0%{?rhel} > 7
acd097
%bcond_with    python2
acd097
%bcond_without python3
acd097
%else
acd097
%bcond_without python2
acd097
%bcond_with    python3
d81aa2
%endif
d81aa2
d81aa2
Name:           python-%{pypi_name}
d81aa2
Version:        1.7.0
acd097
Release:        8%{?dist}
d81aa2
Summary:        Jinja2 template renderer for generating .spec files
d81aa2
d81aa2
License:        ASL 2.0
d81aa2
URL:            http://docs.openstack.org/developer/renderspec/
d81aa2
Source0:        https://files.pythonhosted.org/packages/source/r/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
d81aa2
BuildArch:      noarch
d81aa2
 
d81aa2
%description
d81aa2
%{common_desc}
d81aa2
acd097
%if %{with python2}
d81aa2
%package -n     python2-%{pypi_name}
d81aa2
Summary:        %{summary}
d81aa2
%{?python_provide:%python_provide python2-%{pypi_name}}
d81aa2
BuildRequires:  python2-devel
d81aa2
BuildRequires:  %{py2_dist pbr}
d81aa2
BuildRequires:  %{py2_dist testrepository}
d81aa2
BuildRequires:  %{py2_dist testresources}
d81aa2
BuildRequires:  %{py2_dist testtools}
d81aa2
BuildRequires:  %{py2_dist ddt}
d81aa2
BuildRequires:  %{py2_dist mock}
d81aa2
BuildRequires:  %{py2_dist Sphinx}
d81aa2
BuildRequires:  %{py2_dist oslosphinx}
d81aa2
BuildRequires:  %{py2_dist setuptools}
d81aa2
# Required for tests
d81aa2
BuildRequires:  %{py2_dist packaging}
d81aa2
BuildRequires:  %{py2_dist pymod2pkg}
d81aa2
BuildRequires:  %{py2_dist PyYAML}
d81aa2
d81aa2
Requires:       %{py2_dist Jinja2} >= 2.8
d81aa2
Requires:       %{py2_dist pymod2pkg} >= 0.7.0
d81aa2
Requires:       %{py2_dist PyYAML} >= 3.10
d81aa2
Requires:       %{py2_dist packaging} >= 16.5
d81aa2
Requires:       %{py2_dist six} >= 1.9.0
d81aa2
Requires:       %{py2_dist setuptools}
d81aa2
d81aa2
%description -n python2-%{pypi_name}
d81aa2
%{common_desc}
acd097
%endif
d81aa2
acd097
%if %{with python3}
d81aa2
%package -n     python3-%{pypi_name}
d81aa2
Summary:        %{summary}
d81aa2
%{?python_provide:%python_provide python3-%{pypi_name}}
d81aa2
BuildRequires:  python3-devel
d81aa2
BuildRequires:  %{py3_dist pbr}
d81aa2
BuildRequires:  %{py3_dist testrepository}
d81aa2
BuildRequires:  %{py3_dist testresources}
d81aa2
BuildRequires:  %{py3_dist testtools}
d81aa2
BuildRequires:  %{py3_dist ddt}
d81aa2
BuildRequires:  %{py3_dist mock}
d81aa2
BuildRequires:  %{py3_dist Sphinx}
d81aa2
BuildRequires:  %{py3_dist oslosphinx}
d81aa2
BuildRequires:  %{py3_dist setuptools}
d81aa2
# Required for tests
d81aa2
BuildRequires:  %{py3_dist packaging}
d81aa2
BuildRequires:  %{py3_dist pymod2pkg}
d81aa2
BuildRequires:  %{py3_dist PyYAML}
d81aa2
d81aa2
Requires:       %{py3_dist Jinja2} >= 2.8
d81aa2
Requires:       %{py3_dist pymod2pkg} >= 0.7.0
d81aa2
Requires:       %{py3_dist PyYAML} >= 3.10
d81aa2
Requires:       %{py3_dist packaging} >= 16.5
d81aa2
Requires:       %{py3_dist six} >= 1.9.0
d81aa2
Requires:       %{py3_dist setuptools}
d81aa2
d81aa2
%description -n python3-%{pypi_name}
d81aa2
%{common_desc}
d81aa2
%endif
d81aa2
d81aa2
d81aa2
%package -n python-%{pypi_name}-doc
d81aa2
Summary:        renderspec documentation
d81aa2
%description -n python-%{pypi_name}-doc
d81aa2
Documentation for renderspec
d81aa2
d81aa2
%prep
d81aa2
%autosetup -n %{pypi_name}-%{version}
d81aa2
# Let's handle dependencies ourselves
d81aa2
rm -f *requirements.txt
d81aa2
# Remove bundled egg-info
d81aa2
rm -rf %{pypi_name}.egg-info
d81aa2
# remove shebangs
d81aa2
find -type f -a \( -name '*.py' -o -name 'py.*' \) \
d81aa2
   -exec sed -i '1{/^#!/d}' {} \; \
d81aa2
d81aa2
%build
acd097
%if %{with python2}
d81aa2
%py2_build
acd097
%endif
acd097
%if %{with python3}
d81aa2
%py3_build
d81aa2
%endif
acd097
d81aa2
# generate html docs
acd097
%if %{with python2}
d81aa2
sphinx-build doc/source html
acd097
%endif
acd097
%if %{with python3}
acd097
sphinx-build-3 doc/source html
acd097
%endif
acd097
d81aa2
# remove the sphinx-build leftovers
d81aa2
rm -rf html/.{doctrees,buildinfo}
d81aa2
d81aa2
%install
acd097
%if %{with python3}
d81aa2
%py3_install
d81aa2
cp %{buildroot}/%{_bindir}/renderspec %{buildroot}/%{_bindir}/renderspec-%{python3_version}
d81aa2
ln -s %{_bindir}/renderspec-%{python3_version} %{buildroot}/%{_bindir}/renderspec-3
d81aa2
%endif
d81aa2
acd097
%if %{with python2}
d81aa2
%py2_install
d81aa2
cp %{buildroot}/%{_bindir}/renderspec %{buildroot}/%{_bindir}/renderspec-%{python2_version}
d81aa2
ln -s %{_bindir}/renderspec-%{python2_version} %{buildroot}/%{_bindir}/renderspec-2
acd097
%endif
d81aa2
d81aa2
%check
acd097
%if %{with python2}
e59dc0
PYTHON=python2 %{__python2} setup.py test
acd097
%endif
acd097
%if %{with python3}
e59dc0
PYTHON=python3 %{__python3} setup.py test
d81aa2
%endif
d81aa2
acd097
%if %{with python2}
d81aa2
%files -n python2-%{pypi_name}
d81aa2
%license LICENSE
d81aa2
%doc README.rst
d81aa2
%{_bindir}/renderspec
d81aa2
%{_bindir}/renderspec-2
d81aa2
%{_bindir}/renderspec-%{python2_version}
d81aa2
%{python2_sitelib}/%{pypi_name}
d81aa2
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
acd097
%endif
d81aa2
acd097
%if %{with python3}
d81aa2
%files -n python3-%{pypi_name}
d81aa2
%license LICENSE
d81aa2
%doc README.rst
acd097
%{_bindir}/renderspec
d81aa2
%{_bindir}/renderspec-3
d81aa2
%{_bindir}/renderspec-%{python3_version}
d81aa2
%{python3_sitelib}/%{pypi_name}
d81aa2
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
d81aa2
%endif
d81aa2
d81aa2
%files -n python-%{pypi_name}-doc
d81aa2
%license LICENSE
d81aa2
%doc html
d81aa2
d81aa2
%changelog
acd097
* Tue Feb 26 2019 Javier Peña <jpena@redhat.com> - 1.7.0-8
acd097
- Removed python2 subpackage from Fedora
acd097
0287bc
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.0-7
0287bc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
0287bc
e59dc0
* Tue Aug 07 2018 Javier Peña <jpena@redhat.com> - 1.7.0-6
e59dc0
- Fixed Rawhide build (bz#1605872)
e59dc0
c43187
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.0-5
c43187
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
c43187
414c56
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.7.0-4
414c56
- Rebuilt for Python 3.7
414c56
bb9bc7
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.0-3
bb9bc7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
bb9bc7
d81aa2
* Fri Sep 22 2017 Javier Peña <jpena@redhat.com> - 1.7.0-2
d81aa2
- Fixes to issues found during review
d81aa2
- Use py2_dist and py3_dist for requirements
d81aa2
d81aa2
* Wed Sep 20 2017 Javier Peña <jpena@redhat.com> - 1.7.0-1
d81aa2
- Initial package.