Blob Blame History Raw
%global with_python3 1
%global pypi_name dropbox
Name:           python-%{pypi_name}
Version:        2.2.0
Release:        3%{?dist}
Summary:        Official Dropbox REST API Client
License:        MIT

URL:            https://www.dropbox.com/developers/core/sdks
Source0:        https://pypi.python.org/packages/source/d/%{pypi_name}/%{pypi_name}-%{version}.zip

# Don't install tests
Patch0:         %{pypi_name}-setup-tests.patch

BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  python-mock
BuildRequires:  python-setuptools
BuildRequires:  python-urllib3
Requires:       python-urllib3

%if 0%{with_python3}
BuildRequires:  python-tools
BuildRequires:  python3-devel
BuildRequires:  python3-mock
BuildRequires:  python3-setuptools
BuildRequires:  python3-urllib3
%endif

%description
A Python library for Dropbox's HTTP-based Core and Datastore APIs.

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:        Official Dropbox REST API Client
Requires:       python3-urllib3

%description -n python3-%{pypi_name}
A Python library for Dropbox's HTTP-based Core and Datastore APIs.
%endif # with_python3

%prep
%setup -q -n %{pypi_name}-%{version}
%patch0 -p1
rm -rf %{pypi_name}.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/env python|#!%{__python3}|'
%endif # with_python3
chmod -x example/*.py example/*/*.py

%build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3

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

%check
# Tests fail in Koji because they require network access
# also they fail to validate certificates.
# Skip building tests

#%{__python} setup.py test || :
#%if 0%{?with_python3}
#pushd %{py3dir}
#%{__python3} setup.py test || :
#popd
#%endif # with_python3

%files
%doc README.rst CHANGELOG.mdown LICENSE example
%{python_sitelib}/%{pypi_name}
%{python_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info

%if 0%{?with_python3}
%files -n python3-%{pypi_name}
# examples don't work with Python 3 (even when 2to3ed)
%doc README.rst CHANGELOG.mdown LICENSE
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif # with_python3

%changelog
* Sat Aug 15 2015 Stephen Gallagher <sgallagh@redhat.com> 2.2.0-3
- Disable tests to resolve FTBFS
- Performed as part of the Flock 2015 Package Cleanup Workshop

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

* Wed Sep 24 2014 Miro Hrončok <mhroncok@redhat.com> - 2.2.0-1
- Updated to 2.2.0 (#1145025)

* Sat Jun 07 2014 Miro Hrončok <mhroncok@redhat.com> - 2.1.0-1
- Updated to 2.1.0 (#1104561)

* Wed May 14 2014 Miro Hrončok <mhroncok@redhat.com> - 2.0.0-2
- Rebuilt for Python 3.4

* Wed May 14 2014 Miro Hrončok <mhroncok@redhat.com> - 2.0.0-1
- Updated to 2.0.0

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

* Wed Jul 17 2013 Miro Hrončok <mhroncok@redhat.com> - 1.6-3
- Use source package from dropbox.org
- Added LICENSE
- chmod -x examples
- Added BR python-mock

* Wed Jul 10 2013 Miro Hrončok <mhroncok@redhat.com> - 1.6-2
- Removed duplicate BR python3-setuptools
- Delete bundled egg-info

* Mon Jul 08 2013 Miro Hrončok <mhroncok@redhat.com> - 1.6-1
- First package