[packages/python-dogpile.cache] - new

qboosh qboosh at pld-linux.org
Tue Feb 13 21:19:46 CET 2024


commit bb2c742047536473089d65ab90822d3c7a3a06f9
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Feb 13 21:05:08 2024 +0100

    - new

 dogpile.cache-mock.patch   |  57 ++++++++++++++
 dogpile.cache-pytest.patch |  12 +++
 python-dogpile.cache.spec  | 192 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 261 insertions(+)
---
diff --git a/python-dogpile.cache.spec b/python-dogpile.cache.spec
new file mode 100644
index 0000000..677b104
--- /dev/null
+++ b/python-dogpile.cache.spec
@@ -0,0 +1,192 @@
+#
+# Conditional build:
+%bcond_with	doc	# Sphinx documentation (sdist contains prebuilt html)
+%bcond_without	tests	# unit tests
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
+
+Summary:	A caching front-end based on the Dogpile lock
+Summary(pl.UTF-8):	Frontend z pamięcią podręczną oparty na blokadzie Dogpile
+Name:		python-dogpile.cache
+# keep 0.9.x here for python2 support
+Version:	0.9.2
+Release:	1
+License:	MIT
+Group:		Libraries/Python
+#Source0Download: https://pypi.org/simple/dogpile.cache/
+Source0:	https://files.pythonhosted.org/packages/source/d/dogpile.cache/dogpile.cache-%{version}.tar.gz
+# Source0-md5:	ab35b826ca17477ab0db3dd76227e8aa
+Patch0:		dogpile.cache-mock.patch
+Patch1:		dogpile.cache-pytest.patch
+URL:		https://pypi.org/project/dogpile.cache/
+%if %{with python2}
+BuildRequires:	python-modules >= 1:2.5
+BuildRequires:	python-setuptools
+%if %{with tests}
+BuildRequires:	python-Mako
+BuildRequires:	python-decorator >= 4.0.0
+BuildRequires:	python-futures
+BuildRequires:	python-mock
+BuildRequires:	python-pytest
+%endif
+%endif
+%if %{with python3}
+BuildRequires:	python3-modules >= 1:3.2
+BuildRequires:	python3-setuptools
+%if %{with tests}
+BuildRequires:	python3-Mako
+BuildRequires:	python3-decorator >= 4.0.0
+BuildRequires:	python3-pytest
+%endif
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+%if %{with doc}
+BuildRequires:	python-Mako
+BuildRequires:	python-changelog
+BuildRequires:	python-decorator
+BuildRequires:	python-sphinx-paramlinks
+BuildRequires:	sphinx-pdg-2
+%endif
+Requires:	python-modules >= 1:2.5
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Dogpile consists of two subsystems, one building on top of the other.
+
+dogpile provides the concept of a "dogpile lock", a control structure
+which allows a single thread of execution to be selected as the
+"creator" of some resource, while allowing other threads of execution
+to refer to the previous version of this resource as the creation
+proceeds; if there is no previous version, then those threads block
+until the object is available.
+
+dogpile.cache is a caching API which provides a generic interface to
+caching backends of any variety, and additionally provides API hooks
+which integrate these cache backends with the locking mechanism of
+dogpile.
+
+%description -l pl.UTF-8
+Dogpile składa się z dwóch podsystemów, jeden jest zbudowany na
+drugim.
+
+dogpile udostępnia koncept "blokady dogpile" - struktury sterującej,
+pozwalającej na wybór jednego z wątków jako "twórcy" jakiegoś zasobu,
+podczas gdy pozostałe wątki odwołują się do poprzedniej wersji zasobu
+w miarę procesu tworzenia; jeśli nie ma poprzedniej wersji, wątki te
+blokują się do czasu dostępności obiektu.
+
+dogpile.cache to API z pamięcią podręczną, zapewniające ogólny
+interfejs do dowolnych backendów pamięci podręcznej oraz uchwyty API
+integrujące te backendy z mechanizmem blokującym dogpile.
+
+%package -n python3-dogpile.cache
+Summary:	A caching front-end based on the Dogpile lock
+Summary(pl.UTF-8):	Frontend z pamięcią podręczną oparty na blokadzie Dogpile
+Group:		Libraries/Python
+Requires:	python3-modules >= 1:3.2
+
+%description -n python3-dogpile.cache
+Dogpile consists of two subsystems, one building on top of the other.
+
+dogpile provides the concept of a "dogpile lock", a control structure
+which allows a single thread of execution to be selected as the
+"creator" of some resource, while allowing other threads of execution
+to refer to the previous version of this resource as the creation
+proceeds; if there is no previous version, then those threads block
+until the object is available.
+
+dogpile.cache is a caching API which provides a generic interface to
+caching backends of any variety, and additionally provides API hooks
+which integrate these cache backends with the locking mechanism of
+dogpile.
+
+%description -n python3-dogpile.cache -l pl.UTF-8
+Dogpile składa się z dwóch podsystemów, jeden jest zbudowany na
+drugim.
+
+dogpile udostępnia koncept "blokady dogpile" - struktury sterującej,
+pozwalającej na wybór jednego z wątków jako "twórcy" jakiegoś zasobu,
+podczas gdy pozostałe wątki odwołują się do poprzedniej wersji zasobu
+w miarę procesu tworzenia; jeśli nie ma poprzedniej wersji, wątki te
+blokują się do czasu dostępności obiektu.
+
+dogpile.cache to API z pamięcią podręczną, zapewniające ogólny
+interfejs do dowolnych backendów pamięci podręcznej oraz uchwyty API
+integrujące te backendy z mechanizmem blokującym dogpile.
+
+%package apidocs
+Summary:	API documentation for Python dogpile.cache module
+Summary(pl.UTF-8):	Dokumentacja API modułu Pythona dogpile.cache
+Group:		Documentation
+
+%description apidocs
+API documentation for Python dogpile.cache module.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API modułu Pythona dogpile.cache.
+
+%prep
+%setup -q -n dogpile.cache-%{version}
+%patch0 -p1
+%patch1 -p1
+
+%build
+%if %{with python2}
+%py_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+%{__python} -m pytest tests -k 'not test_dbm_backend and not test_memcached_backend and not test_redis_backend'
+%endif
+%endif
+
+%if %{with python3}
+%py3_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+%{__python3} -m pytest tests -k 'not test_dbm_backend and not test_memcached_backend and not test_redis_backend'
+%endif
+%endif
+
+%if %{with doc}
+sphinx-build-2 -b html docs/build docs
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%py_install
+
+%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.rst
+%{py_sitescriptdir}/dogpile
+%{py_sitescriptdir}/dogpile.cache-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-dogpile.cache
+%defattr(644,root,root,755)
+%doc LICENSE README.rst
+%{py3_sitescriptdir}/dogpile
+%{py3_sitescriptdir}/dogpile.cache-%{version}-py*.egg-info
+%endif
+
+%files apidocs
+%defattr(644,root,root,755)
+%doc docs/{_static,*.html,*.js}
diff --git a/dogpile.cache-mock.patch b/dogpile.cache-mock.patch
new file mode 100644
index 0000000..49eee8b
--- /dev/null
+++ b/dogpile.cache-mock.patch
@@ -0,0 +1,57 @@
+--- dogpile.cache-0.9.2/tests/test_lock.py.orig	2020-05-04 22:19:04.000000000 +0200
++++ dogpile.cache-0.9.2/tests/test_lock.py	2024-02-13 19:37:17.465546577 +0100
+@@ -5,7 +5,10 @@ import threading
+ import time
+ from unittest import TestCase
+ 
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ from dogpile import Lock
+ from dogpile import NeedRegenerationException
+--- dogpile.cache-0.9.2/tests/cache/test_redis_backend.py.orig	2024-02-13 19:38:39.485102239 +0100
++++ dogpile.cache-0.9.2/tests/cache/test_redis_backend.py	2024-02-13 19:38:43.325081436 +0100
+@@ -4,8 +4,10 @@ from threading import Event
+ import time
+ from unittest import TestCase
+ 
+-from mock import Mock
+-from mock import patch
++try:
++    from unittest.mock import Mock, patch
++except ImportError:
++    from mock import Mock, patch
+ import pytest
+ 
+ from dogpile.cache.region import _backend_loader
+--- dogpile.cache-0.9.2/tests/cache/test_region.py.orig	2020-05-04 22:19:04.000000000 +0200
++++ dogpile.cache-0.9.2/tests/cache/test_region.py	2024-02-13 19:39:13.528251145 +0100
+@@ -4,7 +4,10 @@ import itertools
+ import time
+ from unittest import TestCase
+ 
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ from dogpile.cache import CacheRegion
+ from dogpile.cache import exception
+--- dogpile.cache-0.9.2/tests/cache/plugins/test_mako_cache.py.orig	2020-05-04 22:19:04.000000000 +0200
++++ dogpile.cache-0.9.2/tests/cache/plugins/test_mako_cache.py	2024-02-13 19:57:49.548871809 +0100
+@@ -2,7 +2,10 @@ from unittest import TestCase
+ 
+ from mako.cache import register_plugin
+ from mako.template import Template
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ import pytest
+ 
+ from .. import eq_
diff --git a/dogpile.cache-pytest.patch b/dogpile.cache-pytest.patch
new file mode 100644
index 0000000..117c913
--- /dev/null
+++ b/dogpile.cache-pytest.patch
@@ -0,0 +1,12 @@
+--- dogpile.cache-0.9.2/tests/conftest.py.orig	2020-05-04 22:19:04.000000000 +0200
++++ dogpile.cache-0.9.2/tests/conftest.py	2024-02-13 20:33:08.770724333 +0100
+@@ -26,6 +26,9 @@ def is_unittest(obj):
+ 
+ def pytest_pycollect_makeitem(collector, name, obj):
+     if is_unittest(obj) and not obj.__name__.startswith("_"):
++      if sys.version_info[0] == 2:
+         return UnitTestCase(name, parent=collector)
++      else:
++        return UnitTestCase.from_parent(collector, name=name, obj=obj)
+     else:
+         return []
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-dogpile.cache.git/commitdiff/bb2c742047536473089d65ab90822d3c7a3a06f9



More information about the pld-cvs-commit mailing list