diff --git a/0001-add-exclude-config-to-packages-find-options.patch b/0001-add-exclude-config-to-packages-find-options.patch new file mode 100644 index 0000000000000000000000000000000000000000..29a75d9be02e499ef918d104525d16cd54471a86 --- /dev/null +++ b/0001-add-exclude-config-to-packages-find-options.patch @@ -0,0 +1,38 @@ +From 2c29a22a4c425224b1faef0593359681383e686e Mon Sep 17 00:00:00 2001 +From: desert-sailor +Date: Mon, 3 Jul 2023 02:36:18 +0800 +Subject: [PATCH 1/3] add exclude config to packages find options + +--- + MANIFEST.in | 3 ++- + setup.py | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/MANIFEST.in b/MANIFEST.in +index d25fecb..8616369 100644 +--- a/MANIFEST.in ++++ b/MANIFEST.in +@@ -4,4 +4,5 @@ include README.rst + include setup.cfg + include reqs/requires.txt + include reqs/requires-2.6.txt +-recursive-include stuf *.py +\ No newline at end of file ++recursive-include stuf *.py ++recursive-exclude tests * +diff --git a/setup.py b/setup.py +index 73dad33..cc88167 100755 +--- a/setup.py ++++ b/setup.py +@@ -32,7 +32,7 @@ setup( + author='L. C. Rees', + author_email='lcrees@gmail.com', + url='https://bitbucket.org/lcrees/stuf', +- packages=find_packages(), ++ packages=find_packages(exclude=['tests', '*.tests', '*.tests.*']), + test_suite='stuf.tests', + zip_safe=False, + install_requires=install_requires, +-- +2.33.0 + diff --git a/0002-import-Sequence-and-Mapping-from-collections.abc.patch b/0002-import-Sequence-and-Mapping-from-collections.abc.patch new file mode 100644 index 0000000000000000000000000000000000000000..2656f9bacb16433026dac7dba93ff2f77694f1ef --- /dev/null +++ b/0002-import-Sequence-and-Mapping-from-collections.abc.patch @@ -0,0 +1,54 @@ +From 354070ebb7b53becbb38ecdbb669e149d76a8805 Mon Sep 17 00:00:00 2001 +From: desert-sailor +Date: Mon, 3 Jul 2023 04:38:39 +0800 +Subject: [PATCH 2/3] import Sequence and Mapping from collections.abc + +--- + stuf/_core.py | 2 +- + stuf/base.py | 2 +- + stuf/core.py | 3 ++- + 3 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/stuf/_core.py b/stuf/_core.py +index 1c3b83a..f1fb86a 100644 +--- a/stuf/_core.py ++++ b/stuf/_core.py +@@ -2,7 +2,7 @@ + '''some core stuf.''' + + from itertools import chain +-from collections import MutableMapping ++from collections.abc import MutableMapping + from operator import methodcaller, attrgetter + + from .desc import lazy_class, lazy +diff --git a/stuf/base.py b/stuf/base.py +index 00e6098..e87bad7 100644 +--- a/stuf/base.py ++++ b/stuf/base.py +@@ -7,7 +7,7 @@ from keyword import iskeyword + from operator import itemgetter + from unicodedata import normalize + from importlib import import_module +-from collections import Sequence, Mapping ++from collections.abc import Sequence, Mapping + + # one frame + one = lambda a, b: a(b) +diff --git a/stuf/core.py b/stuf/core.py +index 547b44f..35c47ba 100644 +--- a/stuf/core.py ++++ b/stuf/core.py +@@ -2,7 +2,8 @@ + '''core stuf.''' + + from itertools import chain +-from collections import Mapping, defaultdict, namedtuple ++from collections.abc import Mapping ++from collections import defaultdict, namedtuple + + from ._core import basewrite, writestuf, writewrapstuf, wraps, wrapstuf, asdict + +-- +2.33.0 + diff --git a/0003-fix-test-TypeError-for-no-setattr-func.patch b/0003-fix-test-TypeError-for-no-setattr-func.patch new file mode 100644 index 0000000000000000000000000000000000000000..8ab3d09003c18091966bb8e49c7416f6ef643037 --- /dev/null +++ b/0003-fix-test-TypeError-for-no-setattr-func.patch @@ -0,0 +1,32 @@ +From beccfcba50e463d4f4eb32e48bc79c65c627b92f Mon Sep 17 00:00:00 2001 +From: desert-sailor +Date: Mon, 3 Jul 2023 05:39:26 +0800 +Subject: [PATCH 3/3] fix test TypeError for no-setattr func + +--- + tests/test_stuf.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/test_stuf.py b/tests/test_stuf.py +index e5e8ff3..b6936d3 100644 +--- a/tests/test_stuf.py ++++ b/tests/test_stuf.py +@@ -338,12 +338,12 @@ class TestFrozenStuf(Base, unittest.TestCase): + return frozenstuf + + def test__setattr__(self): +- self.assertRaises(AttributeError, setattr(self.stuf, 'max', 3)) ++ self.assertRaises(TypeError, setattr(self.stuf, 'max', 3)) + self.assertRaises( +- AttributeError, setattr(self.stuf, 'test1', 'test1again') ++ TypeError, setattr(self.stuf, 'test1', 'test1again') + ) + self.assertRaises( +- AttributeError, setattr(self.stuf.test3, 'e', 5) ++ TypeError, setattr(self.stuf.test3, 'e', 5) + ) + + def test__setitem__(self): +-- +2.33.0 + diff --git a/python-stuf.spec b/python-stuf.spec new file mode 100644 index 0000000000000000000000000000000000000000..37d492f3703f6dd75a84b7be7b9d5cf0d1f450c1 --- /dev/null +++ b/python-stuf.spec @@ -0,0 +1,71 @@ +%global _empty_manifest_terminate_build 0 + +Name: python-stuf +Version: 0.9.16 +Release: 1 +Summary: Fancy python dictionary types + +License: BSD +URL: https://bitbucket.org/lcrees/stuf +Source0: https://files.pythonhosted.org/packages/f0/d6/6779cb5874630c21845d345306f60a7a5ecd9263fa09f85df745c54e3356/stuf-0.9.16.tar.gz +Patch1: 0001-add-exclude-config-to-packages-find-options.patch +Patch2: 0002-import-Sequence-and-Mapping-from-collections.abc.patch +Patch3: 0003-fix-test-TypeError-for-no-setattr-func.patch +BuildArch: noarch + + +%description +A collection of Python dictionary types that support attribute-style +access. Includes *defaultdict*, *OrderedDict*, restricted, *ChainMap*, +*Counter*, and frozen implementations plus miscellaneous utilities for +writing Python software. + +%package -n python3-stuf +Summary: Fancy python dictionary types +%{?python_provide:%python_provide python3-stuf} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pbr +BuildRequires: python3-pip +BuildRequires: python3-wheel + +# test dependencies +BuildRequires: python3-mock +BuildRequires: python3-pytest + +%description -n python3-stuf +A collection of Python dictionary types that support attribute-style +access. Includes *defaultdict*, *OrderedDict*, restricted, *ChainMap*, +*Counter*, and frozen implementations plus miscellaneous utilities for +writing Python software. + +%prep +%autosetup -p1 -n stuf-%{version} + +# Remove upstreams egg info +rm -rf *.egg* + +%build +%py3_build + +%install +%py3_install + +%check +CFLAGS="${CFLAGS:-${RPM_OPT_FLAGS}}" LDFLAGS="${LDFLAGS:-${RPM_LD_FLAGS}}" \ +PATH="%{buildroot}%{_bindir}:$PATH" \ +PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \ +PYTHONDONTWRITEBYTECODE=1 \ +%{?__pytest_addopts:PYTEST_ADDOPTS="${PYTEST_ADDOPTS:-} %{__pytest_addopts}"} \ +PYTEST_XDIST_AUTO_NUM_WORKERS=%{_smp_build_ncpus} \ +%{_bindir}/pytest + +%files -n python3-stuf +%doc README.rst +%license LICENSE.txt +%{python3_sitelib}/stuf +%{python3_sitelib}/stuf-*.egg-info/ + +%changelog +* Sun Jul 2 2023 Dongxing Wang - 0.9.16-1 +- Initial packaging diff --git a/stuf-0.9.16.tar.gz b/stuf-0.9.16.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..427d00dbf7dd58c3aab81c52fe3e1d131318e831 Binary files /dev/null and b/stuf-0.9.16.tar.gz differ