compat.py passes pyflakes test

Drop support for Python 2.6 and 3.3
pull/380/head
cclauss 6 years ago
parent 2b56963f31
commit b569b19a7f

@ -1,32 +1,26 @@
language: python language: python
matrix: matrix:
allow_failures:
- env: TOX_ENV=squeeze
include: include:
- python: 2.6
env: TOX_ENV=py26
- python: 2.7 - python: 2.7
env: TOX_ENV=py27 env: TOX_ENV=py27
- python: 3.3
env: TOX_ENV=py33
- python: 3.4 - python: 3.4
env: TOX_ENV=py34 env: TOX_ENV=py34
- python: 3.5 - python: 3.5
env: TOX_ENV=py35 env: TOX_ENV=py35
- python: 3.6 - python: 3.6
env: TOX_ENV=py36 env: TOX_ENV=py36
- python: 2.6
env: TOX_ENV=squeeze
- python: 2.7 - python: 2.7
env: TOX_ENV=wheezy env: TOX_ENV=wheezy
install: install:
- pip install -U pip - pip install -U pip
- pip install tox - pip install flake8 tox
- pip install pyflakes
- sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm - sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm
script: script:
- tox -e $TOX_ENV - tox -e $TOX_ENV
- python -m pyflakes.__main__ $(git ls-files | grep -E "^isso/.+.py$" | grep -v "^isso/compat.py") # stop the build if there are Python syntax errors or undefined names
- flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
notifications: notifications:
irc: irc:
channels: channels:

@ -79,7 +79,7 @@ Install from PyPi
Requirements Requirements
^^^^^^^^^^^^ ^^^^^^^^^^^^
- Python 2.6, 2.7 or 3.3+ (+ devel headers) - Python 2.7 or 3.4+ (+ devel headers)
- SQLite 3.3.8 or later - SQLite 3.3.8 or later
- a working C compiler - a working C compiler
@ -157,7 +157,7 @@ Install from Source
If you want to hack on Isso or track down issues, there's an alternate If you want to hack on Isso or track down issues, there's an alternate
way to set up Isso. It requires a lot more dependencies and effort: way to set up Isso. It requires a lot more dependencies and effort:
- Python 2.6, 2.7 or 3.3+ (+ devel headers) - Python 2.7 or 3.4+ (+ devel headers)
- Virtualenv - Virtualenv
- SQLite 3.3.8 or later - SQLite 3.3.8 or later
- a working C compiler - a working C compiler

@ -1,28 +1,22 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
import sys try:
PY2K = sys.version_info[0] == 2 text_type = unicode # Python 2
string_types = (str, unicode)
if not PY2K: PY2K = True
except NameError: # Python 3
map, zip, filter = map, zip, filter PY2K = False
from functools import reduce
iteritems = lambda dikt: iter(dikt.items())
text_type = str text_type = str
string_types = (str, ) string_types = (str, )
if not PY2K:
buffer = memoryview buffer = memoryview
filter, map, zip = filter, map, zip
iteritems = lambda dikt: iter(dikt.items()) # noqa: E731
from functools import reduce
else: else:
from itertools import imap, izip, ifilter
map, zip, filter = imap, izip, ifilter
reduce = reduce
iteritems = lambda dikt: dikt.iteritems()
text_type = unicode
string_types = (str, unicode)
buffer = buffer buffer = buffer
from itertools import ifilter, imap, izip
filter, map, zip = ifilter, imap, izip
iteritems = lambda dikt: dikt.iteritems() # noqa: E731
reduce = reduce

@ -17,11 +17,6 @@ from isso.compat import text_type as str
logger = logging.getLogger("isso") logger = logging.getLogger("isso")
# Python 2.6 compatibility
def total_seconds(td):
return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 10**6) / 10**6
def timedelta(string): def timedelta(string):
""" """
Parse :param string: into :class:`datetime.timedelta`, you can use any Parse :param string: into :class:`datetime.timedelta`, you can use any
@ -101,7 +96,7 @@ class IssoParser(ConfigParser):
try: try:
return int(delta.total_seconds()) return int(delta.total_seconds())
except AttributeError: except AttributeError:
return int(total_seconds(delta)) return int(delta.total_seconds())
def getlist(self, section, key): def getlist(self, section, key):
return list(map(str.strip, self.get(section, key).split(','))) return list(map(str.strip, self.get(section, key).split(',')))

@ -5,11 +5,7 @@ from __future__ import unicode_literals
import os import os
import json import json
import tempfile import tempfile
import unittest
try:
import unittest2 as unittest
except ImportError:
import unittest
try: try:
from urllib.parse import urlencode from urllib.parse import urlencode

@ -1,10 +1,6 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
try: import unittest
import unittest2 as unittest
except ImportError:
import unittest
import io import io
from isso import config from isso import config

