Blob Blame History Raw
%if 0%{?fedora} > 12
%global with_python3 1
%endif

%global pypi_name pelican
%{!?__python2:%global __python2 %{__python}}
Name:           python-%{pypi_name}
Version:        3.6.3
Release:        6%{?dist}
Summary:        A tool to generate a static blog from reStructuredText or Markdown input files

License:        AGPLv3
URL:            http://getpelican.com
Source0:        https://github.com/getpelican/pelican/archive/%{version}.tar.gz#/%{pypi_name}-%{version}.tar.gz

BuildArch:      noarch

%description
Pelican is a static site generator, written in Python_.

* Write your weblog entries directly with your editor of choice (vim!)
  in reStructuredText_ or Markdown_
* Includes a simple CLI tool to ...


%package -n python2-%{pypi_name}
Summary:        A tool to generate a static blog from reStructuredText or Markdown input files
%{?python_provide:%python_provide python2-%{pypi_name}}

BuildRequires:  python-devel
BuildRequires:  python-sphinx
BuildRequires:  python-blinker
BuildRequires:  python-unidecode

BuildRequires:  python-mock
BuildRequires:  python-markdown
BuildRequires:  python-beautifulsoup4
BuildRequires:  python-lxml
BuildRequires:  python-six
BuildRequires:  pytz
BuildRequires:  python-jinja2
BuildRequires:  python-django
BuildRequires:  python-dateutil
BuildRequires:  python-nose
BuildRequires:  python-nose-cov

Requires:  python-blinker
Requires:  python-six
Requires:  python-unidecode
Requires:  python-jinja2
Requires:  pytz
Requires:  python-pygments
Requires:  python-docutils
Requires:  python-django
Requires:  python-markdown
Requires:  python-feedparser
Requires:  python-dateutil


%description -n python2-%{pypi_name}
Pelican is a static site generator, written in Python_.

* Write your weblog entries directly with your editor of choice (vim!)
  in reStructuredText_ or Markdown_
* Includes a simple CLI tool to ...

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:        A tool to generate a static blog from reStructuredText or Markdown input files
%{?python_provide:%python_provide python3-%{pypi_name}}

BuildRequires:  python3-devel
BuildRequires:  python3-blinker
BuildRequires:  python3-unidecode

BuildRequires:  python3-mock
BuildRequires:  python3-markdown
BuildRequires:  python3-beautifulsoup4
BuildRequires:  python3-lxml
BuildRequires:  python3-six
BuildRequires:  python3-pytz
BuildRequires:  python3-jinja2
BuildRequires:  python3-django
BuildRequires:  python3-dateutil

Requires:  python3-blinker
Requires:  python3-six
Requires:  python3-unidecode
Requires:  python3-jinja2
Requires:  python3-pytz
Requires:  python3-pygments
Requires:  python3-docutils
Requires:  python3-django
Requires:  python3-markdown
Requires:  python3-feedparser
Requires:  python3-dateutil


%description -n python3-%{pypi_name}
Pelican is a static site generator, written in Python_.

* Write your weblog entries directly with your editor of choice (vim!)
  in reStructuredText_ or Markdown_
* Includes a simple CLI tool to ...

%endif


%prep
%autosetup -n %{pypi_name}-%{version}
# make file not zero length to silence rpmlint
echo " " > pelican/themes/simple/templates/tag.html

# remove bagpath #!/usr/bin/env from files
sed -i '1d' pelican/tools/pelican_import.py
sed -i '1d' pelican/tools/pelican_quickstart.py
sed -i '1d' pelican/tools/pelican_themes.py
sed -i '1d' pelican/tools/templates/pelicanconf.py.in

# substitute feedgenerator with it's original django
sed -i 's|feedgenerator|django.utils.feedgenerator|' pelican/writers.py
sed -i "s|'feedgenerator >= 1.6', ||" setup.py
sed -i "s|'pytz >= 0a'|'pytz'|" setup.py

%build
%py2_build

# build docs
sphinx-build docs html

# remove leftovers from sphinxbuild
rm html/_downloads/theme-basic.zip html/_static/theme-basic.zip
rm -rf html/.doctrees html/.buildinfo

%if 0%{?with_python3}
%py3_build
%endif

%install
%if 0%{?with_python3}
%py3_install
# rename helpers
mv %{buildroot}/%{_bindir}/pelican %{buildroot}/%{_bindir}/pelican-3
mv %{buildroot}/%{_bindir}/pelican-import %{buildroot}/%{_bindir}/pelican-import-3
mv %{buildroot}/%{_bindir}/pelican-quickstart %{buildroot}/%{_bindir}/pelican-quickstart-3
mv %{buildroot}/%{_bindir}/pelican-themes %{buildroot}/%{_bindir}/pelican-themes-3
%endif


%py2_install


%check
# disable tests for now. they are a bit unstable due comparing
# html attributes via diff. Failed several times, when attributes
# were ordered differently!
#nosetests -sv --with-coverage --cover-package=pelican pelican

%files -n python2-%{pypi_name}
%doc html README.rst
%license LICENSE
%{_bindir}/pelican
%{_bindir}/pelican-import
%{_bindir}/pelican-quickstart
%{_bindir}/pelican-themes
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-*-py?.?.egg-info


%if 0%{?with_python3}
%files -n python3-pelican
%doc html README.rst
%license LICENSE
%{_bindir}/pelican-3
%{_bindir}/pelican-import-3
%{_bindir}/pelican-quickstart-3
%{_bindir}/pelican-themes-3
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-*-py?.?.egg-info
%endif


%changelog
* Wed Aug 03 2016 Matthias Runge <mrunge@redhat.com> - 3.6.3-6
- rename python3 executables (rhbz#1362516)
- modernize spec file

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.3-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Mon Nov 16 2015 Matthias Runge <mrunge@redhat.com> - 3.6.3-3
- properly provide python2-pelican (rhbz#1282229)

* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.6.3-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5


* Wed Nov 04 2015 Matthias Runge <mrunge@redhat.com> - 3.6.3-1
- update to 3.6.3

* Mon Jun 22 2015 Matthias Runge <mrunge@redhat.com> - 3.6.0-1
- update to 3.6.0
- add python3 support (rhbz#1227982)

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.5.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Fri Apr 17 2015 Matthias Runge <mrunge@redhat.com> - 3.5.0-3
- change requirements for pytz

* Mon Mar 23 2015 Matthias Runge <mrunge@redhat.com> - 3.5.0-2
- add runtime requirement python-dateutil(rhbz#1204791)

* Tue Mar 10 2015 Matthias Runge <mrunge@redhat.com> - 3.5.0-1
- update to 3.5.0 (rhbz#1200030)

* Mon Sep 01 2014 Matthias Runge <mrunge@redhat.com> - 3.4.0-1
- update to 3.4.0
- add requires: python-feedparser (rhbz#1135665)

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.3.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon Apr 21 2014 Jamie Nguyen <jamielinux@fedoraproject.org> - 3.3.0-4
- add Requires: python-markdown

* Wed Feb 05 2014 Matthias Rugne <mrunge@redhat.com> - 3.3.0-3
- use __python2 instead of __python
- use a tarball from github, as it significantly differs from pypi
- add tests
- build docs


* Sat Jan 25 2014 Matthias Runge <mrunge@redhat.com> - 3.3-1
- Initial package.