Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stay Python 2.6 compatible #62

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Stay Python 2.6 compatible
As there are many installations with only default 2.6 Python in place an no "supported" updates are available in official repos for OS we should try to stay Python 2.6 compatible... (At least all the Redhat/Centos 6 systems are affected)

* Update .travis.yml
** include v2.6 and for that version do the following addtional tasks:
*** explicitly install pycparser version 2.18 needed by coverall as this is latest version that's 2.6 compatible
*** install unittest2 to have the newer unittest features available for 2.6 so only minimal change required for test_inotify.py
* Update test_inotify.py
** import unittest2 as unittest for python version 2.6
* Update adapters.py
** change debug code to format syntax understood by 2.6
  • Loading branch information
Elias481 authored Sep 20, 2018
commit aebec5fd23c18aef32ce77ee77d4ea50af1af392
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
language: python
python:
- "2.6"
- "2.7"
- "3.3"
- "3.4"
- "3.5"

install:
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install pycparser==2.18; pip install unittest2; fi
- pip install -r requirements.txt
- pip install coveralls
script: nosetests -s -v --with-coverage --cover-package=inotify
Expand Down
4 changes: 2 additions & 2 deletions inotify/adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def _handle_inotify_event(self, wd):

header = _INOTIFY_EVENT(*header_raw)
type_names = self._get_event_names(header.mask)
_LOGGER.debug("Events received in stream: {}".format(type_names))
_LOGGER.debug("Events received in stream: {0}".format(type_names))
Elias481 marked this conversation as resolved.
Show resolved Hide resolved

event_length = (_STRUCT_HEADER_LENGTH + header.len)
if length < event_length:
Expand Down Expand Up @@ -225,7 +225,7 @@ def event_gen(
# (fd) looks to always match the inotify FD.

names = self._get_event_names(event_type)
_LOGGER.debug("Events received from epoll: {}".format(names))
_LOGGER.debug("Events received from epoll: {0}".format(names))
Elias481 marked this conversation as resolved.
Show resolved Hide resolved

for (header, type_names, path, filename) \
in self._handle_inotify_event(fd):
Expand Down
6 changes: 5 additions & 1 deletion tests/test_inotify.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# -*- coding: utf-8 -*-

import os
import unittest
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest

import inotify.constants
import inotify.adapters
Expand Down