Accepting request 680141 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/680141
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-brotlipy?expand=0&rev=3
This commit is contained in:
Stephan Kulow 2019-03-01 19:30:33 +00:00 committed by Git OBS Bridge
commit 706c7d05be
4 changed files with 62 additions and 5 deletions

30
conftest.py Normal file
View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
import os
import os.path
import pytest
# Statically look for all the files.
curdir = os.path.split(os.path.dirname(__file__))[0]
TEST_DATA_DIR = os.path.join(curdir, 'libbrotli', 'tests', 'testdata')
simple_test_files = [
os.path.join(TEST_DATA_DIR, p) for p in os.listdir(TEST_DATA_DIR)
]
compressed_simple_test_files = set(
f for f in simple_test_files if f.endswith('.compressed')
)
@pytest.fixture(params=compressed_simple_test_files)
def simple_compressed_file(request):
"""
Returns a two-tuple: (uncompressed_file, compressed_file), from the Brotli
test fixtures.
"""
file = request.param
return (file[:-len('.compressed')], file)
@pytest.fixture()
def one_compressed_file():
return os.path.join(TEST_DATA_DIR, 'alice29.txt')

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Feb 28 06:43:41 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Add missing runtime dependency enum34
- Use %license, and add the libbrotli LICENSE
- Activate test suite
-------------------------------------------------------------------
Sun Feb 25 16:33:51 UTC 2018 - aloisio@gmx.com

View File

@ -1,7 +1,7 @@
#
# spec file for package python-brotlipy
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 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
@ -12,7 +12,7 @@
# 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/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
@ -25,14 +25,22 @@ License: MIT
Group: Development/Languages/Python
Url: https://github.com/python-hyper/brotlipy
Source0: https://pypi.io/packages/source/b/brotlipy/brotlipy-%{version}.tar.gz
# Copy of https://github.com/google/brotli/tree/46c1a881b41bb638c76247558aa04b1591af3aa7/tests/testdata
Source1: testdata.tgz
Source2: https://raw.githubusercontent.com/python-hyper/brotlipy/master/test/conftest.py
BuildRequires: %{python_module cffi >= 1.0.0}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module hypothesis}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: python-enum34
BuildRequires: python-rpm-macros
Requires: python-cffi >= 1.0.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%ifpython2
Requires: python-enum34
%endif
%python_subpackages
%description
@ -43,6 +51,12 @@ directly from Python code.
%prep
%setup -q -n brotlipy-%{version}
mv libbrotli/LICENSE LICENSE.libbrotli
cp %{SOURCE2} test/
cd libbrotli
mkdir -p tests
cd tests
tar -xzf %{SOURCE1}
%build
export CFLAGS="%{optflags}"
@ -53,9 +67,12 @@ export CXXFLAGS="%{optflags}"
%python_install
%python_expand %fdupes -s %{buildroot}%{$python_sitearch}
%check
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -m pytest
%files %{python_files}
%defattr(-,root,root,-)
%doc LICENSE README.rst
%license LICENSE LICENSE.libbrotli
%doc README.rst
%{python_sitearch}/brotli
%{python_sitearch}/brotlipy-%{version}-py%{py_ver}.egg-info

3
testdata.tgz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:08e47d7b61284d02a71c45548b7ab981d74c2c1f68c9137fafb963998e1a127c
size 7106191