]> git.pld-linux.org Git - packages/python-httplib2.git/blobdiff - python-httplib2.spec
- added mock patch (prefer unittest.mock from stdlib on python3)
[packages/python-httplib2.git] / python-httplib2.spec
index 6c1d3c63170144cbb93b49c818462b236fe81ea8..a5dfbc5a64cdb4efd0102a89830792edfa3c4b9d 100644 (file)
@@ -1,14 +1,53 @@
+#
+# Conditional build:
+%bcond_without python2 # Python 2.x module
+%bcond_without python3 # Python 3.x module
+%bcond_without doc     # Sphinx documentation
+%bcond_without tests   # unit tests
+
 Summary:       A comprehensive HTTP client library
 Summary(pl.UTF-8):     Obszerna biblioteka klienta HTTP
 Name:          python-httplib2
-Version:       0.3.0
+Version:       0.17.0
 Release:       1
 License:       MIT
 Group:         Development/Languages/Python
-Source0:       http://bitworking.org/projects/httplib2/dist/httplib2-%{version}.tar.gz
-# Source0-md5: 781110e8031bdbe753d80532cfbe1bc4
-URL:           http://bitworking.org/projects/httplib2/
-BuildRequires: python >= 2.3
+#Source0Download: https://github.com/httplib2/httplib2/releases
+# TODO:                https://github.com/httplib2/httplib2/archive/v%{version}/httplib2-%{version}.tar.gz
+Source0:       https://github.com/httplib2/httplib2/archive/v%{version}.tar.gz
+# Source0-md5: fbd0b80a32a4cbb1c3c459294e3a1065
+Patch0:                %{name}.certfile.patch
+Patch1:                %{name}-0.9-proxy-http.patch
+Patch2:                %{name}-mock.patch
+URL:           https://github.com/httplib2/httplib2
+%if %{with python2}
+BuildRequires: python-modules >= 1:2.7
+BuildRequires: python-setuptools
+%if %{with tests}
+BuildRequires: python-future >= 0.16.0
+BuildRequires: python-mock >= 2.0.0
+BuildRequires: python-pytest >= 3.2.1
+BuildRequires: python-pytest-cov >= 2.5.1
+BuildRequires: python-pytest-timeout >= 1.2.0
+BuildRequires: python-six >= 1.10.0
+%endif
+%endif
+%if %{with python3}
+BuildRequires: python3-modules >= 1:3.4
+BuildRequires: python3-setuptools
+%if %{with tests}
+BuildRequires: python3-pytest >= 3.2.1
+BuildRequires: python3-pytest-cov >= 2.5.1
+BuildRequires: python3-pytest-timeout >= 1.2.0
+BuildRequires: python3-six >= 1.10.0
+%endif
+%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.710
+%if %{with doc}
+BuildRequires: sphinx-pdg
+%endif
+Requires:      ca-certificates
 BuildArch:     noarch
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -38,22 +77,99 @@ cech pomijanych przez inne biblioteki. Obsługuje:
 - Lost update
 - podlega testom jednostkowym.
 
+%package -n python3-httplib2
+Summary:       A comprehensive HTTP client library
+Summary(pl.UTF-8):     Obszerna biblioteka klienta HTTP
+Group:         Development/Languages/Python
+Requires:      ca-certificates
+
+%description -n python3-httplib2
+A comprehensive HTTP client library, httplib2.py supports many
+features left out of other HTTP libraries. Supports:
+- HTTP and HTTPS
+- Keep-Alive
+- Authentication
+- Caching
+- All Methods
+- Redirects
+- Compression
+- Lost update support
+- Unit Tested
+
+%description -n python3-httplib2 -l pl.UTF-8
+httplib2.py to obszerna biblioteka klienta HTTP, obsługująca wiele
+cech pomijanych przez inne biblioteki. Obsługuje:
+- HTTP i HTTPS
+- Keep-Alive
+- uwierzytelnianie
+- buforowanie
+- wszystkie metody
+- przekierowania
+- kompresję
+- Lost update
+- podlega testom jednostkowym.
+
 %prep
 %setup -q -n httplib2-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+%build
+%if %{with python2}
+%py_build
+
+%if %{with tests}
+PYTHONPATH=$(pwd)/build-2/lib \
+%{__python} -m pytest tests -k 'not test_certs_file_from_builtin and not test_certs_file_from_environment and not test_with_certifi_removed_from_modules and not test_noproxy_star'
+%endif
+%endif
+
+%if %{with python3}
+%py3_build
+
+%if %{with tests}
+# in python3 implementation system socks module is preferred over httplib2.socks, and the first is incompatible with test_socks5_auth
+PYTHONPATH=$(pwd)/build-3/lib \
+%{__python3} -m pytest tests -k 'not test_certs_file_from_builtin and not test_certs_file_from_environment and not test_with_certifi_removed_from_modules and not test_noproxy_star and not test_server_not_found_error_is_raised_for_invalid_hostname and not test_socks5_auth'
+%endif
+%endif
+
+%if %{with doc}
+%{__make} -C doc html
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install \
-       --root=$RPM_BUILD_ROOT
 
-%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
+%if %{with python2}
+%py_install
+
 %py_postclean
+%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/httplib2/cacerts.txt
+%endif
+
+%if %{with python3}
+%py3_install
+
+%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/httplib2/cacerts.txt
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%if %{with python2}
 %files
 %defattr(644,root,root,755)
-%doc README
-%dir %{py_sitescriptdir}/httplib2
-%{py_sitescriptdir}/httplib2/*.py[co]
+%doc CHANGELOG LICENSE README.md
+%{py_sitescriptdir}/httplib2
+%{py_sitescriptdir}/httplib2-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-httplib2
+%defattr(644,root,root,755)
+%doc CHANGELOG LICENSE README.md python3/README
+%{py3_sitescriptdir}/httplib2
+%{py3_sitescriptdir}/httplib2-%{version}-py*.egg-info
+%endif
This page took 0.093968 seconds and 4 git commands to generate.