From 00ec0fea30e8ed61a9bd32b9e7ccaca010d9abed60af31a531c3470b16334b28 Mon Sep 17 00:00:00 2001 From: Jan Matejek Date: Thu, 30 Mar 2017 14:12:18 +0000 Subject: [PATCH] Accepting request 483837 from devel:languages:python:singlespec - Switch to singlespec approach OBS-URL: https://build.opensuse.org/request/show/483837 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cryptography?expand=0&rev=59 --- python-cryptography.changes | 5 +++ python-cryptography.spec | 86 +++++++++++++++++++------------------ 2 files changed, 50 insertions(+), 41 deletions(-) diff --git a/python-cryptography.changes b/python-cryptography.changes index d02e519..7b55625 100644 --- a/python-cryptography.changes +++ b/python-cryptography.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Mar 20 20:34:03 UTC 2017 - tbechtold@suse.com + +- Switch to singlespec approach + ------------------------------------------------------------------- Thu Mar 16 14:13:56 UTC 2017 - tbechtold@suse.com diff --git a/python-cryptography.spec b/python-cryptography.spec index 7924646..79efe0d 100644 --- a/python-cryptography.spec +++ b/python-cryptography.spec @@ -16,6 +16,7 @@ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-cryptography Version: 1.8.1 Release: 0 @@ -23,47 +24,48 @@ Summary: Python library which exposes cryptographic recipes and primitive License: Apache-2.0 or BSD-3-Clause Group: Development/Languages/Python Url: https://cryptography.io/en/latest/ -Source0: https://pypi.io/packages/source/c/cryptography/cryptography-%{version}.tar.gz -Source1: https://pypi.io/packages/source/c/cryptography/cryptography-%{version}.tar.gz.asc +Source0: https://files.pythonhosted.org/packages/source/c/cryptography/cryptography-%{version}.tar.gz +Source1: https://files.pythonhosted.org/packages/source/c/cryptography/cryptography-%{version}.tar.gz.asc Source2: %{name}.keyring -Source3: https://pypi.io/packages/source/c/cryptography_vectors/cryptography_vectors-%{version}.tar.gz -Source4: https://pypi.io/packages/source/c/cryptography_vectors/cryptography_vectors-%{version}.tar.gz.asc +Source3: https://files.pythonhosted.org/packages/source/c/cryptography_vectors/cryptography_vectors-%{version}.tar.gz +Source4: https://files.pythonhosted.org/packages/source/c/cryptography_vectors/cryptography_vectors-%{version}.tar.gz.asc # PATCH-FIX-SLE disable-uneven-sizes-tests.patch bnc#944204 Patch1: disable-uneven-sizes-tests.patch - +BuildRequires: %{python_module asn1crypto >= 0.21.0} +BuildRequires: %{python_module cffi >= 1.4.1} +BuildRequires: %{python_module devel} +BuildRequires: %{python_module idna >= 2.1} +BuildRequires: %{python_module pyasn1-modules} +BuildRequires: %{python_module pytz} +BuildRequires: %{python_module setuptools >= 11.3} +BuildRequires: %{python_module six >= 1.4.1} +BuildRequires: python-rpm-macros +BuildRequires: python2-enum34 +BuildRequires: python2-ipaddress +# SECTION Test requirements +BuildRequires: %{python_module hypothesis} +BuildRequires: %{python_module iso8601} +BuildRequires: %{python_module pretend} +BuildRequires: %{python_module pyasn1 >= 0.1.8} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module virtualenv} +# /SECTION +BuildRequires: fdupes BuildRequires: libopenssl-devel -BuildRequires: pkg-config -BuildRequires: python-asn1crypto >= 0.21.0 -BuildRequires: python-cffi >= 1.4.1 -BuildRequires: python-devel -BuildRequires: python-enum34 -BuildRequires: python-idna >= 2.1 -BuildRequires: python-ipaddress -BuildRequires: python-pyasn1-modules -BuildRequires: python-setuptools >= 11.3 -BuildRequires: python-six >= 1.4.1 -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -BuildRequires: libffi43-devel -%else -BuildRequires: python-hypothesis +BuildRequires: pkgconfig BuildRequires: pkgconfig(libffi) -%endif -BuildRequires: python-pytz -# Test requirements -BuildRequires: python-iso8601 -BuildRequires: python-pretend -BuildRequires: python-pyasn1 >= 0.1.8 -BuildRequires: python-pytest -BuildRequires: python-virtualenv -%requires_eq python-cffi Requires: python-asn1crypto >= 0.21.0 -Requires: python-enum34 Requires: python-idna >= 2.1 -Requires: python-ipaddress Requires: python-pyasn1 >= 0.1.8 Requires: python-setuptools >= 11.3 Requires: python-six >= 1.4.1 +%requires_eq python-cffi BuildRoot: %{_tmppath}/%{name}-%{version}-build +%ifpython2 +Requires: python-enum34 +Requires: python-ipaddress +%endif +%python_subpackages %description cryptography is a package designed to expose cryptographic @@ -85,33 +87,35 @@ tar xvzf %{SOURCE3} %patch1 -p1 %build -CFLAGS="%{optflags} -fno-strict-aliasing" python setup.py build +export CFLAGS="%{optflags} -fno-strict-aliasing" +%python_build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%python_install +%fdupes %{buildroot}%{_prefix} %check %if 0%{?suse_version} >= 1210 -# this is going to be fun +%{python_expand # this is going to be fun # create virtualenv -virtualenv --system-site-packages TESTROOT -. TESTROOT/bin/activate +$python %{_bindir}/virtualenv --system-site-packages TESTROOT-%{$python_bin_suffix} +. TESTROOT-%{$python_bin_suffix}/bin/activate # install package in virtualenv -python setup.py install +$python setup.py install # install cryptography vectors -(cd cryptography_vectors-%{version} && python setup.py install) +(cd cryptography_vectors-%{version} && $python setup.py install) # run tests with virtualenv'd python # (specify "tests" directory, otherwise py.test discovers tests in virtualenv'd setuptools) -python /usr/bin/py.test tests +$python -m pytest tests # finish deactivate +} %endif -%files +%files %{python_files} %defattr(-,root,root,-) %doc LICENSE LICENSE.APACHE LICENSE.BSD %doc AUTHORS.rst CONTRIBUTING.rst CHANGELOG.rst README.rst -%{python_sitearch}/cryptography/ -%{python_sitearch}/cryptography-%{version}-py%{py_ver}.egg-info/ +%{python_sitearch}/* %changelog