Blob Blame Raw
%bcond_with tests
%bcond_with docs
%bcond_with update_checker

%global pypi_name praw

Name:           python-%{pypi_name}
Version:        3.6.0
Release:        2%{?dist}
Summary:        A python package that allows for simple access to reddit's API

License:        GPLv3+
URL:            https://praw.readthedocs.org
Source0:        https://github.com/praw-dev/praw/archive/v%{version}.tar.gz#/%{pypi_name}-%{version}.tar.gz
Patch0:         praw-%{version}-remove_update_check.patch
BuildArch:      noarch

BuildRequires:  python-setuptools
BuildRequires:  python2-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-devel
%if %{with tests}
BuildRequires:  mock
BuildRequires:  python-betamax < 0.8
BuildRequires:  python-betamax >= 0.7.1
BuildRequires:  python-betamax-matchers < 0.3
BuildRequires:  python-betamax-matchers >= 0.2.0
BuildRequires:  python-betamax-serializers < 0.3
BuildRequires:  python-betamax-serializers >= 0.2
BuildRequires:  python-pytest
BuildRequires:  python-pytest-runner
BuildRequires:  python3-mock
BuildRequires:  python3-betamax < 0.8
BuildRequires:  python3-betamax >= 0.7.1
BuildRequires:  python3-betamax-matchers < 0.3
BuildRequires:  python3-betamax-matchers >= 0.2.0
BuildRequires:  python3-betamax-serializers < 0.3
BuildRequires:  python3-betamax-serializers >= 0.2
BuildRequires:  python3-pytest
BuildRequires:  python3-pytest-runner
%endif
%if %{with docs}
BuildRequires:  python-sphinx
%endif

%description
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that
allows for simple access to reddit's API.

%package -n     python2-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python2-%{pypi_name}}

Requires:       python-decorator >= 4.0.9
Requires:       python-decorator < 4.1
Requires:       python-requests >= 2.3.0
Requires:       python-six >= 1.10
%{?with_update_checker:Requires:       python-update-checker = 0.11}
%description -n python2-%{pypi_name}
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that
allows for simple access to reddit's API.

%package -n     python3-%{pypi_name}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}

Requires:       python3-decorator >= 4.0.9
Requires:       python3-decorator < 4.1
Requires:       python3-requests >= 2.3.0
Requires:       python3-six >= 1.10
%{?with_update_checker:Requires:       python3-update-checker = 0.11}
%description -n python3-%{pypi_name}
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that
allows for simple access to reddit's API.

%if %{with docs}
%package -n python-%{pypi_name}-doc
Summary:        A python package that allows for simple access to reddit's API
%description -n python-%{pypi_name}-doc
PRAW, an acronym for "Python Reddit API Wrapper", is a python package that
allows for simple access to reddit's API.
%endif

%prep
%setup -n %{pypi_name}-%{version}
%{!?with_update_checker:%patch0 -p1}

%build
%py2_build
%py3_build
%if %{with docs}
sphinx-build docs html
rm -rf html/.{doctrees,buildinfo}
%endif

%install
%py2_install
cp %{buildroot}/%{_bindir}/praw-multiprocess %{buildroot}/%{_bindir}/praw-multiprocess-2
ln -sf %{_bindir}/praw-multiprocess-2 %{buildroot}/%{_bindir}/praw-multiprocess-%{python2_version}
%py3_install
cp %{buildroot}/%{_bindir}/praw-multiprocess %{buildroot}/%{_bindir}/praw-multiprocess-3
ln -sf %{_bindir}/praw-multiprocess-3 %{buildroot}/%{_bindir}/praw-multiprocess-%{python3_version}

%if %{with tests}
%check
%{__python2} setup.py test
%{__python3} setup.py test
%endif

%files -n python2-%{pypi_name}
%doc README.rst
%license COPYING
%{_bindir}/praw-multiprocess-2
%{_bindir}/praw-multiprocess-%{python2_version}
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%files -n python3-%{pypi_name}
%doc README.rst
%license COPYING
%{_bindir}/praw-multiprocess
%{_bindir}/praw-multiprocess-3
%{_bindir}/praw-multiprocess-%{python3_version}
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%if %{with docs}
%files -n python-%{pypi_name}-doc
%doc html
%endif

%changelog
* Mon Dec 19 2016 Miro HronĨok <mhroncok@redhat.com> - 3.6.0-2
- Rebuild for Python 3.6

* Wed Nov 16 2016 Fabian Affolter <mail@fabian-affolter.ch> - 3.6.0-1
- Update to latest upstream release 3.6.0

* Fri Aug 26 2016 Fabio Alessandro Locati <fale@fedoraproject.org> - 3.5.0-1
- Update to 3.5.0
- SPEC refactor

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

* Mon Feb 22 2016 Fabian Affolter <mail@fabian-affolter.ch> - 3.4.0-1
- Update to latest upstream release 3.4.0 (rhbz#1310641)

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

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

* Fri Nov  6 2015 Toshio Kuratomi <toshio@fedoraproject.org> - 3.3.0-2
- Only include the scipt in the python3 package.  The one in the python2
  package wouldn't function without manual intervention because it would
  require the python3-praw package but there was no dependency to it.
  Simply dropping it from the python-praw package also fixes the python-praw
  package to not require /usr/bin/python3

* Tue Oct 06 2015 Fabian Affolter <mail@fabian-affolter.ch> - 3.3.0-1
- Update to latest upstream release 3.3.0

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

* Sun Apr 05 2015 Fabian Affolter <mail@fabian-affolter.ch> - 2.1.21-1
- Update to latest upstream release 2.1.21 (rhbz#1206410)

* Fri Jan 23 2015 Fabian Affolter <mail@fabian-affolter.ch> - 2.1.20-1
- Update to latest upstream release (rhbz#1185340)

* Sun Dec 07 2014 Fabian Affolter <mail@fabian-affolter.ch> - 2.1.19-2
- Add requirement python-requests (rhbz#1171444)

* Wed Nov 05 2014 Fabian Affolter <mail@fabian-affolter.ch> - 2.1.19-1
- Update to new upstream release (rhbz#1070176)
- Update patch0

* Sun Sep 14 2014 Fabian Affolter <mail@fabian-affolter.ch> - 2.1.18-2
- Add python3 subpackage (rhbz#1135689)

* Sat Aug 23 2014 Fabian Affolter <mail@fabian-affolter.ch> - 2.1.18-1
- Update to latest upstream version 2.1.18

* Mon Jul 14 2014 Fabian Affolter <mail@fabian-affolter.ch> - 2.1.17-1
- Disable update_checker (rhbz#1103097)
- Update to latest upstream version 2.1.17

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

* Sat May 24 2014 Fabian Affolter <mail@fabian-affolter.ch> - 2.1.16-1
- Spec file update
- Update to latest upstream version 2.1.16

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.15-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.15-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Sat Nov 10 2012 Elad Alfassa <elad@fedoraproject.org> - 1.0.15-3
- Fix more issues from review

* Sat Nov 10 2012 Elad Alfassa <elad@fedoraproject.org> - 1.0.15-2
- Fix few minor problems from review

* Sat Nov 10 2012 Elad Alfassa <elad@fedoraproject.org> - 1.0.15-1
- Initial packaging for Feora