dsoprea / PyInotify

An efficient and elegant inotify (Linux filesystem activity monitor) library for Python. Python 2 and 3 compatible.
GNU General Public License v2.0
245 stars 73 forks source link

Seemingly getting code from 0.2.8 when 0.2.9 is the installed version #43

Closed audiodude closed 6 years ago

audiodude commented 6 years ago

I have the following:

$ pip freeze
inotify==0.2.9
$ python
Python 2.7.14 (default, Jan 18 2018, 19:27:07) 
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import inotify.adapters
>>> import inspect
>>> print inspect.getsource(inotify.adapters.Inotify.event_gen)
    def event_gen(self):
        while True:
            block_duration_s = self.__get_block_duration()

            # Poll, but manage signal-related errors.

            try:
                events = self.__epoll.poll(block_duration_s)
            except IOError as e:
                if e.errno != EINTR:
                    raise

                continue

            # Process events.

            for fd, event_type in events:
                # (fd) looks to always match the inotify FD.

                for (header, type_names, path, filename) \
                        in self.__handle_inotify_event(fd, event_type):
                    yield (header, type_names, path, filename)

            yield None

>>> 

I originally noticed I was getting "unknown keyword argument" when trying to pass yield_nones=False to event_gen, which made me try to look up the source like this. It looks like the code that's being run is from version 0.2.8 on github: https://github.com/dsoprea/PyInotify/blob/0.2.8/inotify/adapters.py#L160

kaplun commented 6 years ago

I confirm. The wheel https://pypi.python.org/packages/f9/22/cd2aa02d241fd79e5a07597480d5db2b9fc0f3a6f399d846611ea1ae7809/inotify-0.2.9-py2-none-any.whl#md5=8f7db48adfb75f015a3ea2959c3a154c availabile on Pypi is actually outdated with respect to the .tar.gz sources.

kaplun commented 6 years ago

The current workaround is to install directly from the source:

$ pip install inotify --no-binary :all:
dsoprea commented 6 years ago

I've done a 0.2.10 release so that this will no longer be a problem.