Skip to content

Commit decaf7c

Browse files
authored
depend on fissix, lib2to3 fork Fixes #202 (#203)
* depend on fissix, lib2to3 fork * drop EOL py2.7, and nearly EOL py3.5 * Update README.rst * restore lib2to3 derivative work notices * add lib2to3_fix_names alias for backwards compat * clarify fissix/lib2to3 derivative work in LICENSE
1 parent 84d973c commit decaf7c

35 files changed

+102
-97
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
language: python
22
python:
3-
- "2.7"
4-
- "3.5"
53
- "3.6"
64
- "3.7"
75
- "3.8"

LICENSE

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ met:
1616
promote products derived from this software without specific
1717
prior written permission.
1818

19-
Parts of this software package are built on lib2to3 which is
20-
licensed under the PSF license. For more information refer to the
21-
Python license: http://docs.python.org/license.html
19+
Parts of this software package are built on fissix which is
20+
a backport of lib2to3 both licensed under the PSF license.
21+
For more information refer to the
22+
Python license: https://docs.python.org/license.html
23+
and the fissix license https://github.com/jreese/fissix/blob/master/LICENSE
2224

2325
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2426
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
| ' \/ _ \/ _` / -_) '_| ' \| |_ / -_)
66
|_|_|_\___/\__,_\___|_| |_||_|_/__\___|
77

8-
This library is a very thin wrapper around `lib2to3
9-
<https://github.com/python/cpython/tree/master/Lib/lib2to3>`_ to utilize it
8+
This library is a very thin wrapper around `fissix
9+
<https://github.com/jreese/fissix>`_, a fork of lib2to3, to utilize it
1010
to make Python 2 code more modern with the intention of eventually
1111
porting it over to Python 3.
1212

docs/fixers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ version of ``six`` is installed.
232232
``2to3`` fixers
233233
+++++++++++++++
234234

235-
Some `fixers from lib2to3 <https://docs.python.org/3/library/2to3.html#fixers>`_
235+
Some `fixers from fissix <https://docs.python.org/3/library/2to3.html#fixers>`_
236236
in Python's standard library are run by default unmodified as their
237237
transformations are Python 2 compatible.
238238

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Purpose of the project
1414

1515
.. TODO Explain WHY someone would want to have their code be Python 2/3 compatible
1616
17-
This library is a very thin wrapper around ``lib2to3`` to utilize it
17+
This library is a very thin wrapper around ``fissix`` to utilize it
1818
to make Python 2 code more modern with the intention of eventually
1919
porting it over to Python 3.
2020

libmodernize/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from __future__ import absolute_import
22

3-
from lib2to3 import fixer_util
4-
from lib2to3.pytree import Leaf, Node
5-
from lib2to3.pygram import python_symbols as syms
6-
from lib2to3.pgen2 import token
3+
from fissix import fixer_util
4+
from fissix.pytree import Leaf, Node
5+
from fissix.pygram import python_symbols as syms
6+
from fissix.pgen2 import token
77

88
__version__ = '0.7'
99

libmodernize/fixes/__init__.py

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11

2-
lib2to3_fix_names = set([
3-
'lib2to3.fixes.fix_apply',
4-
'lib2to3.fixes.fix_except',
5-
'lib2to3.fixes.fix_exec',
6-
'lib2to3.fixes.fix_execfile',
7-
'lib2to3.fixes.fix_exitfunc',
8-
'lib2to3.fixes.fix_funcattrs',
9-
'lib2to3.fixes.fix_has_key',
10-
'lib2to3.fixes.fix_idioms',
11-
'lib2to3.fixes.fix_long',
12-
'lib2to3.fixes.fix_methodattrs',
13-
'lib2to3.fixes.fix_ne',
14-
'lib2to3.fixes.fix_numliterals',
15-
'lib2to3.fixes.fix_operator',
16-
'lib2to3.fixes.fix_paren',
17-
'lib2to3.fixes.fix_reduce',
18-
'lib2to3.fixes.fix_renames',
19-
'lib2to3.fixes.fix_repr',
20-
'lib2to3.fixes.fix_set_literal',
21-
'lib2to3.fixes.fix_standarderror',
22-
'lib2to3.fixes.fix_sys_exc',
23-
'lib2to3.fixes.fix_throw',
24-
'lib2to3.fixes.fix_tuple_params',
25-
'lib2to3.fixes.fix_types',
26-
'lib2to3.fixes.fix_ws_comma',
27-
'lib2to3.fixes.fix_xreadlines'
2+
fissix_fix_names = set([
3+
'fissix.fixes.fix_apply',
4+
'fissix.fixes.fix_except',
5+
'fissix.fixes.fix_exec',
6+
'fissix.fixes.fix_execfile',
7+
'fissix.fixes.fix_exitfunc',
8+
'fissix.fixes.fix_funcattrs',
9+
'fissix.fixes.fix_has_key',
10+
'fissix.fixes.fix_idioms',
11+
'fissix.fixes.fix_long',
12+
'fissix.fixes.fix_methodattrs',
13+
'fissix.fixes.fix_ne',
14+
'fissix.fixes.fix_numliterals',
15+
'fissix.fixes.fix_operator',
16+
'fissix.fixes.fix_paren',
17+
'fissix.fixes.fix_reduce',
18+
'fissix.fixes.fix_renames',
19+
'fissix.fixes.fix_repr',
20+
'fissix.fixes.fix_set_literal',
21+
'fissix.fixes.fix_standarderror',
22+
'fissix.fixes.fix_sys_exc',
23+
'fissix.fixes.fix_throw',
24+
'fissix.fixes.fix_tuple_params',
25+
'fissix.fixes.fix_types',
26+
'fissix.fixes.fix_ws_comma',
27+
'fissix.fixes.fix_xreadlines'
2828
])
2929

30+
lib2to3_fix_names = fissix_fix_names
31+
3032
# fixes that involve using six
3133
six_fix_names = set([
3234
'libmodernize.fixes.fix_basestring',

libmodernize/fixes/fix_basestring.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import absolute_import
22

3-
from lib2to3 import fixer_base
4-
from lib2to3 import fixer_util
3+
from fissix import fixer_base
4+
from fissix import fixer_util
55
import libmodernize
66

77

libmodernize/fixes/fix_classic_division.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from __future__ import absolute_import
22

3-
from lib2to3 import fixer_base
4-
from lib2to3 import pytree
5-
from lib2to3.pgen2 import token
3+
from fissix import fixer_base
4+
from fissix import pytree
5+
from fissix.pgen2 import token
66

77
import libmodernize
88

libmodernize/fixes/fix_dict_six.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from __future__ import absolute_import
33

44
# Local imports
5-
from lib2to3 import fixer_util
6-
from lib2to3 import pytree
7-
from lib2to3.fixes import fix_dict
5+
from fissix import fixer_util
6+
from fissix import pytree
7+
from fissix.fixes import fix_dict
88
import libmodernize
99

1010

@@ -15,7 +15,7 @@ def transform_iter(self, node, results):
1515
# Make sure six is imported.
1616
libmodernize.touch_import(None, u'six', node)
1717

18-
# Copy of self.transform() from lib2to3.fix_dict with some changes to
18+
# Copy of self.transform() from fissix.fix_dict with some changes to
1919
# use the six.* methods.
2020

2121
head = results['head']

0 commit comments

Comments
 (0)