From b72188ba4522ddbe4283789542e8a9d5a466dd0a7ef70ba88e24bd79d45d597d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 24 Jan 2019 08:17:43 +0000 Subject: [PATCH] osc copypac from project:devel:languages:python:misc package:python-cachey revision:1 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cachey?expand=0&rev=1 --- .gitattributes | 23 ++++++++++++ .gitignore | 1 + cachey-0.1.1.tar.gz | 3 ++ fix_cache_clear.patch | 22 ++++++++++++ python-cachey.changes | 6 ++++ python-cachey.spec | 84 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 139 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 cachey-0.1.1.tar.gz create mode 100644 fix_cache_clear.patch create mode 100644 python-cachey.changes create mode 100644 python-cachey.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/cachey-0.1.1.tar.gz b/cachey-0.1.1.tar.gz new file mode 100644 index 0000000..65cb52d --- /dev/null +++ b/cachey-0.1.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de1db64409158d40acdfdd869ccbca7ce90b2f2ba20d44fb68f32e72f5679f21 +size 6058 diff --git a/fix_cache_clear.patch b/fix_cache_clear.patch new file mode 100644 index 0000000..172ff87 --- /dev/null +++ b/fix_cache_clear.patch @@ -0,0 +1,22 @@ +From 6d4aca78bdf846a4ab1d6755e58db3c671b4a3ea Mon Sep 17 00:00:00 2001 +From: Dave Cole +Date: Tue, 17 Jan 2017 14:42:53 +1100 +Subject: [PATCH] Fix Cache.clear() + +--- + cachey/cache.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cachey/cache.py b/cachey/cache.py +index b8ad6bd..17442a5 100644 +--- a/cachey/cache.py ++++ b/cachey/cache.py +@@ -142,7 +142,7 @@ def __contains__(self, key): + return key in self.data + + def clear(self): +- while self: ++ while self.data: + self._shrink_one() + + def __nonzero__(self): diff --git a/python-cachey.changes b/python-cachey.changes new file mode 100644 index 0000000..b34ee5f --- /dev/null +++ b/python-cachey.changes @@ -0,0 +1,6 @@ +------------------------------------------------------------------- +Mon May 22 19:12:01 UTC 2017 - toddrme2178@gmail.com + +- Initial version +- Add fix_cache_clear.patch + Upstream patch to fix unit test error diff --git a/python-cachey.spec b/python-cachey.spec new file mode 100644 index 0000000..efe0724 --- /dev/null +++ b/python-cachey.spec @@ -0,0 +1,84 @@ +# +# spec file for package python-cachey +# +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# +# 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 http://bugs.opensuse.org/ +# + + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%bcond_without test +Name: python-cachey +Version: 0.1.1 +Release: 0 +Summary: Caching mindful of computation/storage costs +License: BSD-3-Clause +Group: Development/Languages/Python +Url: http://github.com/mrocklin/cachey/ +Source: https://files.pythonhosted.org/packages/source/c/cachey/cachey-%{version}.tar.gz +# PATCH-FIX-UPSTREAM fix_cache_clear.patch - fix unit test error +Patch0: fix_cache_clear.patch +BuildRequires: %{python_module HeapDict} +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +%if %{with test} +BuildRequires: %{python_module pytest} +%endif +Requires: python-HeapDict +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildArch: noarch + +%python_subpackages + +%description +Cachey tries to hold on to values that have the following characteristics + +1. Expensive to recompute (in seconds) +2. Cheap to store (in bytes) +3. Frequently used +4. Recenty used + +It accomplishes this by adding the following to each items score on each access + + score += compute_time / num_bytes * (1 + eps) ** tick_time + +For some small value of epsilon (which determines the memory halflife.) This +has units of inverse bandwidth, has exponential decay of old results and +roughly linear amplification of repeated results. + +%prep +%setup -q -n cachey-%{version} +%patch0 -p1 + +%build +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%if %{with test} +%check +%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib} +py.test-%{$python_bin_suffix} +} +%endif + +%files %{python_files} +%defattr(-,root,root,-) +%doc LICENSE.txt README.md +%{python_sitelib}/* + +%changelog