Skip to content

Commit a13dbe6

Browse files
hugovkmyint
authored andcommitted
Drop support for EOL Python <2.7 and 3.2-3.3 (#322)
* Ignore JetBrains/PyCharm project files * Drop support for EOL Python <2.7, 3.2-3.3 * Replace function call with set literal * Drop pypy3.3-5.2-alpha1 as it's based on EOL Python 3.3.5 * PY32 and PY33 are now essentially equal to PY2 * Upgrade pypy3-2.4.0 (Python 3.2.5) to pypy3-v5.10.0 (Python 3.5.3) * Comment out failing pypy3-v5.10.0 until pypy3-v5.10.1 is released * Revert "Ignore JetBrains/PyCharm project files" This reverts commit 99f1d96.
1 parent a440c20 commit a13dbe6

File tree

13 files changed

+49
-92
lines changed

13 files changed

+49
-92
lines changed

.appveyor.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,21 @@ install:
1313
- ps: 7z x pypy2-v5.3.1-win32.zip | Out-Null
1414
- move pypy2-v5.3.1-win32 C:\
1515

16-
- ps: (New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-win32.zip', "$env:appveyor_build_folder\pypy3-2.4.0-win32.zip")
17-
- ps: 7z x pypy3-2.4.0-win32.zip | Out-Null
18-
- move pypy3-2.4.0-win32 C:\
16+
# Note: pypy3-v5.10.0 is commented out as it needs an updated pip to
17+
# recognise the new python_requires, but there's a pypy bug preventing that.
18+
# It's been fixed and will be in the next 5.10.1 release.
19+
# See https://bitbucket.org/pypy/pypy/issues/2720/ensurepip-on-pypy-c-jit-93579-a4194a67868f
20+
# and https://stackoverflow.com/q/47999518/724176.
1921

20-
# pypy3 installer provides 'pypy.exe', not pypy3.exe.
21-
- copy C:\pypy3-2.4.0-win32\pypy.exe C:\pypy3-2.4.0-win32\pypy3.exe
22+
# - ps: (New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy3-v5.10.0-win32.zip', "$env:appveyor_build_folder\pypy3-v5.10.0-win32.zip")
23+
# - ps: 7z x pypy3-v5.10.0-win32.zip | Out-Null
24+
# - move pypy3-v5.10.0-win32 C:\
2225

2326
# workaround https://github.com/pypa/virtualenv/issues/93
2427
- mkdir C:\python33\tcl\tcl8.6
2528
- mkdir C:\python33\tcl\tk8.6
26-
- mkdir C:\pypy3-2.4.0-win32\tcl\tcl8.6
27-
- mkdir C:\pypy3-2.4.0-win32\tcl\tk8.6
29+
# - mkdir C:\pypy3-v5.10.0-win32\tcl\tcl8.6
30+
# - mkdir C:\pypy3-v5.10.0-win32\tcl\tk8.6
2831

2932
# Only pypy2-5.3.1 is integrated into tox, as pypy3-2.4.0 fails and
3033
# a Windows distribution of pypy3-5.2 isnt available yet.
@@ -33,14 +36,13 @@ install:
3336
# pypy3-2.4.0 and pypy-2.6.1 are manually bootstrapped and tested
3437
- ps: (New-Object Net.WebClient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', "$env:appveyor_build_folder\get-pip.py")
3538
# errors are ignored due to https://github.com/pypa/pip/issues/2669#issuecomment-136405390
36-
# NOTE: If and when a new version of PyPy3 is released for Windows that
37-
# supports anything newer than Python 3.2, remove the setuptools pin.
38-
- ps: C:\pypy3-2.4.0-win32\pypy3 "$env:appveyor_build_folder\get-pip.py"; C:\pypy3-2.4.0-win32\pypy3 -m pip install -U --force-reinstall pip==8.1.2 "setuptools<30"; echo "ignore error"
39+
# - ps: C:\pypy3-v5.10.0-win32\pypy3 "$env:appveyor_build_folder\get-pip.py"; echo "ignore error"
40+
# - ps: C:\pypy3-v5.10.0-win32\pypy3 -m pip install -U --force-reinstall pip setuptools; echo "ignore error"
3941
- ps: C:\pypy-2.6.1-win32\pypy "$env:appveyor_build_folder\get-pip.py"
4042

4143
build: off
4244

4345
test_script:
4446
- python -m tox
45-
- C:\pypy3-2.4.0-win32\pypy3 setup.py test -q
47+
# - C:\pypy3-v5.10.0-win32\pypy3 setup.py test -q
4648
- C:\pypy-2.6.1-win32\pypy setup.py test -q

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
language: python
22
cache: pip
33
python:
4-
- 2.6
54
- 2.7
6-
- 3.3
75
- 3.4
86
- 3.5
97
- 3.6
108
- nightly
119
- pypy
1210
- pypy-5.3
1311
- pypy3
14-
- pypy3.3-5.2-alpha1
1512
install:
1613
- pip install --upgrade .
1714
- pip list

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ parsing the source file, not importing it, so it is safe to use on
99
modules with side effects. It's also much faster.
1010

1111
It is `available on PyPI <https://pypi.python.org/pypi/pyflakes>`_
12-
and it supports all active versions of Python from 2.5 to 3.6.
12+
and it supports all active versions of Python: 2.7 and 3.4 to 3.6.
1313

1414

1515

pyflakes/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pyflakes.api import main
22

3-
# python -m pyflakes (with Python >= 2.7)
3+
# python -m pyflakes
44
if __name__ == '__main__':
55
main(prog='pyflakes')

pyflakes/api.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,8 @@ def checkPath(filename, reporter=None):
8989
if reporter is None:
9090
reporter = modReporter._makeDefaultReporter()
9191
try:
92-
# in Python 2.6, compile() will choke on \r\n line endings. In later
93-
# versions of python it's smarter, and we want binary mode to give
94-
# compile() the best opportunity to do the right thing WRT text
95-
# encodings.
96-
if sys.version_info < (2, 7):
97-
mode = 'rU'
98-
else:
99-
mode = 'rb'
100-
101-
with open(filename, mode) as f:
92+
with open(filename, 'rb') as f:
10293
codestr = f.read()
103-
if sys.version_info < (2, 7):
104-
codestr += '\n' # Work around for Python <= 2.6
10594
except UnicodeError:
10695
reporter.unexpectedError(filename, 'problem decoding source')
10796
return 1

pyflakes/checker.py

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
Also, it models the Bindings and Scopes.
66
"""
77
import __future__
8+
import ast
89
import doctest
910
import os
1011
import sys
1112

1213
PY2 = sys.version_info < (3, 0)
13-
PY32 = sys.version_info < (3, 3) # Python 2.5 to 3.2
14-
PY33 = sys.version_info < (3, 4) # Python 2.5 to 3.3
15-
PY34 = sys.version_info < (3, 5) # Python 2.5 to 3.4
14+
PY34 = sys.version_info < (3, 5) # Python 2.7 to 3.4
1615
try:
1716
sys.pypy_version_info
1817
PYPY = True
@@ -21,16 +20,6 @@
2120

2221
builtin_vars = dir(__import__('__builtin__' if PY2 else 'builtins'))
2322

24-
try:
25-
import ast
26-
except ImportError: # Python 2.5
27-
import _ast as ast
28-
29-
if 'decorator_list' not in ast.ClassDef._fields:
30-
# Patch the missing attribute 'decorator_list'
31-
ast.ClassDef.decorator_list = ()
32-
ast.FunctionDef.decorator_list = property(lambda s: s.decorators)
33-
3423
from pyflakes import messages
3524

3625

@@ -53,7 +42,7 @@ def get_raise_argument(node):
5342
unicode = str
5443

5544
# Python >= 3.3 uses ast.Try instead of (ast.TryExcept + ast.TryFinally)
56-
if PY32:
45+
if PY2:
5746
def getAlternatives(n):
5847
if isinstance(n, (ast.If, ast.TryFinally)):
5948
return [n.body]
@@ -138,7 +127,7 @@ def convert_to_value(item):
138127
result.name,
139128
result,
140129
)
141-
elif (not PY33) and isinstance(item, ast.NameConstant):
130+
elif (not PY2) and isinstance(item, ast.NameConstant):
142131
# None, True, False are nameconstants in python3, but names in 2
143132
return item.value
144133
else:
@@ -421,8 +410,8 @@ class FunctionScope(Scope):
421410
@ivar globals: Names declared 'global' in this function.
422411
"""
423412
usesLocals = False
424-
alwaysUsed = set(['__tracebackhide__',
425-
'__traceback_info__', '__traceback_supplement__'])
413+
alwaysUsed = {'__tracebackhide__', '__traceback_info__',
414+
'__traceback_supplement__'}
426415

427416
def __init__(self):
428417
super(FunctionScope, self).__init__()
@@ -1206,9 +1195,9 @@ def addArgs(arglist):
12061195
wildcard = getattr(node.args, arg_name)
12071196
if not wildcard:
12081197
continue
1209-
args.append(wildcard if PY33 else wildcard.arg)
1198+
args.append(wildcard if PY2 else wildcard.arg)
12101199
if is_py3_func:
1211-
if PY33: # Python 2.5 to 3.3
1200+
if PY2: # Python 2.7
12121201
argannotation = arg_name + 'annotation'
12131202
annotations.append(getattr(node.args, argannotation))
12141203
else: # Python >= 3.4
@@ -1249,7 +1238,7 @@ def checkUnusedAssignments():
12491238
self.report(messages.UnusedVariable, binding.source, name)
12501239
self.deferAssignment(checkUnusedAssignments)
12511240

1252-
if PY32:
1241+
if PY2:
12531242
def checkReturnWithArgumentInsideGenerator():
12541243
"""
12551244
Check to see if there is any return statement with

pyflakes/test/harness.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11

2-
import sys
32
import textwrap
43
import unittest
54

65
from pyflakes import checker
76

87
__all__ = ['TestCase', 'skip', 'skipIf']
98

10-
if sys.version_info < (2, 7):
11-
skip = lambda why: (lambda func: 'skip') # not callable
12-
skipIf = lambda cond, why: (skip(why) if cond else lambda func: func)
13-
else:
14-
skip = unittest.skip
15-
skipIf = unittest.skipIf
9+
skip = unittest.skip
10+
skipIf = unittest.skipIf
1611
PyCF_ONLY_AST = 1024
1712

1813

pyflakes/test/test_dict.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,11 @@ def test_duplicate_keys(self):
1919

2020
@skipIf(version_info < (3,),
2121
"bytes and strings with same 'value' are not equal in python3")
22-
@skipIf(version_info[0:2] == (3, 2),
23-
"python3.2 does not allow u"" literal string definition")
2422
def test_duplicate_keys_bytes_vs_unicode_py3(self):
2523
self.flakes("{b'a': 1, u'a': 2}")
2624

2725
@skipIf(version_info < (3,),
2826
"bytes and strings with same 'value' are not equal in python3")
29-
@skipIf(version_info[0:2] == (3, 2),
30-
"python3.2 does not allow u"" literal string definition")
3127
def test_duplicate_values_bytes_vs_unicode_py3(self):
3228
self.flakes(
3329
"{1: b'a', 1: u'a'}",

pyflakes/test/test_imports.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -569,16 +569,15 @@ def test_usedInExcept(self):
569569
''')
570570

571571
def test_redefinedByExcept(self):
572-
as_exc = ', ' if version_info < (2, 6) else ' as '
573572
expected = [m.RedefinedWhileUnused]
574573
if version_info >= (3,):
575574
# The exc variable is unused inside the exception handler.
576575
expected.append(m.UnusedVariable)
577576
self.flakes('''
578577
import fu
579578
try: pass
580-
except Exception%sfu: pass
581-
''' % as_exc, *expected)
579+
except Exception as fu: pass
580+
''', *expected)
582581

583582
def test_usedInRaise(self):
584583
self.flakes('''
@@ -1149,13 +1148,6 @@ def f():
11491148
return "hello"
11501149
''', m.UndefinedName)
11511150

1152-
1153-
class Python26Tests(TestCase):
1154-
"""
1155-
Tests for checking of syntax which is valid in Python 2.6 and newer.
1156-
"""
1157-
1158-
@skipIf(version_info < (2, 6), "Python >= 2.6 only")
11591151
def test_usedAsClassDecorator(self):
11601152
"""
11611153
Using an imported name as a class decorator results in no warnings,

pyflakes/test/test_other.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ def f():
8181
(1 for a, b in [(1, 2)])
8282
''')
8383

84-
@skipIf(version_info < (2, 7), "Python >= 2.7 only")
8584
def test_redefinedInSetComprehension(self):
8685
"""
8786
Test that reusing a variable in a set comprehension does not raise
@@ -111,7 +110,6 @@ def f():
111110
{1 for a, b in [(1, 2)]}
112111
''')
113112

114-
@skipIf(version_info < (2, 7), "Python >= 2.7 only")
115113
def test_redefinedInDictComprehension(self):
116114
"""
117115
Test that reusing a variable in a dict comprehension does not raise
@@ -279,7 +277,6 @@ def a(): pass
279277
a = classmethod(a)
280278
''')
281279

282-
@skipIf(version_info < (2, 6), "Python >= 2.6 only")
283280
def test_modernProperty(self):
284281
self.flakes("""
285282
class A:
@@ -1584,7 +1581,6 @@ def test_withStatementUndefinedInExpression(self):
15841581
pass
15851582
''', m.UndefinedName)
15861583

1587-
@skipIf(version_info < (2, 7), "Python >= 2.7 only")
15881584
def test_dictComprehension(self):
15891585
"""
15901586
Dict comprehensions are properly handled.
@@ -1593,7 +1589,6 @@ def test_dictComprehension(self):
15931589
a = {1: x for x in range(10)}
15941590
''')
15951591

1596-
@skipIf(version_info < (2, 7), "Python >= 2.7 only")
15971592
def test_setComprehensionAndLiteral(self):
15981593
"""
15991594
Set comprehensions are properly handled.
@@ -1604,17 +1599,16 @@ def test_setComprehensionAndLiteral(self):
16041599
''')
16051600

16061601
def test_exceptionUsedInExcept(self):
1607-
as_exc = ', ' if version_info < (2, 6) else ' as '
16081602
self.flakes('''
16091603
try: pass
1610-
except Exception%se: e
1611-
''' % as_exc)
1604+
except Exception as e: e
1605+
''')
16121606

16131607
self.flakes('''
16141608
def download_review():
16151609
try: pass
1616-
except Exception%se: e
1617-
''' % as_exc)
1610+
except Exception as e: e
1611+
''')
16181612

16191613
@skipIf(version_info < (3,),
16201614
"In Python 2 exception names stay bound after the exception handler")
@@ -1625,12 +1619,11 @@ def test_exceptionUnusedInExcept(self):
16251619
''', m.UnusedVariable)
16261620

16271621
def test_exceptionUnusedInExceptInFunction(self):
1628-
as_exc = ', ' if version_info < (2, 6) else ' as '
16291622
self.flakes('''
16301623
def download_review():
16311624
try: pass
1632-
except Exception%se: pass
1633-
''' % as_exc, m.UnusedVariable)
1625+
except Exception as e: pass
1626+
''', m.UnusedVariable)
16341627

16351628
def test_exceptWithoutNameInFunction(self):
16361629
"""

0 commit comments

Comments
 (0)