1
0

- Add field_parser.patch to ensure that fields are parsed with

little endian. Created pull request at gh#olemb/dbfread#71.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-dbfread?expand=0&rev=12
This commit is contained in:
Markéta Machová 2024-07-25 10:13:30 +00:00 committed by Git OBS Bridge
commit 36658265a5
7 changed files with 205 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

3
dbfread-2.0.7.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:07c8a9af06ffad3f6f03e8fe91ad7d2733e31a26d2b72c4dd4cfbae07ee3b73d
size 33212

13
field_parser.patch Normal file
View File

@ -0,0 +1,13 @@
Index: dbfread-2.0.7/dbfread/field_parser.py
===================================================================
--- dbfread-2.0.7.orig/dbfread/field_parser.py
+++ dbfread-2.0.7/dbfread/field_parser.py
@@ -175,7 +175,7 @@ class FieldParser:
def parseO(self, field, data):
"""Parse long field (O) and return float."""
- return struct.unpack('d', data)[0]
+ return struct.unpack('<d', data)[0]
def parseT(self, field, data):
"""Parse time field (T)

66
pytest4.patch Normal file
View File

@ -0,0 +1,66 @@
From 53d56bd2c6080280798b021c596c9d783ad832dc Mon Sep 17 00:00:00 2001
From: Stanislav Levin <slev@altlinux.org>
Date: Wed, 29 May 2019 12:01:38 +0300
Subject: [PATCH] Fix Pytest4.x compatibility errors
The next two errors were fixed:
```
[pytest] sections in setup.cfg files should now be named [tool:pytest] to
avoid conflicts with other distutils commands.
```
```
Calling a fixture function directly, as opposed to request them in a test
function, is deprecated.
```
Signed-off-by: Stanislav Levin <slev@altlinux.org>
---
dbfread/test_read_and_length.py | 22 +++++++++++-----------
setup.cfg | 2 +-
2 files changed, 12 insertions(+), 12 deletions(-)
--- a/dbfread/test_read_and_length.py
+++ b/dbfread/test_read_and_length.py
@@ -24,19 +24,19 @@ deleted_records = [{u'NAME': u'Deleted G
u'BIRTHDATE': datetime.date(1979, 12, 22),
u'MEMO': u'Deleted Guy memo'}]
-def test_len():
- assert len(table()) == 2
- assert len(table().deleted) == 1
+def test_len(table, loaded_table):
+ assert len(table) == 2
+ assert len(table.deleted) == 1
- assert len(loaded_table()) == 2
- assert len(loaded_table().deleted) == 1
+ assert len(loaded_table) == 2
+ assert len(loaded_table.deleted) == 1
-def test_list():
- assert list(table()) == records
- assert list(table().deleted) == deleted_records
+def test_list(table, loaded_table):
+ assert list(table) == records
+ assert list(table.deleted) == deleted_records
- assert list(loaded_table()) == records
- assert list(loaded_table().deleted) == deleted_records
+ assert list(loaded_table) == records
+ assert list(loaded_table.deleted) == deleted_records
# This should not return old style table which was a subclass of list.
- assert not isinstance(table(), list)
+ assert not isinstance(table, list)
--- a/setup.cfg
+++ b/setup.cfg
@@ -3,7 +3,7 @@ universal = 1
[easy_install]
-[pytest]
+[tool:pytest]
norecursedirs = build dist examples
[egg_info]

37
python-dbfread.changes Normal file
View File

@ -0,0 +1,37 @@
-------------------------------------------------------------------
Tue Jul 23 11:06:07 UTC 2024 - Berthold Gunreben <azouhr@opensuse.org>
- Add field_parser.patch to ensure that fields are parsed with
little endian. Created pull request at gh#olemb/dbfread#71.
-------------------------------------------------------------------
Fri Nov 1 13:49:17 CET 2019 - Matej Cepl <mcepl@suse.com>
- Add pytest4.patch from gh#olemb/dbfread#33 which makes the test
suite to pass with PyTest 4.
-------------------------------------------------------------------
Thu Aug 22 14:02:42 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Restrict to pytest3 as newer need major test tweaks
-------------------------------------------------------------------
Wed Dec 5 01:09:34 UTC 2018 - Jan Engelhardt <jengelh@inai.de>
- Use noun phrase.
-------------------------------------------------------------------
Tue Dec 4 12:47:10 UTC 2018 - Matej Cepl <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
-------------------------------------------------------------------
Fri May 18 15:35:44 UTC 2018 - toddrme2178@gmail.com
- Use license tag
- Fix tests
-------------------------------------------------------------------
Tue Nov 7 18:23:33 UTC 2017 - toddrme2178@gmail.com
- initial version

62
python-dbfread.spec Normal file
View File

@ -0,0 +1,62 @@
#
# spec file for package python-dbfread
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-dbfread
Version: 2.0.7
Release: 0
Summary: DBF file reader for Python
License: MIT
Group: Development/Languages/Python
URL: https://github.com/olemb/dbfread
Source: https://files.pythonhosted.org/packages/source/d/dbfread/dbfread-%{version}.tar.gz
# gh#olemb/dbfread#33
Patch0: pytest4.patch
Patch1: field_parser.patch
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
%python_subpackages
%description
DBF is a file format used by databases such dBase, Visual FoxPro, and
FoxBase+. This library reads DBF files and returns the data as native
Python data types for further processing. It is primarily intended for
batch jobs and one-off scripts.
%prep
%autosetup -p1 -n dbfread-%{version}
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest
%files %{python_files}
%doc README.rst
%license LICENSE
%{python_sitelib}/*
%changelog