Hello community, here is the log from the commit of package python-zc.lockfile for openSUSE:Factory checked in at 2019-08-16 15:27:27 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-zc.lockfile (Old) and /work/SRC/openSUSE:Factory/.python-zc.lockfile.new.22127 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-zc.lockfile" Fri Aug 16 15:27:27 2019 rev:6 rq:722795 version:2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-zc.lockfile/python-zc.lockfile.changes 2019-04-19 18:36:15.487022777 +0200 +++ /work/SRC/openSUSE:Factory/.python-zc.lockfile.new.22127/python-zc.lockfile.changes 2019-08-16 15:27:27.282009559 +0200 @@ -1,0 +2,13 @@ +Mon Aug 12 10:35:36 UTC 2019 - Marketa Calabkova <[email protected]> + +- update to version 2.0 + * Extracted new SimpleLockFile that removes implicit behavior + writing to the lock file, and instead allows a subclass to + define that behavior. + * SimpleLockFile and thus LockFile are now new-style classes. Any + clients relying on LockFile being an old-style class will need + to be adapted. + * Drop support for Python 3.4. + * Add support for Python 3.8b3. + +------------------------------------------------------------------- Old: ---- zc.lockfile-1.4.tar.gz New: ---- zc.lockfile-2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-zc.lockfile.spec ++++++ --- /var/tmp/diff_new_pack.1XF44i/_old 2019-08-16 15:27:27.714009463 +0200 +++ /var/tmp/diff_new_pack.1XF44i/_new 2019-08-16 15:27:27.718009462 +0200 @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-zc.lockfile -Version: 1.4 +Version: 2.0 Release: 0 Summary: Basic inter-process locks License: ZPL-2.1 ++++++ zc.lockfile-1.4.tar.gz -> zc.lockfile-2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zc.lockfile-1.4/.travis.yml new/zc.lockfile-2.0/.travis.yml --- old/zc.lockfile-1.4/.travis.yml 2018-11-12 10:59:04.000000000 +0100 +++ new/zc.lockfile-2.0/.travis.yml 2019-08-08 07:51:14.000000000 +0200 @@ -1,16 +1,13 @@ language: python +dist: xenial python: - 2.7 - - 3.4 - 3.5 - 3.6 + - 3.7 + - 3.8-dev - pypy - pypy3 -matrix: - include: - - python: "3.7" - dist: xenial - sudo: true install: - pip install . script: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zc.lockfile-1.4/CHANGES.rst new/zc.lockfile-2.0/CHANGES.rst --- old/zc.lockfile-1.4/CHANGES.rst 2018-11-12 10:59:04.000000000 +0100 +++ new/zc.lockfile-2.0/CHANGES.rst 2019-08-08 07:51:14.000000000 +0200 @@ -1,6 +1,23 @@ Change History *************** +2.0 (2019-08-08) +================ + +- Extracted new ``SimpleLockFile`` that removes implicit behavior + writing to the lock file, and instead allows a subclass to define + that behavior. + (`#15 <https://github.com/zopefoundation/zc.lockfile/issues/15>`_) + +- ``SimpleLockFile`` and thus ``LockFile`` are now new-style classes. + Any clients relying on ``LockFile`` being an old-style class will + need to be adapted. + +- Drop support for Python 3.4. + +- Add support for Python 3.8b3. + + 1.4 (2018-11-12) ================ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zc.lockfile-1.4/PKG-INFO new/zc.lockfile-2.0/PKG-INFO --- old/zc.lockfile-1.4/PKG-INFO 2018-11-12 10:59:05.000000000 +0100 +++ new/zc.lockfile-2.0/PKG-INFO 2019-08-08 07:51:14.000000000 +0200 @@ -1,8 +1,8 @@ Metadata-Version: 2.1 Name: zc.lockfile -Version: 1.4 +Version: 2.0 Summary: Basic inter-process locks -Home-page: http://www.python.org/pypi/zc.lockfile +Home-page: https://github.com/zopefoundation/zc.lockfile Author: Zope Foundation Author-email: [email protected] License: ZPL 2.1 @@ -98,6 +98,23 @@ Change History *************** + 2.0 (2019-08-08) + ================ + + - Extracted new ``SimpleLockFile`` that removes implicit behavior + writing to the lock file, and instead allows a subclass to define + that behavior. + (`#15 <https://github.com/zopefoundation/zc.lockfile/issues/15>`_) + + - ``SimpleLockFile`` and thus ``LockFile`` are now new-style classes. + Any clients relying on ``LockFile`` being an old-style class will + need to be adapted. + + - Drop support for Python 3.4. + + - Add support for Python 3.8b3. + + 1.4 (2018-11-12) ================ @@ -180,10 +197,10 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zc.lockfile-1.4/setup.cfg new/zc.lockfile-2.0/setup.cfg --- old/zc.lockfile-1.4/setup.cfg 2018-11-12 10:59:05.000000000 +0100 +++ new/zc.lockfile-2.0/setup.cfg 2019-08-08 07:51:14.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/zc.lockfile-1.4/setup.py new/zc.lockfile-2.0/setup.py --- old/zc.lockfile-1.4/setup.py 2018-11-12 10:59:04.000000000 +0100 +++ new/zc.lockfile-2.0/setup.py 2019-08-08 07:51:14.000000000 +0200 @@ -12,7 +12,7 @@ # ############################################################################## -version = '1.4' +version = '2.0' import os from setuptools import setup, find_packages @@ -44,7 +44,7 @@ long_description=long_description, license = "ZPL 2.1", keywords = "lock", - url='http://www.python.org/pypi/zc.lockfile', + url='https://github.com/zopefoundation/zc.lockfile', packages = find_packages('src'), package_dir = {'': 'src'}, namespace_packages = ['zc'], @@ -64,10 +64,10 @@ 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zc.lockfile-1.4/src/zc/lockfile/__init__.py new/zc.lockfile-2.0/src/zc/lockfile/__init__.py --- old/zc.lockfile-1.4/src/zc/lockfile/__init__.py 2018-11-12 10:59:04.000000000 +0100 +++ new/zc.lockfile-2.0/src/zc/lockfile/__init__.py 2019-08-08 07:51:14.000000000 +0200 @@ -17,6 +17,8 @@ import logging logger = logging.getLogger("zc.lockfile") +__metaclass__ = type + class LockError(Exception): """Couldn't get a lock """ @@ -61,18 +63,18 @@ def _unlock_file(file): fcntl.flock(file.fileno(), fcntl.LOCK_UN) -class LazyHostName(object): +class LazyHostName: """Avoid importing socket and calling gethostname() unnecessarily""" def __str__(self): import socket return socket.gethostname() -class LockFile: +class SimpleLockFile: _fp = None - def __init__(self, path, content_template='{pid}'): + def __init__(self, path): self._path = path try: # Try to open for writing without truncation: @@ -86,15 +88,13 @@ try: _lock_file(fp) + self._fp = fp except: fp.close() raise - # We got the lock, record info in the file. - self._fp = fp - fp.write(" %s\n" % content_template.format(pid=os.getpid(), - hostname=LazyHostName())) - fp.truncate() + # Lock acquired + self._on_lock() fp.flush() def close(self): @@ -102,3 +102,24 @@ _unlock_file(self._fp) self._fp.close() self._fp = None + + def _on_lock(self): + """ + Allow subclasses to supply behavior to occur following + lock acquisition. + """ + + +class LockFile(SimpleLockFile): + + def __init__(self, path, content_template='{pid}'): + self._content_template = content_template + super(LockFile, self).__init__(path) + + def _on_lock(self): + content = self._content_template.format( + pid=os.getpid(), + hostname=LazyHostName(), + ) + self._fp.write(" %s\n" % content) + self._fp.truncate() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zc.lockfile-1.4/src/zc/lockfile/tests.py new/zc.lockfile-2.0/src/zc/lockfile/tests.py --- old/zc.lockfile-1.4/src/zc/lockfile/tests.py 2018-11-12 10:59:04.000000000 +0100 +++ new/zc.lockfile-2.0/src/zc/lockfile/tests.py 2019-08-08 07:51:14.000000000 +0200 @@ -179,6 +179,14 @@ lock.close() p.join() + def test_simple_lock(self): + assert isinstance(zc.lockfile.SimpleLockFile, type) + lock = zc.lockfile.SimpleLockFile('s') + with self.assertRaises(zc.lockfile.LockError): + zc.lockfile.SimpleLockFile('s') + lock.close() + zc.lockfile.SimpleLockFile('s').close() + def test_suite(): suite = unittest.TestSuite() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zc.lockfile-1.4/src/zc.lockfile.egg-info/PKG-INFO new/zc.lockfile-2.0/src/zc.lockfile.egg-info/PKG-INFO --- old/zc.lockfile-1.4/src/zc.lockfile.egg-info/PKG-INFO 2018-11-12 10:59:05.000000000 +0100 +++ new/zc.lockfile-2.0/src/zc.lockfile.egg-info/PKG-INFO 2019-08-08 07:51:14.000000000 +0200 @@ -1,8 +1,8 @@ Metadata-Version: 2.1 Name: zc.lockfile -Version: 1.4 +Version: 2.0 Summary: Basic inter-process locks -Home-page: http://www.python.org/pypi/zc.lockfile +Home-page: https://github.com/zopefoundation/zc.lockfile Author: Zope Foundation Author-email: [email protected] License: ZPL 2.1 @@ -98,6 +98,23 @@ Change History *************** + 2.0 (2019-08-08) + ================ + + - Extracted new ``SimpleLockFile`` that removes implicit behavior + writing to the lock file, and instead allows a subclass to define + that behavior. + (`#15 <https://github.com/zopefoundation/zc.lockfile/issues/15>`_) + + - ``SimpleLockFile`` and thus ``LockFile`` are now new-style classes. + Any clients relying on ``LockFile`` being an old-style class will + need to be adapted. + + - Drop support for Python 3.4. + + - Add support for Python 3.8b3. + + 1.4 (2018-11-12) ================ @@ -180,10 +197,10 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zc.lockfile-1.4/src/zc.lockfile.egg-info/SOURCES.txt new/zc.lockfile-2.0/src/zc.lockfile.egg-info/SOURCES.txt --- old/zc.lockfile-1.4/src/zc.lockfile.egg-info/SOURCES.txt 2018-11-12 10:59:05.000000000 +0100 +++ new/zc.lockfile-2.0/src/zc.lockfile.egg-info/SOURCES.txt 2019-08-08 07:51:14.000000000 +0200 @@ -7,6 +7,7 @@ README.rst bootstrap.py buildout.cfg +setup.cfg setup.py tox.ini src/zc/__init__.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zc.lockfile-1.4/src/zc.lockfile.egg-info/requires.txt new/zc.lockfile-2.0/src/zc.lockfile.egg-info/requires.txt --- old/zc.lockfile-1.4/src/zc.lockfile.egg-info/requires.txt 2018-11-12 10:59:05.000000000 +0100 +++ new/zc.lockfile-2.0/src/zc.lockfile.egg-info/requires.txt 2019-08-08 07:51:14.000000000 +0200 @@ -1,5 +1,4 @@ setuptools [test] -mock zope.testing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zc.lockfile-1.4/tox.ini new/zc.lockfile-2.0/tox.ini --- old/zc.lockfile-1.4/tox.ini 2018-11-12 10:59:04.000000000 +0100 +++ new/zc.lockfile-2.0/tox.ini 2019-08-08 07:51:14.000000000 +0200 @@ -1,6 +1,6 @@ [tox] envlist = - py27,py34,py35,py36,py37,pypy,pypy3 + py27,py35,py36,py37,py38,pypy,pypy3 [testenv] commands =
