File python-josepy.spec of Package python-josepy

# spec file for package python-josepy
# Copyright (c) 2018 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

%{?!python_module:%define python_module() python-%{**} python3-%{**}}

%define libname josepy
%bcond_with     test

Name:           python-%{libname}
Version:        1.1.0
Release:        0
Summary:        JOSE protocol implementation in Python
License:        Apache-2.0
Group:          Development/Languages/Python
Source2:        %{name}.keyring
BuildRequires:  %{python_module cryptography >= 0.8}
BuildRequires:  %{python_module devel >= 2.7}
BuildRequires:  %{python_module pyOpenSSL >= 0.13}
BuildRequires:  %{python_module setuptools >= 1.0}
BuildRequires:  %{python_module six >= 1.9.0}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
# for doc
BuildRequires:  %{python_module Sphinx >= 1.0}
BuildRequires:  %{python_module sphinx_rtd_theme}
%if %{with test}
BuildRequires:  %{python_module coverage >= 4.0}
BuildRequires:  %{python_module flake8}
BuildRequires:  %{python_module mock}
BuildRequires:  %{python_module pytest >= 2.8.0}
BuildRequires:  %{python_module pytest-cache >= 1.0}
BuildRequires:  %{python_module pytest-cov}
BuildRequires:  %{python_module pytest-flake8 >= 0.5}
BuildRequires:  %{python_module pytest-isort}
Requires:       python-cryptography >= 0.8
Requires:       python-pyOpenSSL >= 0.13
Requires:       python-six >= 1.5.2
Conflicts:      python-acme < 0.21.0
BuildArch:      noarch


JOSE protocol implementation in Python using cryptography.
It is used by the certbot project. Formerly Let's Encrypt project.

%package -n python-%{libname}-doc
Summary:        Documentation for python-josepy libraries
#Provides:       %%{python_module %%{libname}-doc = %%{version}}
Group:          Documentation/HTML

%description -n python-%{libname}-doc
Documentation for the JOSE protocol implementation libraries

%setup -q -n %{libname}-%{version}

# create docs. Possible formats: man text html epub
pushd docs
make %{?_smp_mflags} html
rm -rf _build/html/{.buildinfo,man,_sources}

# remove test-data
%python_expand rm -rf %{buildroot}%{$python_sitelib}/%{libname}/testdata
%python_expand rm -rf %{buildroot}%{$python_sitelib}/%{libname}/**
%python_expand rm -rf %{buildroot}%{$python_sitelib}/%{libname}/**/**
%python_expand rm -rf %{buildroot}%{$python_sitelib}/%{libname}/__pycache__/*_test*
# remove duplicates
%python_expand %fdupes %{buildroot}%{$python_sitelib}/%{libname}

%if %{with test}
# rise up errors. Find no fix.
%python_exec test

%files %{python_files}
%doc LICENSE.txt
%pycache_only %{python_sitelib}/%{libname}/__pycache__
# following the certbot-packaging guide, "jws" should not be packaged
%exclude %{_bindir}/jws

%files -n python-%{libname}-doc
%doc LICENSE.txt
%doc README.rst
%doc docs/_build/html

openSUSE Build Service is sponsored by