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

%{!?_licensedir: %global license %%doc}

%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2:        %global __python2 /usr/bin/python2}
%{!?python2_sitelib:  %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif

%global modname vcrpy

Name:               python-vcrpy
Version:            1.11.1
Release:            2%{?dist}
Summary:            Automatically mock your HTTP interactions to simplify and speed up testing

Group:              Development/Libraries
License:            MIT
URL:                https://pypi.io/project/vcrpy
Source0:            https://pypi.io/packages/source/v/%{modname}/%{modname}-%{version}.tar.gz

BuildArch:          noarch


BuildRequires:      python2-devel
BuildRequires:      python-setuptools

BuildRequires:      PyYAML
BuildRequires:      python-mock
BuildRequires:      python-six
BuildRequires:      python-contextlib2
BuildRequires:      python-wrapt
#BuildRequires:      python-backport_collections

#Requires:           python-backport_collections

%if 0%{?with_python3}
BuildRequires:      python3-devel
BuildRequires:      python3-setuptools

BuildRequires:      python3-PyYAML
BuildRequires:      python3-mock
BuildRequires:      python3-six
BuildRequires:      python3-contextlib2
BuildRequires:      python3-wrapt
#BuildRequires:      python3-backport_collections
%endif

%global _description\
Simplify and speed up testing HTTP by recording all HTTP interactions and\
saving them to "cassette" files, which are yaml files containing the contents\
of your requests and responses.  Then when you run your tests again, they all\
just hit the text files instead of the internet.  This speeds up your tests and\
lets you work offline.\
\
If the server you are testing against ever changes its API, all you need to do\
is delete your existing cassette files, and run your tests again.  All of the\
mocked responses will be updated with the new API.

%description %_description

%package -n python2-vcrpy
Summary: %summary
Requires:           PyYAML
Requires:           python-mock
Requires:           python-six
Requires:           python-contextlib2
Requires:           python-wrapt
%{?python_provide:%python_provide python2-vcrpy}

%description -n python2-vcrpy %_description

%if 0%{?with_python3}
%package -n python3-vcrpy
Summary:            Automatically mock your HTTP interactions to simplify and speed up testing
Group:              Development/Libraries

Requires:           python3-PyYAML
Requires:           python3-mock
Requires:           python3-six
Requires:           python3-contextlib2
Requires:           python3-wrapt
#Requires:           python3-backport_collections

%description -n python3-vcrpy
Simplify and speed up testing HTTP by recording all HTTP interactions and
saving them to "cassette" files, which are yaml files containing the contents
of your requests and responses.  Then when you run your tests again, they all
just hit the text files instead of the internet.  This speeds up your tests and
lets you work offline.

If the server you are testing against ever changes its API, all you need to do
is delete your existing cassette files, and run your tests again.  All of the
mocked responses will be updated with the new API.
%endif

%prep
%setup -q -n %{modname}-%{version}

sed -i "s/backport_collections/collections/g" vcr/filters.py
sed -i "s/backport_collections/collections/g" vcr/cassette.py
sed -i "s/, 'backport_collections'//g" setup.py

# Remove bundled egg-info in case it exists
rm -rf %{modname}.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
# This file has python3 stuff in it so just remove from py2 build.
# https://github.com/kevin1024/vcrpy/issues/330
rm -f vcr/_handle_coroutine.py
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif

%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
popd
%endif
%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}

## Cannot run tests because they require python-pytest-localserver which is not
## yet packaged.
#%%check
#%%{__python2} setup.py test
#%%if 0%%{?with_python3}
#pushd %%{py3dir}
#%%{__python3} setup.py test
#popd
#%%endif

%files -n python2-vcrpy
# No readme or license yet
# https://github.com/kevin1024/vcrpy/pull/148
#%doc README.md
#%license LICENSE.txt
%{python2_sitelib}/vcr/
%{python2_sitelib}/%{modname}-%{version}*

%if 0%{?with_python3}
%files -n python3-vcrpy
# No readme or license yet
# https://github.com/kevin1024/vcrpy/pull/148
#%doc README.md
#%license LICENSE.txt
%{python3_sitelib}/vcr/
%{python3_sitelib}/%{modname}-%{version}*
%endif

%changelog
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.11.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Fri Sep 15 2017 Kevin Fenzi <kevin@scrye.com> - 1.11.1-1
- Update to 1.11.1. Fixes bug #1447325

* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.10.5-4
- Python 2 binary package renamed to python2-vcrpy
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Fri Jan 13 2017 Kevin Fenzi <kevin@scrye.com> - 1.10.5-1
- Update to 1.10.5. Fixes bug #1412604

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 1.10.4-2
- Rebuild for Python 3.6

* Fri Dec 16 2016 Ralph Bean <rbean@redhat.com> - 1.10.4-1
- new version

* Sun Oct 02 2016 Kevin Fenzi <kevin@scrye.com> - 1.10.3-1
- Update to 1.10.3. Fixes bug #1381102

* Sat Sep 17 2016 Kevin Fenzi <kevin@scrye.com> - 1.10.2-1
- Update to 1.10.2. Fixes bug #1376311

* Mon Sep 12 2016 Kevin Fenzi <kevin@scrye.com> - 1.10.1-1
- Update to 1.10.1.

* Fri Sep 09 2016 Kevin Fenzi <kevin@scrye.com> - 1.10.0-1
- Update to 1.10.0. Fixes bug #1370830

* Wed Jul 27 2016 Ralph Bean <rbean@redhat.com> - 1.9.0-1
- new version

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

* Wed Jun 15 2016 Ralph Bean <rbean@redhat.com> - 1.8.0-1
- new version

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

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

* Mon Oct 19 2015 Ralph Bean <rbean@redhat.com> - 1.7.4-1
- new version

* Wed Sep 16 2015 Ralph Bean <rbean@redhat.com> - 1.7.3-1
- new version

* Mon Jul 06 2015 Ralph Bean <rbean@redhat.com> - 1.6.0-1
- new version

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

* Thu May 28 2015 Ralph Bean <rbean@redhat.com> - 1.5.2-2
- Move python3 deps into the python3 subpackage.

* Sat May 16 2015 Ralph Bean <rbean@redhat.com> - 1.5.2-1
- new version

* Fri May 15 2015 Ralph Bean <rbean@redhat.com> - 1.5.1-1
- new version

* Wed May 06 2015 Ralph Bean <rbean@redhat.com> - 1.4.2-1
- Adjusted spec with feedback from package review.
- Fix original changelog entry.
- Fix directory ownership in the files section.
- Latest upstream.

* Sat Apr 11 2015 Ralph Bean <rbean@redhat.com> 1.4.0-1
- initial package for Fedora