- Convert to pip-based build

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cachy?expand=0&rev=13
This commit is contained in:
2025-05-15 15:17:58 +00:00
committed by Git OBS Bridge
commit 03e6e4d8fa
7 changed files with 313 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
cachy-0.3.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:186581f4ceb42a0bbe040c407da73c14092379b1e4c0e327fdb72ae4a9b269b1
size 15654

148
flexmock-0.11.patch Normal file
View File

@@ -0,0 +1,148 @@
From d6fd558be00e3818d01bd1f6a5290bd094a87e52 Mon Sep 17 00:00:00 2001
From: Stefano Rivera <stefano@rivera.za.net>
Date: Tue, 9 Nov 2021 23:09:46 -0800
Subject: [PATCH] No need to teardown flexmock
flexmock patches unittest to hook tearing down, itself.
The flexmock_teardown() function is a private API that was moved in
0.11.0.
---
tests/stores/test_dict_store.py | 5 +----
tests/stores/test_file_store.py | 4 +---
tests/stores/test_redis_store.py | 2 --
tests/test_cache_manager.py | 5 +----
tests/test_repository.py | 5 +----
tests/test_tagged_cache.py | 5 +----
6 files changed, 5 insertions(+), 21 deletions(-)
diff --git a/tests/stores/test_dict_store.py b/tests/stores/test_dict_store.py
index b2574a3..8d4171f 100644
--- a/tests/stores/test_dict_store.py
+++ b/tests/stores/test_dict_store.py
@@ -1,16 +1,13 @@
# -*- coding: utf-8 -*-
from unittest import TestCase
-from flexmock import flexmock, flexmock_teardown
+from flexmock import flexmock
from cachy.stores import DictStore
class DictStoreTestCase(TestCase):
- def tearDown(self):
- flexmock_teardown()
-
def test_items_can_be_set_and_retrieved(self):
store = DictStore()
store.put('foo', 'bar', 10)
diff --git a/tests/stores/test_file_store.py b/tests/stores/test_file_store.py
index 10ab336..704612d 100644
--- a/tests/stores/test_file_store.py
+++ b/tests/stores/test_file_store.py
@@ -7,7 +7,7 @@
import shutil
from unittest import TestCase
-from flexmock import flexmock, flexmock_teardown
+from flexmock import flexmock
from cachy.serializers import JsonSerializer
from cachy.stores import FileStore
@@ -29,8 +29,6 @@ def tearDown(self):
if os.path.isdir(e):
shutil.rmtree(e)
- flexmock_teardown()
-
def test_none_is_returned_if_file_doesnt_exist(self):
mock = flexmock(os.path)
mock.should_receive('exists').once().and_return(False)
diff --git a/tests/stores/test_redis_store.py b/tests/stores/test_redis_store.py
index a5009f4..82e1fb4 100644
--- a/tests/stores/test_redis_store.py
+++ b/tests/stores/test_redis_store.py
@@ -4,7 +4,6 @@
import redis
from unittest import TestCase
-from flexmock import flexmock, flexmock_teardown
from fakeredis import FakeServer
from fakeredis import FakeStrictRedis
from cachy.stores import RedisStore
@@ -23,7 +22,6 @@ def setUp(self):
super(RedisStoreTestCase, self).setUp()
def tearDown(self):
- flexmock_teardown()
self.redis.flushdb()
def test_get_returns_null_when_not_found(self):
diff --git a/tests/test_cache_manager.py b/tests/test_cache_manager.py
index ae9dda4..b5da411 100644
--- a/tests/test_cache_manager.py
+++ b/tests/test_cache_manager.py
@@ -3,7 +3,7 @@
import os
import tempfile
from unittest import TestCase
-from flexmock import flexmock, flexmock_teardown
+from flexmock import flexmock
from cachy import CacheManager, Repository
from cachy.stores import DictStore, FileStore
@@ -12,9 +12,6 @@
class RepositoryTestCase(TestCase):
- def tearDown(self):
- flexmock_teardown()
-
def test_store_get_the_correct_store(self):
cache = CacheManager({
'default': 'dict',
diff --git a/tests/test_repository.py b/tests/test_repository.py
index aeb53b7..f7b3bf5 100644
--- a/tests/test_repository.py
+++ b/tests/test_repository.py
@@ -2,7 +2,7 @@
import datetime
from unittest import TestCase
-from flexmock import flexmock, flexmock_teardown
+from flexmock import flexmock
from cachy import Repository
from cachy.contracts.store import Store
@@ -10,9 +10,6 @@
class RepositoryTestCase(TestCase):
- def tearDown(self):
- flexmock_teardown()
-
def test_get_returns_value_from_cache(self):
repo = self._get_repository()
repo.get_store().should_receive('get').once().with_args('foo').and_return('bar')
diff --git a/tests/test_tagged_cache.py b/tests/test_tagged_cache.py
index cefdc69..79e986c 100644
--- a/tests/test_tagged_cache.py
+++ b/tests/test_tagged_cache.py
@@ -7,14 +7,11 @@
from cachy.tag_set import TagSet
from cachy.redis_tagged_cache import RedisTaggedCache
from datetime import datetime, timedelta
-from flexmock import flexmock, flexmock_teardown
+from flexmock import flexmock
class TaggedCacheTestCase(TestCase):
- def tearDown(self):
- flexmock_teardown()
-
def test_tags_can_be_flushed(self):
store = DictStore()

46
python-cachy.changes Normal file
View File

@@ -0,0 +1,46 @@
-------------------------------------------------------------------
Thu May 15 12:47:26 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Convert to pip-based build
-------------------------------------------------------------------
Wed Nov 29 12:32:31 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
- Add upstream patch flexmock-0.11.patch to make tests work with
latest version of python-flexmock gh#sdispater/cachy#19
-------------------------------------------------------------------
Mon May 8 06:38:22 UTC 2023 - Johannes Kastl <kastl@b1-systems.de>
- add sle15_python_module_pythons
-------------------------------------------------------------------
Mon Dec 19 02:07:36 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-pymemcache.patch:
* Use pymemcache rather than other clients.
-------------------------------------------------------------------
Mon Feb 21 09:35:23 UTC 2022 - Andreas Schneider <asn@cryptomilk.org>
- Skip building for python2
-------------------------------------------------------------------
Tue Sep 17 10:02:10 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
- Ensure neutrality of description. Avoid name repetition in summary.
-------------------------------------------------------------------
Tue Sep 17 03:17:29 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Update to v0.3.0
-------------------------------------------------------------------
Tue May 19 03:07:05 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Activate test suite
-------------------------------------------------------------------
Sun Jan 20 19:49:51 UTC 2019 - Niels Abspoel <aboe76@gmail.com>
- initial packaging for v0.2.0

73
python-cachy.spec Normal file
View File

@@ -0,0 +1,73 @@
#
# spec file for package python-cachy
#
# 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
# 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/
#
%{?sle15_python_module_pythons}
Name: python-cachy
Version: 0.3.0
Release: 0
Summary: A caching library for Python
License: MIT
URL: https://github.com/sdispater/cachy
Source: https://files.pythonhosted.org/packages/source/c/cachy/cachy-%{version}.tar.gz
Patch0: support-pymemcache.patch
# PATCH-FIX-UPSTREAM flexmock-0.11.patch, gh#sdispater/cachy#19
Patch1: flexmock-0.11.patch
BuildRequires: %{python_module fakeredis >= 0.10.2}
BuildRequires: %{python_module flexmock >= 0.10.2}
BuildRequires: %{python_module msgpack-python >= 0.5}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pymemcache >= 4.0}
BuildRequires: %{python_module pytest >= 3.5}
BuildRequires: %{python_module pytest-mock >= 1.9}
BuildRequires: %{python_module redis >= 2.10}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Recommends: python-msgpack-python >= 0.5
Recommends: python-pymemcache >= 4.0
Recommends: python-redis >= 2.10
BuildArch: noarch
%python_subpackages
%description
Cachy provides a caching library.
%prep
%autosetup -p1 -n cachy-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%{python_expand rm -r %{buildroot}%{$python_sitelib}/tests/
%fdupes %{buildroot}%{$python_sitelib}
}
%check
# RedisStoreTestCase requires unreleased version of fakeredis
%pytest -k 'not RedisStoreTestCase'
%files %{python_files}
%license LICENSE
%doc README.rst
%{python_sitelib}/cachy
%{python_sitelib}/cachy-%{version}*-info
%changelog

19
support-pymemcache.patch Normal file
View File

@@ -0,0 +1,19 @@
Index: cachy-0.3.0/cachy/stores/memcached_store.py
===================================================================
--- cachy-0.3.0.orig/cachy/stores/memcached_store.py
+++ cachy-0.3.0/cachy/stores/memcached_store.py
@@ -1,12 +1,9 @@
# -*- coding: utf-8 -*-
try:
- from pylibmc import memcache
+ from pymemcache.client import base as memcache
except ImportError:
- try:
- import memcache
- except ImportError:
- memcache = None
+ memcache = None
from ..contracts.taggable_store import TaggableStore