2c35039
%global pypi_name josepy
2c35039
2c35039
%if 0%{?rhel} && 0%{?rhel} <= 7
2c35039
%bcond_with python3
ddaae3c
%bcond_with docs
2c35039
%else
2c35039
%bcond_without python3
ddaae3c
%bcond_without docs
ddaae3c
%endif
ddaae3c
ddaae3c
%if 0%{?fedora} && 0%{?fedora} >= 30
ddaae3c
%bcond_with python2
ddaae3c
%else
ddaae3c
%bcond_without python2
2c35039
%endif
2c35039
2c35039
Name:           python-%{pypi_name}
2bed493
Version:        1.2.0
2bed493
Release:        1%{?dist}
2c35039
Summary:        JOSE protocol implementation in Python
2c35039
2c35039
License:        ASL 2.0
2c35039
URL:            https://pypi.python.org/pypi/josepy
2c35039
Source0:        https://files.pythonhosted.org/packages/source/j/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
2c35039
BuildArch:      noarch
2c35039
5ef1d89
# Remove various unpackaged testing dependencies that are used only for linting
5ef1d89
Patch0:         0000-ignore-missing-linters.patch
5ef1d89
2c35039
%if 0%{?rhel} && 0%{?rhel} <= 7
5ef1d89
Patch1:         0001-allow-old-versions.patch
2c35039
%endif
2c35039
ddaae3c
%if %{with python2}
2c35039
BuildRequires:  python2-devel
5ef1d89
BuildRequires:  python2-mock
5ef1d89
BuildRequires:  python2-pytest
2c35039
BuildRequires:  python2-setuptools
2c35039
%endif
2c35039
2c35039
%if %{with python3}
2c35039
BuildRequires:  python3-devel
5ef1d89
BuildRequires:  python3-mock
5ef1d89
BuildRequires:  python3-mypy
5ef1d89
BuildRequires:  python3-pytest
2c35039
BuildRequires:  python3-setuptools
2c35039
%endif
2c35039
ddaae3c
%if %{with docs}
ddaae3c
BuildRequires:  python3-sphinx
ddaae3c
BuildRequires:  python3-sphinx_rtd_theme
ddaae3c
%endif
ddaae3c
2c35039
%description
2c35039
JOSE protocol implementation in Python using cryptography.
2c35039
ddaae3c
%if %{with python2}
2c35039
%package -n     python2-%{pypi_name}
2c35039
Summary:        %{summary}
2c35039
%{?python_provide:%python_provide python2-%{pypi_name}}
2c35039
2c35039
Requires:       python2-cryptography
13cc85a
Requires:       python2-setuptools
13cc85a
Requires:       python2-six
2c35039
BuildRequires:  python2-cryptography
13cc85a
BuildRequires:  python2-setuptools
13cc85a
BuildRequires:  python2-six
2c35039
%if 0%{?rhel} && 0%{?rhel} <= 7
13cc85a
# EL7 has an unversioned name for this package
2c35039
Requires:       pyOpenSSL
2c35039
BuildRequires:  pyOpenSSL
2c35039
%else
2c35039
Requires:       python2-pyOpenSSL
2c35039
BuildRequires:  python2-pyOpenSSL
2c35039
%endif
2c35039
1caf989
%if %{with docs} && !(0%{?rhel} && 0%{?rhel} <= 7)
1caf989
Recommends:     python-%{pypi_name}-doc
1caf989
%endif
1caf989
2c35039
%description -n python2-%{pypi_name}
2c35039
JOSE protocol implementation in Python using cryptography.
2c35039
2c35039
This is the Python 2 version of the package.
ddaae3c
%endif
2c35039
2c35039
%if %{with python3}
2c35039
%package -n     python3-%{pypi_name}
2c35039
Summary:        %{summary}
2c35039
%{?python_provide:%python_provide python3-%{pypi_name}}
2c35039
2c35039
Requires:       python3-cryptography
2c35039
Requires:       python3-pyOpenSSL
2c35039
Requires:       python3-setuptools
2c35039
Requires:       python3-six
2c35039
BuildRequires:  python3-cryptography
2c35039
BuildRequires:  python3-pyOpenSSL
2c35039
BuildRequires:  python3-setuptools
2c35039
BuildRequires:  python3-six
2c35039
1caf989
%if %{with docs} && !(0%{?rhel} && 0%{?rhel} <= 7)
1caf989
Recommends:     python-%{pypi_name}-doc
1caf989
%endif
1caf989
2c35039
%description -n python3-%{pypi_name}
2c35039
JOSE protocol implementation in Python using cryptography.
2c35039
2c35039
This is the Python 3 version of the package.
2c35039
%endif
2c35039
1caf989
%if %{with docs}
1caf989
%package -n python-%{pypi_name}-doc
1caf989
Summary:        Documentation for python-%{pypi_name}
1caf989
Conflicts:      python2-%{pypi_name} < 1.1.0-9
1caf989
Conflicts:      python3-%{pypi_name} < 1.1.0-9
1caf989
%description -n python-%{pypi_name}-doc
1caf989
Documentation for python-%{pypi_name}
1caf989
%endif
1caf989
2c35039
%prep
2c35039
%autosetup -n %{pypi_name}-%{version}
2c35039
# Remove bundled egg-info
2c35039
rm -rf %{pypi_name}.egg-info
2c35039
2c35039
%build
ddaae3c
%if %{with python2}
2c35039
%py2_build
ddaae3c
%endif
ddaae3c
2c35039
%if %{with python3}
2c35039
%py3_build
2c35039
%endif
2c35039
2c35039
# Build documentation
ddaae3c
%if %{with docs}
2c35039
# EL7 has problems building the documentation due to fontawesome-fonts-web only
2c35039
# being available on x86_64
ddaae3c
%{__python3} setup.py install --user
ddaae3c
make -C docs man PATH=${HOME}/.local/bin:$PATH SPHINXBUILD=sphinx-build-3
2c35039
%endif
2c35039
2c35039
%install
ddaae3c
%if %{with python2}
2c35039
%py2_install
ddaae3c
%endif
ddaae3c
2c35039
%if %{with python3}
2c35039
%py3_install
2c35039
%endif
2c35039
ddaae3c
%if %{with docs}
7fdf595
install -Dpm0644 -t %{buildroot}%{_mandir}/man1 docs/_build/man/*.1*
2c35039
%endif
2c35039
2c35039
%check
ddaae3c
%if %{with python2}
5ef1d89
%{__python2} setup.py test
ddaae3c
%endif
ddaae3c
5ef1d89
%if %{with python3}
5ef1d89
%{__python3} setup.py test
5ef1d89
%endif
2c35039
ddaae3c
%if %{with python2}
2c35039
%files -n python2-%{pypi_name}
2c35039
%license LICENSE.txt
2c35039
%doc README.rst
2c35039
%{python2_sitelib}/josepy
2c35039
%{python2_sitelib}/josepy-%{version}-py?.?.egg-info
2c35039
%if ! %{with python3}
2c35039
%{_bindir}/jws
2c35039
%else
2c35039
%exclude %{_mandir}/man1/jws.1*
2c35039
%endif
ddaae3c
%endif
2c35039
2c35039
%if %{with python3}
2c35039
%files -n python3-%{pypi_name}
2c35039
%license LICENSE.txt
2c35039
%doc README.rst
2c35039
%{python3_sitelib}/josepy
2c35039
%{python3_sitelib}/josepy-%{version}-py?.?.egg-info
2c35039
%{_bindir}/jws
1caf989
%endif
1caf989
ddaae3c
%if %{with docs}
1caf989
%files -n python-%{pypi_name}-doc
1caf989
%license LICENSE.txt
1caf989
%doc README.rst
2c35039
%{_mandir}/man1/*
2c35039
%endif
2c35039
2c35039
%changelog
2bed493
* Mon Jul 01 2019 Eli Young <elyscape@gmail.com> - 1.2.0-1
2bed493
- Update to 1.2.0 (#1725899)
2bed493
1caf989
* Thu Jun 27 2019 Eli Young <elyscape@gmail.com> - 1.1.0-9
1caf989
- Split docs to separate package (#1700273)
1caf989
d667f58
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-8
d667f58
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
d667f58
ddaae3c
* Thu Dec 13 2018 Eli Young <elyscape@gmail.com> - 1.1.0-7
ddaae3c
- Remove Python 2 package in Fedora 30+ (#1658534)
ddaae3c
8723d2d
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-6
8723d2d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
8723d2d
5ef1d89
* Mon Jul 02 2018 Eli Young <elyscape@gmail.com> - 1.1.0-5
5ef1d89
- Enable tests
5ef1d89
ae5c89a
* Mon Jul 02 2018 Miro Hrončok <mhroncok@redhat.com> - 1.1.0-4
ae5c89a
- Rebuilt for Python 3.7
ae5c89a
13cc85a
* Fri Jun 29 2018 Eli Young <elyscape@gmail.com> - 1.1.0-3
13cc85a
- Use available python2 metapackages for EPEL7
b2f2914
- Specify binary name for sphinx-build
7fdf595
- Fix permissions on man files
13cc85a
e42192b
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.1.0-2
e42192b
- Rebuilt for Python 3.7
e42192b
e6c2bb1
* Tue Apr 17 2018 Eli Young <elyscape@gmail.com> - 1.1.0-1
e6c2bb1
- Update to 1.1.0 (#1567455)
e6c2bb1
c4a036c
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.0.1-2
c4a036c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
c4a036c
2c35039
* Thu Jan 18 2018 Eli Young <elyscape@gmail.com> - 1.0.1-1
2c35039
- Initial package.