14
0
forked from pool/python-tablib

Accepting request 1239134 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1239134
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-tablib?expand=0&rev=14
This commit is contained in:
2025-01-21 20:10:30 +00:00
committed by Git OBS Bridge
3 changed files with 58 additions and 10 deletions

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Jan 20 20:14:38 UTC 2025 - Ben Greiner <code@bnavigator.de>
- Fix dependencies: None of the supported packages are hard
requirements.
- Remove xlwt from build set: Not maintained for 7+ years
* Add tablib-tests-noxls.patch
-------------------------------------------------------------------
Sat Jan 18 11:31:03 UTC 2025 - ecsos <ecsos@opensuse.org>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-tablib
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -28,6 +28,8 @@ Summary: Format agnostic tabular data library (XLS, JSON, YAML, CSV)
License: MIT
URL: https://github.com/jazzband/tablib
Source: https://files.pythonhosted.org/packages/source/t/tablib/tablib-%{version}.tar.gz
# PATCH-FEATURE-OPENSUSE tablib-tests-noxls.patch -- disable tests that require xlwt, code@bnavigator.de
Patch0: tablib-tests-noxls.patch
BuildRequires: %{python_module PyYAML}
BuildRequires: %{python_module base >= 3.9}
BuildRequires: %{python_module odfpy}
@@ -40,15 +42,14 @@ BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module tabulate}
BuildRequires: %{python_module wheel}
BuildRequires: %{python_module xlrd}
BuildRequires: %{python_module xlwt}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-PyYAML
Requires: python-odfpy
Requires: python-openpyxl >= 2.6.0
Requires: python-tabulate
Requires: python-xlrd
Requires: python-xlwt
Suggests: python-PyYAML
Suggests: python-odfpy
Suggests: python-openpyxl >= 2.6.0
Suggests: python-tabulate
Suggests: python-xlrd
Suggests: python-xlwt
Suggests: python-pandas
BuildArch: noarch
%python_subpackages
@@ -66,7 +67,7 @@ Output formats supported:
- CSV (Sets)
%prep
%setup -q -n tablib-%{version}
%autosetup -p1 -n tablib-%{version}
# Remove shebang lines from non-executable scripts:
find src -name "*.py" | xargs sed -i '1 { /^#!/ d }'
sed -i '/addopts/ d' pytest.ini
@@ -80,7 +81,8 @@ sed -i '/addopts/ d' pytest.ini
%check
# v3.2.1: test_cli_export_github fails on Leap 15.3 & .4 due to minor differences in output
%pytest -k 'not test_cli_export_github'
donttest="test_cli_export_github"
%pytest -k "not ($donttest)"
%files %{python_files}
%license LICENSE

38
tablib-tests-noxls.patch Normal file
View File

@@ -0,0 +1,38 @@
diff -ur tablib-3.7.0/tests/test_tablib.py tablib-3.7.0.patched/tests/test_tablib.py
--- tablib-3.7.0/tests/test_tablib.py 2024-10-08 15:11:38.000000000 +0200
+++ tablib-3.7.0.patched/tests/test_tablib.py 2025-01-20 21:38:50.331022734 +0100
@@ -16,6 +16,7 @@
import xlrd
from odf import opendocument, table
from openpyxl.reader.excel import load_workbook
+import pytest
import tablib
from tablib.core import Row, detect_format
@@ -53,7 +54,7 @@
def _test_export_data_in_all_formats(self, dataset, exclude=()):
all_formats = [
- 'json', 'yaml', 'csv', 'tsv', 'xls', 'xlsx', 'ods', 'html', 'jira',
+ 'json', 'yaml', 'csv', 'tsv', 'xlsx', 'ods', 'html', 'jira',
'latex', 'df', 'rst',
]
for format_ in all_formats:
@@ -400,9 +401,6 @@
"""Test auto format detection."""
# html, jira, latex, rst are export only.
- _xls = self.founders.export('xls')
- self.assertEqual(tablib.detect_format(_xls), 'xls')
-
_xlsx = self.founders.export('xlsx')
self.assertEqual(tablib.detect_format(_xlsx), 'xlsx')
@@ -1280,6 +1278,7 @@
self.assertEqual(cells[2].getAttribute('datevalue'), '2019-10-04T12:30:08')
+@pytest.mark.skip("No XLS support without xlwt")
class XLSTests(BaseTestCase):
def test_xls_format_detect(self):
"""Test the XLS format detection."""