Hello community,

here is the log from the commit of package python-pickleshare for 
openSUSE:Factory checked in at 2017-07-17 09:09:11
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pickleshare (Old)
 and      /work/SRC/openSUSE:Factory/.python-pickleshare.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pickleshare"

Mon Jul 17 09:09:11 2017 rev:2 rq:509830 version:0.7.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pickleshare/python-pickleshare.changes    
2015-09-30 05:48:59.000000000 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-pickleshare.new/python-pickleshare.changes   
    2017-07-17 09:09:13.848225434 +0200
@@ -1,0 +2,35 @@
+Wed Jul 12 17:12:05 UTC 2017 - toddrme2...@gmail.com
+
+- Implement single-spec version
+- Fix source URL
+- update to version 0.7.4:
+  * Accept any str-able object for the root path
+  * Convert test fixture tmpdir to string before creating
+    PickleShareDB
+  * Don't convert Py2 unicode path to str
+- update to version 0.7.3:
+  * Fix environment marker
+  * Include license and test files in sdists
+  * Fix for multiple processes creating a folder
+  * handle exception and keep Python 2 support
+  * Remove unused import
+- update to version 0.7.2:
+  * Fix environment marker
+  * Fix error when db location does not already exist
+  * Require pathlib2 on Python 3.3 as well
+- changes from version 0.7.0:
+  * Update metadata
+  * Fix environment marker
+  * Update .travis.yml
+  * Switch from path.py to pathlib
+  * Add MIT license
+  * Cleanup: Python 3 compatible example, remove .idea folder
+  * Update setup.py classifiers
+  * Enable 3.5 on travis
+  * specify path.py version dependency
+- update to version 0.6:
+  * Fix module import to work with the latest version
+  * remove pkg.info
+  * update main page URL
+  
+-------------------------------------------------------------------

Old:
----
  pickleshare-0.5.tar.gz

New:
----
  pickleshare-0.7.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pickleshare.spec ++++++
--- /var/tmp/diff_new_pack.D8HB9K/_old  2017-07-17 09:09:14.780094186 +0200
+++ /var/tmp/diff_new_pack.D8HB9K/_new  2017-07-17 09:09:14.780094186 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-pickleshare
 #
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# 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
@@ -15,25 +15,31 @@
 # Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
+%bcond_without test
 
