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

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
Group:          Development/Languages/Python
BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch


What is it?

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

    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(('', 443))
    print conn.getpeercert()


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


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

python build

python install --prefix=%{_prefix} --root=%{buildroot}
rm -f %{buildroot}/%{python_sitelib}/backports/__init__*
%doc README.rst