Modernize spec

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
epel8
Igor Gnatenko 8 years ago
parent 945debdbc7
commit 7a35717911

1
.gitignore vendored

@ -1,2 +1,3 @@
/service_identity-14.0.0.tar.gz
/service_identity-16.0.0.tar.gz
/service-identity-16.0.0.tar.gz

@ -1,148 +1,128 @@
%if 0%{?fedora}
%global with_python3 1
%bcond_without check
%global modname service-identity
%global srcname service_identity
%if 0%{?rhel} && 0%{?rhel} <= 7
%bcond_with python3
%else
%bcond_without python3
%endif
Name: python-service-identity
Name: python-%{modname}
Version: 16.0.0
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Service identity verification for pyOpenSSL
License: MIT
URL: https://github.com/pyca/service_identity
Source0: https://pypi.io/packages/source/s/service_identity/service_identity-%{version}.tar.gz
Source0: %{url}/archive/%{version}/%{modname}-%{version}.tar.gz
BuildArch: noarch
%global _description \
Service Identity Verification for pyOpenSSL.\
\
TL;DR: Use this package if you use pyOpenSSL and dont want to be MITMed.\
\
service_identity aspires to give you all the tools you need for verifying\
whether a certificate is valid for the intended purposes.\
\
In the simplest case, this means host name verification. However,\
service_identity implements RFC 6125 fully and plans to add other\
relevant RFCs too.
%description %{_description}
%package -n python2-%{modname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{modname}}
BuildRequires: python2-devel
BuildRequires: python-setuptools
%if 0%{?fedora} > 20
# Fedora 20 doesn't have a new enough version of pytest,
# so skip running the tests there.
# For tests
BuildRequires: pytest >= 2.5
BuildRequires: python-attrs
BuildRequires: python-pyasn1
BuildRequires: python-pyasn1-modules
BuildRequires: pyOpenSSL >= 0.12
BuildRequires: python-idna
%endif # fedora > 20
%if 0%{?with_python3}
BuildRequires: python2-setuptools
%if %{with check}
BuildRequires: python2-pytest
BuildRequires: python2-attrs
BuildRequires: python2-pyasn1
BuildRequires: python2-pyasn1-modules
BuildRequires: python2-pyOpenSSL
BuildRequires: python2-idna
%endif
Requires: python2-attrs
Requires: python2-pyasn1
Requires: python2-pyasn1-modules
Requires: python2-pyOpenSSL
Recommends: python2-idna
%description -n python2-%{modname} %{_description}
Python 2 version.
%if %{with python3}
%package -n python3-%{modname}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{modname}}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%if 0%{?fedora} > 20
# For tests
BuildRequires: python3-pytest >= 2.5
%if %{with check}
BuildRequires: python3-pytest
BuildRequires: python3-attrs
BuildRequires: python3-pyasn1
BuildRequires: python3-pyasn1-modules
BuildRequires: python3-pyOpenSSL >= 0.12
BuildRequires: python3-pyOpenSSL
BuildRequires: python3-idna
%endif # fedora > 20
%endif # with_python3
Requires: python-attrs
Requires: python-pyasn1
Requires: python-pyasn1-modules
Requires: pyOpenSSL >= 0.12
Requires: python-idna
%if 0%{?with_python3}
%package -n python3-service-identity
Summary: Logging as Storytelling
Requires: python3-six
%endif
Requires: python3-attrs
Requires: python3-pyasn1
Requires: python3-pyasn1-modules
Requires: python3-pyOpenSSL >= 0.12
Requires: python3-idna
%endif # with_python3
Requires: python3-pyOpenSSL
Recommends: python3-idna
%description
Service Identity Verification for pyOpenSSL
%description -n python3-%{modname} %{_description}
TL;DR: Use this package if you use pyOpenSSL and dont want to be MITMed.
service_identity aspires to give you all the tools you need for verifying
whether a certificate is valid for the intended purposes.
In the simplest case, this means host name verification. However,
service_identity implements RFC 6125 fully and plans to add other relevant RFCs
too.
%if 0%{?with_python3}
%description -n python3-service-identity
Service Identity Verification for pyOpenSSL
TL;DR: Use this package if you use pyOpenSSL and dont want to be MITMed.
service_identity aspires to give you all the tools you need for verifying
whether a certificate is valid for the intended purposes.
In the simplest case, this means host name verification. However,
service_identity implements RFC 6125 fully and plans to add other relevant RFCs
too.
%endif # with_python3
Python 3 version.
%endif
%prep
%setup -q -n service_identity-%{version}
# Remove bundled egg-info
rm -rf service_identity.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif # with_python3
%autosetup -n %{srcname}-%{version}
%build
%{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3
%if 0%{?fedora} > 20
%check
# https://bitbucket.org/hpk42/pytest/issue/539/pytest-doctest-modules-fails-if-python
echo "collect_ignore = ['build']" >> conftest.py
PYTHONPATH="%{buildroot}/%{python2_sitelib}" py.test --doctest-modules --doctest-glob='*.rst'
%if 0%{?with_python3}
pushd %{py3dir}
# https://bitbucket.org/hpk42/pytest/issue/539/pytest-doctest-modules-fails-if-python
echo "collect_ignore = ['build']" >> conftest.py
PYTHONPATH="%{buildroot}/%{python3_sitelib}" py.test-3 --doctest-modules --doctest-glob='*.rst'
popd
%endif # with_python3
%endif # fedora > 20
%py2_build
%if %{with python3}
%py3_build
%endif
%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif # with_python3
%{__python2} setup.py install --skip-build --root %{buildroot}
%py2_install
%if %{with python3}
%py3_install
%endif
%files
%doc README.rst LICENSE
%{python2_sitelib}/service_identity
%{python2_sitelib}/service_identity-%{version}-py%{python2_version}.egg-info
%if %{with check}
%check
PYTHONPATH=%{buildroot}%{python2_sitelib} py.test-%{python2_version} -v
%if %{with python3}
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} -v
%endif
%endif
%if 0%{?with_python3}
%files -n python3-service-identity
%doc README.rst LICENSE
%{python3_sitelib}/service_identity
%{python3_sitelib}/service_identity-%{version}-py%{python3_version}.egg-info
%endif # with_python3
%files -n python2-%{modname}
%license LICENSE
%doc README.rst
%{python2_sitelib}/%{srcname}-*.egg-info/
%{python2_sitelib}/%{srcname}/
%if %{with python3}
%files -n python3-%{modname}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{srcname}-*.egg-info/
%{python3_sitelib}/%{srcname}/
%endif
%changelog
* Mon Dec 19 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 16.0.0-5
- Modernize spec
* Tue Dec 13 2016 Charalampos Stratakis <cstratak@redhat.com> - 16.0.0-4
- Enable tests

@ -1 +1 @@
d52392597b9c44a740abf322bfdb21e6 service_identity-16.0.0.tar.gz
SHA512 (service-identity-16.0.0.tar.gz) = d85ae7a699577dc00e32f376768f3089f0cf332ae54d89ea689618aea3a6557b2cb7029380ecac65d49028b895b59bb80b54c2783cef9a95f3d55308e6c5e899

Loading…
Cancel
Save