File python3-backports.ssl_match_hostname.spec of Package python3-backports.ssl_match_hostname
#
# spec file for package python3-backports.ssl_match_hostname
#
# 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: python3-backports.ssl_match_hostname
Version: 3.5.0.1
Release: 0
Summary: The ssl.match_hostname() function from Python 3.4
License: Python-2.0
Group: Development/Languages/Python
Url: http://bitbucket.org/brandon/backports.ssl_match_hostname
Source: https://files.pythonhosted.org/packages/source/b/backports.ssl_match_hostname/backports.ssl_match_hostname-%{version}.tar.gz
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
Requires(post): update-alternatives
Requires(postun): update-alternatives
%description
The Secure Sockets layer is only actually *secure*
if you check the hostname in the certificate returned
by the server to which you are connecting,
and verify that it matches to hostname
that you are trying to reach.
%prep
%setup -q -n backports.ssl_match_hostname-%{version}
%build
python3 setup.py build
%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
# Prepare for update-alternatives usage
mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
mv %{buildroot}%{python3_sitelib}/backports/__init__.py %{buildroot}%{python3_sitelib}/backports/__init__ssl_match_hostname.py
ln -s -f %{_sysconfdir}/alternatives/__init__.py %{buildroot}%{python3_sitelib}/backports/__init__.py
# create a dummy target for /etc/alternatives/__init__.py
touch %{buildroot}%{_sysconfdir}/alternatives/__init__.py
rm -rf %{buildroot}%{python3_sitelib}/backports/__pycache__/
%post
"%_sbindir/update-alternatives" \
--install %{python3_sitelib}/backports/__init__.py __init__.py %{python3_sitelib}/backports/__init__ssl_match_hostname.py 30
%postun
if [ $1 -eq 0 ] ; then
"%_sbindir/update-alternatives" --remove __init__.py %{python3_sitelib}/backports/__init__ssl_match_hostname.py
fi
%files
%defattr(-,root,root,-)
%dir %{python3_sitelib}/backports/
%{python3_sitelib}/backports/__init__.py
%{python3_sitelib}/backports/__init__ssl_match_hostname.py
%ghost %{_sysconfdir}/alternatives/__init__.py
%{python3_sitelib}/backports/ssl_match_hostname/
%{python3_sitelib}/backports.ssl_match_hostname-%{version}-py*.egg-info
%changelog