@ -1,10 +1,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
try: import unittest
import unittest2 as unittest
except ImportError:
import unittest
from werkzeug.test import Client from werkzeug.test import Client
from werkzeug.wrappers import Response from werkzeug.wrappers import Response

@ -1,10 +1,6 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
try: import unittest
import unittest2 as unittest
except ImportError:
import unittest
import os import os
import sqlite3 import sqlite3
import tempfile import tempfile

@ -2,11 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
try: import unittest
import unittest2 as unittest
except ImportError:
import unittest
import os import os
import json import json
import tempfile import tempfile

@ -1,10 +1,6 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
try: import unittest
import unittest2 as unittest
except ImportError:
import unittest
import textwrap import textwrap
from isso import config from isso import config

@ -2,11 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
try: import unittest
import unittest2 as unittest
except ImportError:
import unittest
import tempfile import tempfile
from os.path import join, dirname from os.path import join, dirname

@ -1,10 +1,6 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
try: import unittest
import unittest2 as unittest
except ImportError:
import unittest
from isso import utils from isso import utils
from isso.utils import parse from isso.utils import parse

@ -2,10 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
try: import unittest
import unittest2 as unittest
except ImportError:
import unittest
from isso import config from isso import config
@ -70,4 +67,4 @@ class TestCreate(unittest.TestCase):
pbkdf2 = _new("pbkdf2:16:2:md5") pbkdf2 = _new("pbkdf2:16:2:md5")
self.assertIsInstance(pbkdf2, PBKDF2) self.assertIsInstance(pbkdf2, PBKDF2)
self.assertEqual(pbkdf2.dklen, 2) self.assertEqual(pbkdf2.dklen, 2)
self.assertEqual(pbkdf2.func, "md5") self.assertEqual(pbkdf2.func, "md5")

@ -4,11 +4,7 @@ from __future__ import unicode_literals
import os import os
import json import json
import tempfile import tempfile
import unittest
try:
import unittest2 as unittest
except ImportError:
import unittest
from werkzeug.wrappers import Response from werkzeug.wrappers import Response

@ -1,10 +1,6 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
try: import unittest
import unittest2 as unittest
except ImportError:
import unittest
from isso import wsgi from isso import wsgi

@ -5,10 +5,13 @@ import sys
from setuptools import setup, find_packages from setuptools import setup, find_packages
requires = ['itsdangerous', 'misaka>=1.0,<2.0', 'html5lib==0.9999999', 'Jinja2'] requires = ['html5lib==0.9999999', 'itsdangerous', 'Jinja2',
'misaka>=1.0,<2.0', 'werkzeug>=0.9']
if (3, 0) <= sys.version_info < (3, 3): if sys.version_info < (2, 7):
raise SystemExit("Python 3.0, 3.1 and 3.2 are not supported") raise SystemExit("Python 2 versions < 2.7 are not supported.")
elif (3, 0) <= sys.version_info < (3, 4):
raise SystemExit("Python 3 versions < 3.4 are not supported.")
setup( setup(
name='isso', name='isso',
@ -27,16 +30,14 @@ setup(
"Topic :: Internet :: WWW/HTTP :: HTTP Servers", "Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"License :: OSI Approved :: MIT License", "License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7", "Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.4" "Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6"
], ],
install_requires=requires, install_requires=requires,
extras_require={ extras_require={
':python_version=="2.6"': ['argparse', 'ordereddict'], ':python_version=="2.7"': ['ipaddr>=2.1', 'configparser']
':python_version=="2.6" or python_version=="2.7"': ['ipaddr>=2.1', 'configparser', 'werkzeug>=0.8'],
':python_version!="2.6" and python_version!="2.7"': ['werkzeug>=0.9']
}, },
entry_points={ entry_points={
'console_scripts': 'console_scripts':

@ -1,5 +1,5 @@
[tox] [tox]
envlist = py27,py33,py34,py35,py36 envlist = py27,py34,py35,py36
[testenv] [testenv]
deps = deps =
@ -8,14 +8,6 @@ deps =
commands = commands =
python setup.py nosetests python setup.py nosetests
[testenv:py26]
deps =
argparse
unittest2
ordereddict
configparser
{[testenv]deps}
[testenv:py27] [testenv:py27]
deps = deps =
configparser configparser
@ -30,12 +22,6 @@ deps=
passlib==1.5.3 passlib==1.5.3
werkzeug==0.8.3 werkzeug==0.8.3
[testenv:squeeze]
basepython=python2.6
deps=
{[testenv:py26]deps}
{[testenv:debian]deps}
[testenv:wheezy] [testenv:wheezy]
basepython=python2.7 basepython=python2.7
deps = deps =

Loading…
Cancel
Save