Hello community, here is the log from the commit of package python-pyinotify for openSUSE:Factory checked in at 2016-01-05 09:41:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pyinotify (Old) and /work/SRC/openSUSE:Factory/.python-pyinotify.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-pyinotify" Changes: -------- --- /work/SRC/openSUSE:Factory/python-pyinotify/python-pyinotify.changes 2015-05-16 19:01:41.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-pyinotify.new/python-pyinotify.changes 2016-01-05 09:41:57.000000000 +0100 @@ -1,0 +2,6 @@ +Mon Jan 4 14:35:03 UTC 2016 - dmueller@suse.com + +- update to 0.9.6: + * fixes for sysctl compatibility issues + +------------------------------------------------------------------- Old: ---- pyinotify-0.9.5.tar.gz New: ---- pyinotify-0.9.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pyinotify.spec ++++++ --- /var/tmp/diff_new_pack.Qp7HT4/_old 2016-01-05 09:41:58.000000000 +0100 +++ /var/tmp/diff_new_pack.Qp7HT4/_new 2016-01-05 09:41:58.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-pyinotify # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 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 @@ -17,7 +17,7 @@ Name: python-pyinotify -Version: 0.9.5 +Version: 0.9.6 Release: 0 Summary: Python module for watching filesystems changes License: MIT ++++++ pyinotify-0.9.5.tar.gz -> pyinotify-0.9.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyinotify-0.9.5/PKG-INFO new/pyinotify-0.9.6/PKG-INFO --- old/pyinotify-0.9.5/PKG-INFO 2015-01-09 22:49:28.000000000 +0100 +++ new/pyinotify-0.9.6/PKG-INFO 2015-06-04 17:50:19.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: pyinotify -Version: 0.9.5 +Version: 0.9.6 Summary: Linux filesystem events monitoring Home-page: http://github.com/seb-m/pyinotify Author: Sebastien Martini diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyinotify-0.9.5/python2/pyinotify.egg-info/PKG-INFO new/pyinotify-0.9.6/python2/pyinotify.egg-info/PKG-INFO --- old/pyinotify-0.9.5/python2/pyinotify.egg-info/PKG-INFO 2015-01-09 22:49:27.000000000 +0100 +++ new/pyinotify-0.9.6/python2/pyinotify.egg-info/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,33 +0,0 @@ -Metadata-Version: 1.1 -Name: pyinotify -Version: 0.9.5 -Summary: Linux filesystem events monitoring -Home-page: http://github.com/seb-m/pyinotify -Author: Sebastien Martini -Author-email: seb@dbzteam.org -License: MIT License -Download-URL: http://pypi.python.org/pypi/pyinotify -Description: UNKNOWN -Platform: Linux -Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Console -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: MIT License -Classifier: Natural Language :: English -Classifier: Operating System :: POSIX :: Linux -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.4 -Classifier: Programming Language :: Python :: 2.5 -Classifier: Programming Language :: Python :: 2.6 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.0 -Classifier: Programming Language :: Python :: 3.1 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: Implementation :: CPython -Classifier: Programming Language :: Python :: Implementation :: PyPy -Classifier: Topic :: Software Development :: Libraries :: Python Modules -Classifier: Topic :: System :: Filesystems -Classifier: Topic :: System :: Monitoring diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyinotify-0.9.5/python2/pyinotify.egg-info/SOURCES.txt new/pyinotify-0.9.6/python2/pyinotify.egg-info/SOURCES.txt --- old/pyinotify-0.9.5/python2/pyinotify.egg-info/SOURCES.txt 2015-01-09 22:49:28.000000000 +0100 +++ new/pyinotify-0.9.6/python2/pyinotify.egg-info/SOURCES.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,34 +0,0 @@ -ACKS -COPYING -MANIFEST.in -README.md -setup.py -common/inotify_syscalls.c -old/ChangeLog -old/NEWS -python2/Makefile -python2/pyinotify.py -python2/examples/autocompile.py -python2/examples/chain.py -python2/examples/coalesce.py -python2/examples/daemon.py -python2/examples/exclude.lst -python2/examples/exclude.py -python2/examples/loop.py -python2/examples/not_quiet.py -python2/examples/stats.py -python2/examples/stats_threaded.py -python2/examples/tornado_notifier.py -python2/examples/transient_file.py -python2/examples/transient_file.sh -python2/examples/tutorial_asyncnotifier.py -python2/examples/tutorial_notifier.py -python2/examples/tutorial_threadednotifier.py -python2/examples/unicode.py -python2/pyinotify.egg-info/PKG-INFO -python2/pyinotify.egg-info/SOURCES.txt -python2/pyinotify.egg-info/dependency_links.txt -python2/pyinotify.egg-info/top_level.txt -python3/Makefile -python3/pyinotify.py -python3/examples/asyncio_notifier.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyinotify-0.9.5/python2/pyinotify.egg-info/dependency_links.txt new/pyinotify-0.9.6/python2/pyinotify.egg-info/dependency_links.txt --- old/pyinotify-0.9.5/python2/pyinotify.egg-info/dependency_links.txt 2015-01-09 22:49:27.000000000 +0100 +++ new/pyinotify-0.9.6/python2/pyinotify.egg-info/dependency_links.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyinotify-0.9.5/python2/pyinotify.egg-info/top_level.txt new/pyinotify-0.9.6/python2/pyinotify.egg-info/top_level.txt --- old/pyinotify-0.9.5/python2/pyinotify.egg-info/top_level.txt 2015-01-09 22:49:27.000000000 +0100 +++ new/pyinotify-0.9.6/python2/pyinotify.egg-info/top_level.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -pyinotify diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyinotify-0.9.5/python2/pyinotify.py new/pyinotify-0.9.6/python2/pyinotify.py --- old/pyinotify-0.9.5/python2/pyinotify.py 2015-01-09 22:13:04.000000000 +0100 +++ new/pyinotify-0.9.6/python2/pyinotify.py 2015-06-04 17:34:41.000000000 +0200 @@ -95,7 +95,7 @@ __author__ = "seb@dbzteam.org (Sebastien Martini)" -__version__ = "0.9.5" +__version__ = "0.9.6" __metaclass__ = type # Use new-style classes by default @@ -258,10 +258,6 @@ assert self._libc is not None return self._libc.inotify_rm_watch(fd, wd) - def _sysctl(self, *args): - assert self._libc is not None - return self._libc.sysctl(*args) - # Logging def logger_init(): @@ -278,97 +274,65 @@ # inotify's variables -class SysCtlINotify: +class ProcINotify: """ - Access (read, write) inotify's variables through sysctl. Usually it - requires administrator rights to update them. + Access (read, write) inotify's variables through /proc/sys/. Note that + usually it requires administrator rights to update them. Examples: - Read max_queued_events attribute: myvar = max_queued_events.value - Update max_queued_events attribute: max_queued_events.value = 42 """ - - inotify_attrs = {'max_user_instances': 1, - 'max_user_watches': 2, - 'max_queued_events': 3} - - def __init__(self, attrname, inotify_wrapper): - # FIXME: right now only supporting ctypes - assert ctypes - self._attrname = attrname - self._inotify_wrapper = inotify_wrapper - sino = ctypes.c_int * 3 - self._attr = sino(5, 20, SysCtlINotify.inotify_attrs[attrname]) - - @staticmethod - def create(attrname): - """ - Factory method instanciating and returning the right wrapper. - """ - # FIXME: right now only supporting ctypes - if ctypes is None: - return None - inotify_wrapper = _CtypesLibcINotifyWrapper() - if not inotify_wrapper.init(): - return None - return SysCtlINotify(attrname, inotify_wrapper) + def __init__(self, attr): + self._base = "/proc/sys/fs/inotify" + self._attr = attr def get_val(self): """ - Gets attribute's value. Raises OSError if the operation failed. + Gets attribute's value. @return: stored value. @rtype: int + @raise IOError: if corresponding file in /proc/sys cannot be read. """ - oldv = ctypes.c_int(0) - size = ctypes.c_int(ctypes.sizeof(oldv)) - sysctl = self._inotify_wrapper._sysctl - res = sysctl(self._attr, 3, - ctypes.c_voidp(ctypes.addressof(oldv)), - ctypes.addressof(size), - None, 0) - if res == -1: - raise OSError(self._inotify_wrapper.get_errno(), - self._inotify_wrapper.str_errno()) - return oldv.value + file_obj = file(os.path.join(self._base, self._attr), 'r') + try: + val = int(file_obj.readline()) + finally: + file_obj.close() + return val def set_val(self, nval): """ - Sets new attribute's value. Raises OSError if the operation failed. + Sets new attribute's value. @param nval: replaces current value by nval. @type nval: int + @raise IOError: if corresponding file in /proc/sys cannot be written. """ - oldv = ctypes.c_int(0) - sizeo = ctypes.c_int(ctypes.sizeof(oldv)) - newv = ctypes.c_int(nval) - sizen = ctypes.c_int(ctypes.sizeof(newv)) - sysctl = self._inotify_wrapper._sysctl - res = sysctl(self._attr, 3, - ctypes.c_voidp(ctypes.addressof(oldv)), - ctypes.addressof(sizeo), - ctypes.c_voidp(ctypes.addressof(newv)), - sizen) - if res == -1: - raise OSError(self._inotify_wrapper.get_errno(), - self._inotify_wrapper.str_errno()) + file_obj = file(os.path.join(self._base, self._attr), 'w') + try: + file_obj.write(str(nval) + '\n') + finally: + file_obj.close() value = property(get_val, set_val) def __repr__(self): - return '<%s=%d>' % (self._attrname, self.get_val()) + return '<%s=%d>' % (self._attr, self.get_val()) # Inotify's variables # -# FIXME: currently these variables are only accessible when ctypes is used, -# otherwise there are set to None. +# Note: may raise IOError if the corresponding value in /proc/sys +# cannot be accessed. # -# read: myvar = max_queued_events.value -# update: max_queued_events.value = 42 +# Examples: +# - read: myvar = max_queued_events.value +# - update: max_queued_events.value = 42 # for attrname in ('max_queued_events', 'max_user_instances', 'max_user_watches'): - globals()[attrname] = SysCtlINotify.create(attrname) + globals()[attrname] = ProcINotify(attrname) class EventsCodes: @@ -1149,8 +1113,8 @@ @type default_proc_fun: instance of ProcessEvent @param read_freq: if read_freq == 0, events are read asap, if read_freq is > 0, this thread sleeps - max(0, read_freq - timeout) seconds. But if - timeout is None it may be different because + max(0, read_freq - (timeout / 1000)) seconds. But + if timeout is None it may be different because poll is blocking waiting for something to read. @type read_freq: int @param threshold: File descriptor will be read only if the accumulated @@ -1161,8 +1125,9 @@ until the amount of events to read is >= threshold. At least with read_freq set you might sleep. @type threshold: int - @param timeout: - https://docs.python.org/3/library/select.html#polling-objects + @param timeout: see read_freq above. If provided, it must be set in + milliseconds. See + https://docs.python.org/2/library/select.html#polling-objects @type timeout: int """ # Watch Manager instance @@ -1228,7 +1193,8 @@ milliseconds. @param timeout: If specified it overrides the corresponding instance - attribute _timeout. + attribute _timeout. timeout must be sepcified in + milliseconds. @type timeout: int @return: New events to read. @@ -1441,9 +1407,12 @@ Close inotify's instance (close its file descriptor). It destroys all existing watches, pending events,... This method is automatically called at the end of loop(). + Afterward it is invalid to access this instance. """ - self._pollobj.unregister(self._fd) - os.close(self._fd) + if self._fd is not None: + self._pollobj.unregister(self._fd) + os.close(self._fd) + self._fd = None self._sys_proc_fun = None @@ -1468,7 +1437,7 @@ @type default_proc_fun: instance of ProcessEvent @param read_freq: if read_freq == 0, events are read asap, if read_freq is > 0, this thread sleeps - max(0, read_freq - timeout) seconds. + max(0, read_freq - (timeout / 1000)) seconds. @type read_freq: int @param threshold: File descriptor will be read only if the accumulated size to read becomes >= threshold. If != 0, you likely @@ -1478,8 +1447,9 @@ until the amount of events to read is >= threshold. At least with read_freq you might sleep. @type threshold: int - @param timeout: - https://docs.python.org/3/library/select.html#polling-objects + @param timeout: see read_freq above. If provided, it must be set in + milliseconds. See + https://docs.python.org/2/library/select.html#select.poll.poll @type timeout: int """ # Init threading base class @@ -1911,7 +1881,7 @@ although unicode paths are accepted there are converted to byte strings before a watch is put on that path. The encoding used for converting the unicode object is given by sys.getfilesystemencoding(). - If |path| si already watched it is ignored, but if it is called with + If |path| is already watched it is ignored, but if it is called with option rec=True a watch is put on each one of its not-watched subdirectory. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyinotify-0.9.5/python3/pyinotify.py new/pyinotify-0.9.6/python3/pyinotify.py --- old/pyinotify-0.9.5/python3/pyinotify.py 2015-01-09 22:13:32.000000000 +0100 +++ new/pyinotify-0.9.6/python3/pyinotify.py 2015-06-04 17:34:41.000000000 +0200 @@ -92,7 +92,7 @@ __author__ = "seb@dbzteam.org (Sebastien Martini)" -__version__ = "0.9.5" +__version__ = "0.9.6" # Compatibity mode: set to True to improve compatibility with @@ -251,10 +251,6 @@ assert self._libc is not None return self._libc.inotify_rm_watch(fd, wd) - def _sysctl(self, *args): - assert self._libc is not None - return self._libc.sysctl(*args) - # Logging def logger_init(): @@ -271,94 +267,58 @@ # inotify's variables -class SysCtlINotify: +class ProcINotify: """ - Access (read, write) inotify's variables through sysctl. Usually it - requires administrator rights to update them. + Access (read, write) inotify's variables through /proc/sys/. Note that + usually it requires administrator rights to update them. Examples: - Read max_queued_events attribute: myvar = max_queued_events.value - Update max_queued_events attribute: max_queued_events.value = 42 """ - - inotify_attrs = {'max_user_instances': 1, - 'max_user_watches': 2, - 'max_queued_events': 3} - - def __init__(self, attrname, inotify_wrapper): - # FIXME: right now only supporting ctypes - assert ctypes - self._attrname = attrname - self._inotify_wrapper = inotify_wrapper - sino = ctypes.c_int * 3 - self._attr = sino(5, 20, SysCtlINotify.inotify_attrs[attrname]) - - @staticmethod - def create(attrname): - # FIXME: right now only supporting ctypes - if ctypes is None: - return None - inotify_wrapper = _CtypesLibcINotifyWrapper() - if not inotify_wrapper.init(): - return None - return SysCtlINotify(attrname, inotify_wrapper) + def __init__(self, attr): + self._base = "/proc/sys/fs/inotify" + self._attr = attr def get_val(self): """ - Gets attribute's value. Raises OSError if the operation failed. + Gets attribute's value. @return: stored value. @rtype: int + @raise IOError: if corresponding file in /proc/sys cannot be read. """ - oldv = ctypes.c_int(0) - size = ctypes.c_int(ctypes.sizeof(oldv)) - sysctl = self._inotify_wrapper._sysctl - res = sysctl(self._attr, 3, - ctypes.c_voidp(ctypes.addressof(oldv)), - ctypes.addressof(size), - None, 0) - if res == -1: - raise OSError(self._inotify_wrapper.get_errno(), - self._inotify_wrapper.str_errno()) - return oldv.value + with open(os.path.join(self._base, self._attr), 'r') as file_obj: + return int(file_obj.readline()) def set_val(self, nval): """ - Sets new attribute's value. Raises OSError if the operation failed. + Sets new attribute's value. @param nval: replaces current value by nval. @type nval: int + @raise IOError: if corresponding file in /proc/sys cannot be written. """ - oldv = ctypes.c_int(0) - sizeo = ctypes.c_int(ctypes.sizeof(oldv)) - newv = ctypes.c_int(nval) - sizen = ctypes.c_int(ctypes.sizeof(newv)) - sysctl = self._inotify_wrapper._sysctl - res = sysctl(self._attr, 3, - ctypes.c_voidp(ctypes.addressof(oldv)), - ctypes.addressof(sizeo), - ctypes.c_voidp(ctypes.addressof(newv)), - sizen) - if res == -1: - raise OSError(self._inotify_wrapper.get_errno(), - self._inotify_wrapper.str_errno()) + with open(os.path.join(self._base, self._attr), 'w') as file_obj: + file_obj.write(str(nval) + '\n') value = property(get_val, set_val) def __repr__(self): - return '<%s=%d>' % (self._attrname, self.get_val()) + return '<%s=%d>' % (self._attr, self.get_val()) # Inotify's variables # -# FIXME: currently these variables are only accessible when ctypes is used, -# otherwise there are set to None. +# Note: may raise IOError if the corresponding value in /proc/sys +# cannot be accessed. # -# read: myvar = max_queued_events.value -# update: max_queued_events.value = 42 +# Examples: +# - read: myvar = max_queued_events.value +# - update: max_queued_events.value = 42 # for attrname in ('max_queued_events', 'max_user_instances', 'max_user_watches'): - globals()[attrname] = SysCtlINotify.create(attrname) + globals()[attrname] = ProcINotify(attrname) class EventsCodes: @@ -1139,7 +1099,7 @@ @type default_proc_fun: instance of ProcessEvent @param read_freq: if read_freq == 0, events are read asap, if read_freq is > 0, this thread sleeps - max(0, read_freq - timeout) seconds. But if + max(0, read_freq - (timeout / 1000)) seconds. But if timeout is None it may be different because poll is blocking waiting for something to read. @type read_freq: int @@ -1151,8 +1111,9 @@ until the amount of events to read is >= threshold. At least with read_freq set you might sleep. @type threshold: int - @param timeout: - http://docs.python.org/lib/poll-objects.html#poll-objects + @param timeout: see read_freq above. If provided, it must be set in + milliseconds. See + https://docs.python.org/3/library/select.html#select.poll.poll @type timeout: int """ # Watch Manager instance @@ -1218,7 +1179,8 @@ milliseconds. @param timeout: If specified it overrides the corresponding instance - attribute _timeout. + attribute _timeout. timeout must be sepcified in + milliseconds. @type timeout: int @return: New events to read. @@ -1431,9 +1393,12 @@ Close inotify's instance (close its file descriptor). It destroys all existing watches, pending events,... This method is automatically called at the end of loop(). + Afterward it is invalid to access this instance. """ - self._pollobj.unregister(self._fd) - os.close(self._fd) + if self._fd is not None: + self._pollobj.unregister(self._fd) + os.close(self._fd) + self._fd = None self._sys_proc_fun = None @@ -1458,7 +1423,7 @@ @type default_proc_fun: instance of ProcessEvent @param read_freq: if read_freq == 0, events are read asap, if read_freq is > 0, this thread sleeps - max(0, read_freq - timeout) seconds. + max(0, read_freq - (timeout / 1000)) seconds. @type read_freq: int @param threshold: File descriptor will be read only if the accumulated size to read becomes >= threshold. If != 0, you likely @@ -1468,8 +1433,9 @@ until the amount of events to read is >= threshold. At least with read_freq you might sleep. @type threshold: int - @param timeout: - see http://docs.python.org/lib/poll-objects.html#poll-objects + @param timeout: see read_freq above. If provided, it must be set in + milliseconds. See + https://docs.python.org/3/library/select.html#select.poll.poll @type timeout: int """ # Init threading base class diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyinotify-0.9.5/setup.cfg new/pyinotify-0.9.6/setup.cfg --- old/pyinotify-0.9.5/setup.cfg 2015-01-09 22:49:28.000000000 +0100 +++ new/pyinotify-0.9.6/setup.cfg 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -[egg_info] -tag_build = -tag_date = 0 -tag_svn_revision = 0 - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pyinotify-0.9.5/setup.py new/pyinotify-0.9.6/setup.py --- old/pyinotify-0.9.5/setup.py 2015-01-09 22:11:57.000000000 +0100 +++ new/pyinotify-0.9.6/setup.py 2015-06-04 17:34:41.000000000 +0200 @@ -103,7 +103,7 @@ setup( name='pyinotify', - version='0.9.5', + version='0.9.6', description='Linux filesystem events monitoring', author='Sebastien Martini', author_email='seb@dbzteam.org',