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

Support for musl libc (Alpine Linux) #27

Closed jessesuen closed 7 years ago

jessesuen commented 7 years ago

Accessing _LIB.errno on musl libc results in "AttributeError: Symbol not found: errno". For musl libc, changing this to _LIB.err resolves the issue.

dsoprea commented 7 years ago

That's annoying.

Please change it to the following and test:

if getattr(_LIB, 'errno') is not None:
    errno = _LIB.errno
elif getattr(_LIB, 'err') is not None:
    errno = _LIB.err
else:
    raise EnvironmentError("'errno' not found in library")

Thanks for contributing.

jessesuen commented 7 years ago

Updated with your feedback, although getattr() needs a default value or else it will still raise AttributeError.

dsoprea commented 7 years ago

Yep. This is just a more general solution, in the event that other distributions have that same difference.

You tested?

jessesuen commented 7 years ago

Yes, tested in debian:8.5 and alpine:3.4 containers.

jacobsvante commented 6 years ago

Any chance we might see a release with this?