+%{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pickleshare
-Version:        0.5
+Version:        0.7.4
 Release:        0
 Summary:        Tiny shelve-like database with concurrency support
 License:        MIT
 Group:          Development/Languages/Python
 Url:            https://github.com/vivainio/pickleshare
-Source:         
https://pypi.python.org/packages/source/p/pickleshare/pickleshare-%{version}.tar.gz
-BuildRequires:  python-devel
-BuildRequires:  python-path.py
-BuildRequires:  python-setuptools
-Requires:       python-path.py
+Source:         
https://files.pythonhosted.org/packages/source/p/pickleshare/pickleshare-%{version}.tar.gz
+BuildRequires:  %{python_module devel}
+BuildRequires:  %{python_module setuptools}
+BuildRequires:  python-pathlib2
+BuildRequires:  fdupes
+BuildRequires:  python-rpm-macros
+%if %{with test}
+BuildRequires:  %{python_module pytest}
+%endif
+%ifpython2
+Requires:       python-pathlib2
+%endif
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-%if 0%{?suse_version} && 0%{?suse_version} <= 1110
-%{!?python_sitelib: %global python_sitelib %(python -c "from 
distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%else
 BuildArch:      noarch
-%endif
+%python_subpackages
 
 %description
 PickleShare - a small 'shelve' like datastore with concurrency support
@@ -57,13 +63,24 @@
 sed -i '1{\@^#!/usr/bin/env python@d}' pickleshare.py
 
 %build
-python setup.py build
+%python_build
 
 %install
-python setup.py install --prefix=%{_prefix} --root=%{buildroot}
+%python_install
+%python_expand %fdupes %{buildroot}%{$python_sitelib}
+
+%if %{with test}
+%check
+# need to set locale to avoid UnicodeEncodeError
+export LANG=en_US.UTF-8
+%python_expand py.test-%{$python_bin_suffix} .
+%endif
 
-%files
+%files %{python_files}
 %defattr(-,root,root,-)
-%{python_sitelib}/*
+%doc LICENSE
+%{python_sitelib}/pickleshare.py*
+%{python_sitelib}/pickleshare-%{version}-py*.egg-info
+%pycache_only %{python_sitelib}/__pycache__/pickleshare.*.py*
 
 %changelog

++++++ pickleshare-0.5.tar.gz -> pickleshare-0.7.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pickleshare-0.5/LICENSE new/pickleshare-0.7.4/LICENSE
--- old/pickleshare-0.5/LICENSE 1970-01-01 01:00:00.000000000 +0100
+++ new/pickleshare-0.7.4/LICENSE       2016-04-08 18:10:20.000000000 +0200
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 Ville Vainio
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pickleshare-0.5/MANIFEST.in 
new/pickleshare-0.7.4/MANIFEST.in
--- old/pickleshare-0.5/MANIFEST.in     1970-01-01 01:00:00.000000000 +0100
+++ new/pickleshare-0.7.4/MANIFEST.in   2016-04-18 12:59:28.000000000 +0200
@@ -0,0 +1,2 @@
+include LICENSE
+include test_pickleshare.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pickleshare-0.5/PKG-INFO 
new/pickleshare-0.7.4/PKG-INFO
--- old/pickleshare-0.5/PKG-INFO        2015-03-24 20:13:21.000000000 +0100
+++ new/pickleshare-0.7.4/PKG-INFO      2016-08-13 23:59:03.000000000 +0200
@@ -1,8 +1,8 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: pickleshare
-Version: 0.5
+Version: 0.7.4
 Summary: Tiny 'shelve'-like database with concurrency support
-Home-page: https://github.com/vivainio/pickleshare
+Home-page: https://github.com/pickleshare/pickleshare
 Author: Ville Vainio
 Author-email: vivai...@gmail.com
 License: MIT
@@ -20,17 +20,21 @@
             from pickleshare import *
             db = PickleShareDB('~/testpickleshare')
             db.clear()
-            print "Should be empty:",db.items()
+            print("Should be empty:",db.items())
             db['hello'] = 15
             db['aku ankka'] = [1,2,313]
             db['paths/are/ok/key'] = [1,(5,46)]
-            print db.keys()
+            print(db.keys())
         
         This module is certainly not ZODB, but can be used for low-load
         (non-mission-critical) situations where tiny code size trumps the 
         advanced features of a "real" object database.
         
-        Installation guide: pip install path pickleshare
+        Installation guide: pip install pickleshare
         
 Keywords: database persistence pickle ipc shelve
 Platform: UNKNOWN
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pickleshare-0.5/pickleshare.egg-info/PKG-INFO 
new/pickleshare-0.7.4/pickleshare.egg-info/PKG-INFO
--- old/pickleshare-0.5/pickleshare.egg-info/PKG-INFO   2015-03-24 
20:13:20.000000000 +0100
+++ new/pickleshare-0.7.4/pickleshare.egg-info/PKG-INFO 2016-08-13 
23:59:03.000000000 +0200
@@ -1,8 +1,8 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
 Name: pickleshare
-Version: 0.5
+Version: 0.7.4
 Summary: Tiny 'shelve'-like database with concurrency support
-Home-page: https://github.com/vivainio/pickleshare
+Home-page: https://github.com/pickleshare/pickleshare
 Author: Ville Vainio
 Author-email: vivai...@gmail.com
 License: MIT
@@ -20,17 +20,21 @@
             from pickleshare import *
             db = PickleShareDB('~/testpickleshare')
             db.clear()
-            print "Should be empty:",db.items()
+            print("Should be empty:",db.items())
             db['hello'] = 15
             db['aku ankka'] = [1,2,313]
             db['paths/are/ok/key'] = [1,(5,46)]
-            print db.keys()
+            print(db.keys())
         
         This module is certainly not ZODB, but can be used for low-load
         (non-mission-critical) situations where tiny code size trumps the 
         advanced features of a "real" object database.
         
-        Installation guide: pip install path pickleshare
+        Installation guide: pip install pickleshare
         
 Keywords: database persistence pickle ipc shelve
 Platform: UNKNOWN
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pickleshare-0.5/pickleshare.egg-info/SOURCES.txt 
new/pickleshare-0.7.4/pickleshare.egg-info/SOURCES.txt
--- old/pickleshare-0.5/pickleshare.egg-info/SOURCES.txt        2015-03-24 
20:13:21.000000000 +0100
+++ new/pickleshare-0.7.4/pickleshare.egg-info/SOURCES.txt      2016-08-13 
23:59:03.000000000 +0200
@@ -1,6 +1,9 @@
+LICENSE
+MANIFEST.in
 pickleshare.py
 setup.cfg
 setup.py
+test_pickleshare.py
 pickleshare.egg-info/PKG-INFO
 pickleshare.egg-info/SOURCES.txt
 pickleshare.egg-info/dependency_links.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pickleshare-0.5/pickleshare.egg-info/requires.txt 
new/pickleshare-0.7.4/pickleshare.egg-info/requires.txt
--- old/pickleshare-0.5/pickleshare.egg-info/requires.txt       2015-03-24 
20:13:20.000000000 +0100
+++ new/pickleshare-0.7.4/pickleshare.egg-info/requires.txt     2016-08-13 
23:59:03.000000000 +0200
@@ -1 +1,3 @@
-path.py
+
+[:python_version in "2.6 2.7 3.2 3.3"]
+pathlib2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pickleshare-0.5/pickleshare.py 
new/pickleshare-0.7.4/pickleshare.py
--- old/pickleshare-0.5/pickleshare.py  2015-03-24 19:42:40.000000000 +0100
+++ new/pickleshare-0.7.4/pickleshare.py        2016-08-13 23:56:02.000000000 
+0200
@@ -36,18 +36,27 @@
 from __future__ import print_function
 
 
-__version__ = "0.5"
+__version__ = "0.7.4"
+
+try:
+    from pathlib import Path
+except ImportError:
+    # Python 2 backport
+    from pathlib2 import Path
 
-from path import path as Path
-# from IPython.external.path import path as Path
 import os,stat,time
 import collections
 try:
     import cPickle as pickle
 except ImportError:
     import pickle
-import glob
 import errno
+import sys
+
+if sys.version_info[0] >= 3:
+    string_types = (str,)
+else:
+    string_types = (str, unicode)
 
 def gethashfile(key):
     return ("%02x" % abs(hash(key) % 256))[-2:]
@@ -58,9 +67,18 @@
     """ The main 'connection' object for PickleShare database """
     def __init__(self,root):
         """ Return a db object that will manage the specied directory"""
-        self.root = Path(root).expanduser().abspath()
-        if not self.root.isdir():
-            self.root.makedirs_p()
+        if not isinstance(root, string_types):
+            root = str(root)
+        root = os.path.abspath(os.path.expanduser(root))
+        self.root = Path(root)
+        if not self.root.is_dir():
+            # catching the exception is necessary if multiple processes are 
concurrently trying to create a folder
+            # exists_ok keyword argument of mkdir does the same but only from 
Python 3.5
+            try:
+                self.root.mkdir(parents=True)
+            except OSError as e:
+                if e.errno != errno.EEXIST:
+                    raise
         # cache has { 'key' : (obj, orig_mod_time) }
         self.cache = {}
 
@@ -89,14 +107,14 @@
         """ db['key'] = 5 """
         fil = self.root / key
         parent = fil.parent
-        if parent and not parent.isdir():
-            parent.makedirs()
+        if parent and not parent.is_dir():
+            parent.mkdir(parents=True)
         # We specify protocol 2, so that we can mostly go between Python 2
         # and Python 3. We can upgrade to protocol 3 when Python 2 is obsolete.
         with fil.open('wb') as f:
             pickle.dump(value, f, protocol=2)
         try:
-            self.cache[fil] = (value,fil.mtime)
+            self.cache[fil] = (value, fil.stat().st_mtime)
         except OSError as e:
             if e.errno != errno.ENOENT:
                 raise
@@ -104,8 +122,8 @@
     def hset(self, hashroot, key, value):
         """ hashed set """
         hroot = self.root / hashroot
-        if not hroot.isdir():
-            hroot.makedirs()
+        if not hroot.is_dir():
+            hroot.mkdir()
         hfile = hroot / gethashfile(key)
         d = self.get(hfile, {})
         d.update( {key : value})
@@ -172,9 +190,9 @@
         self[hashroot + '/xx'] = all
         for f in hfiles:
             p = self.root / f
-            if p.basename() == 'xx':
+            if p.name == 'xx':
                 continue
-            p.remove()
+            p.unlink()
 
 
 
@@ -183,7 +201,7 @@
         fil = self.root / key
         self.cache.pop(fil,None)
         try:
-            fil.remove()
+            fil.unlink()
         except OSError:
             # notfound and permission denied are ok - we
             # lost, the other process wins the conflict
@@ -191,16 +209,16 @@
 
     def _normalized(self, p):
         """ Make a key suitable for user's eyes """
-        return str(self.root.relpathto(p)).replace('\\','/')
+        return str(p.relative_to(self.root)).replace('\\','/')
 
     def keys(self, globpat = None):
         """ All keys in DB, or all keys matching a glob"""
 
         if globpat is None:
-            files = self.root.walkfiles()
+            files = self.root.rglob('*')
         else:
-            files = [Path(p) for p in glob.glob(self.root/globpat)]
-        return [self._normalized(p) for p in files if p.isfile()]
+            files = self.root.glob(globpat)
+        return [self._normalized(p) for p in files if p.is_file()]
 
     def __iter__(self):
         return iter(self.keys())
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pickleshare-0.5/setup.cfg 
new/pickleshare-0.7.4/setup.cfg
--- old/pickleshare-0.5/setup.cfg       2015-03-24 20:13:21.000000000 +0100
+++ new/pickleshare-0.7.4/setup.cfg     2016-08-13 23:59:03.000000000 +0200
@@ -1,3 +1,6 @@
+[bdist_wheel]
+universal = 1
+
 [egg_info]
 tag_build = 
 tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pickleshare-0.5/setup.py 
new/pickleshare-0.7.4/setup.py
--- old/pickleshare-0.5/setup.py        2015-03-24 19:25:15.000000000 +0100
+++ new/pickleshare-0.7.4/setup.py      2016-04-08 21:16:30.000000000 +0200
@@ -16,8 +16,11 @@
     author_email="vivai...@gmail.com",
     description="Tiny 'shelve'-like database with concurrency support",
     license="MIT",
-    install_requires=["path.py"],
-    url="https://github.com/vivainio/pickleshare";,
+    extras_require = {
+        # Ugly, but we can't do < comparison here
+        ':python_version in "2.6 2.7 3.2 3.3"': ['pathlib2'],
+    },
+    url="https://github.com/pickleshare/pickleshare";,
     keywords="database persistence pickle ipc shelve",
     long_description="""\
 PickleShare - a small 'shelve' like datastore with concurrency support
@@ -34,18 +37,22 @@
     from pickleshare import *
     db = PickleShareDB('~/testpickleshare')
     db.clear()
-    print "Should be empty:",db.items()
+    print("Should be empty:",db.items())
     db['hello'] = 15
     db['aku ankka'] = [1,2,313]
     db['paths/are/ok/key'] = [1,(5,46)]
-    print db.keys()
+    print(db.keys())
 
 This module is certainly not ZODB, but can be used for low-load
 (non-mission-critical) situations where tiny code size trumps the 
 advanced features of a "real" object database.
 
-Installation guide: pip install path pickleshare
-"""
-
-
+Installation guide: pip install pickleshare
+""",
+    classifiers=[
+        'License :: OSI Approved :: MIT License',
+        'Programming Language :: Python :: 2',
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3',
+    ]
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pickleshare-0.5/test_pickleshare.py 
new/pickleshare-0.7.4/test_pickleshare.py
--- old/pickleshare-0.5/test_pickleshare.py     1970-01-01 01:00:00.000000000 
+0100
+++ new/pickleshare-0.7.4/test_pickleshare.py   2016-04-08 18:10:20.000000000 
+0200
@@ -0,0 +1,54 @@
+from __future__ import print_function
+import os
+
+from pickleshare import PickleShareDB
+
+def test_pickleshare(tmpdir):
+    db = PickleShareDB(tmpdir)
+    db.clear()
+    print("Should be empty:",db.items())
+    assert len(db) == 0
+    db['hello'] = 15
+    assert db['hello'] == 15
+    db['aku ankka'] = [1,2,313]
+    assert db['aku ankka'] == [1,2,313]
+    db['paths/nest/ok/keyname'] = [1,(5,46)]
+    assert db['paths/nest/ok/keyname'] == [1,(5,46)]
+
+    db.hset('hash', 'aku', 12)
+    db.hset('hash', 'ankka', 313)
+    assert db.hget('hash', 'aku') == 12
+    assert db.hget('hash', 'ankka') == 313
+
+    print("all hashed",db.hdict('hash'))
+    print(db.keys())
+    print(db.keys('paths/nest/ok/k*'))
+    print(dict(db)) # snapsot of whole db
+    db.uncache() # frees memory, causes re-reads later
+
+    # shorthand for accessing deeply nested files
+    lnk = db.getlink('myobjects/test')
+    lnk.foo = 2
+    lnk.bar = lnk.foo + 5
+    assert lnk.bar == 7
+
+def test_stress(tmpdir):
+    db = PickleShareDB(tmpdir)
+    import time,sys
+    for i in range(100):
+        for j in range(500):
+            if i % 15 == 0 and i < 70:
+                if str(j) in db:
+                    del db[str(j)]
+                continue
+
+            if j%33 == 0:
+                time.sleep(0.02)
+
+            db[str(j)] = db.get(str(j), []) + [(i,j,"proc %d" % os.getpid())]
+            db.hset('hash',j, db.hget('hash',j,15) + 1 )
+
+        print(i, end=' ')
+        sys.stdout.flush()
+        if i % 10 == 0:
+            db.uncache()


Reply via email to