File python-backports.ssl.spec of Package python-backports.ssl

#
# spec file for package python-backports.ssl
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/


Name:           python-backports.ssl
Version:        0.0.9
Release:        0
License:        MIT
Summary:        The Python 34 standard `ssl` module API implemented on top of pyOpenSSL
Url:            https://github.com/alekstorm/backports.ssl
Group:          Development/Languages/Python
Source:         https://pypi.python.org/packages/ca/39/e968b8823a469dd7135ff960057aa27e8a226d2b1ac0a38701e26ce2e19f/backports.ssl-%{version}.tar.gz
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
-------------
backports.ssl
-------------

What is it?
-----------

It's the Python 3.4 standard ``ssl`` module API implemented on top of
pyOpenSSL::

    import backports.ssl as ssl
    import socket

    context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
    context.verify_mode = ssl.CERT_REQUIRED

    conn = context.wrap_socket(socket.socket(socket.AF_INET))
    conn.connect(('google.com', 443))
    print conn.getpeercert()
    conn.close()

Why?
----

Because the latest web technologies should be available to those running older
versions of Python.

Isn't this obsoleted by `PEP 466`_?
-----------------------------------

If you're on Python 2.7, then probably. But PEP 466 doesn't cover Python 2.6,
3.2, or 3.3, and the ``ssl.RAND_*()`` functions are explicitly out of scope.
This package supports it all.

How do I use it with third-party libraries?
-------------------------------------------

Monkey-patching support is included a la `gevent`_::

    import backports.ssl.monkey as monkey
    import requests

    monkey.patch()
    requests.get('https://google.com')


%prep
%setup -q -n backports.ssl-%{version}

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
rm -f %{buildroot}/%{python_sitelib}/backports/__init__*
%files
%defattr(-,root,root,-)
%doc README.rst
%{python_sitelib}/*

%changelog