Issue114

Title Add option to suppress 2to3 fixes
Priority feature Status chatting
Superseder Nosy List loewis, spookylukey, stefanor
Assigned To Keywords

Created on 2010-09-05.14:44:38 by stefanor, last changed 2010-12-10.02:46:12 by spookylukey.

Files
File name Uploaded Type Edit Remove
skip-fixers.patch stefanor, 2010-09-05.14:44:37 text/x-patch
Messages
msg568 (view) Author: spookylukey Date: 2010-12-10.02:46:12
I don't understand why this has been marked resolved.  
I have finally worked out how to do what has been suggested, 
but it is pretty painful and obscure, and involves monkey 
patching.  Something like:

    import distutils.util
    import setuptools
    from lib2to3.refactor import get_fixers_from_package
    fixer_names = []
    for p in setuptools.lib2to3_fixer_packages:
        fixer_names.extend(get_fixers_from_package(p))

    # Modify
    fixer_names.remove('lib2to3.fixes.fix_next')

    # Monkey patch:
    distutils.util.Mixin2to3.fixer_names = fixer_names

Is that really what is being suggested as the way to do this?
msg545 (view) Author: stefanor Date: 2010-09-05.22:03:31
Oh, I didn't see that Mixin in p3k distutils. I assumed it was coming from distribute.

Yes it's perfectly possible to customise the list that way, if a bit painful and ugly.
msg544 (view) Author: loewis Date: 2010-09-05.21:18:24
Depending on what deployment library you use specifically, you can set distutils.util.Mixin2to3.fixer_names. It defaults to

get_fixers_from_package('lib2to3.fixes')

If you want to customize it, add and remove to this list as you please. Anything based on Mixin2to3 (and not otherwise overriding fixer_names) will then use your list of fixers.
msg543 (view) Author: stefanor Date: 2010-09-05.19:01:13
> I usually put the fixers to skip right into setup.py.

Yes, that's what I'd like to be able to do. Am I missing an obvious existing way to do it?
msg542 (view) Author: loewis Date: 2010-09-05.16:53:16
Not sure why you need that on the command line. I usually put the fixers to skip right into setup.py.
msg541 (view) Author: stefanor Date: 2010-09-05.14:44:37
It would be handy if specific 2to3 fixers could be disabled during 2to3. Here's a patch to do it. The equivalent patch for distutils2 would be much bigger, so I'm proposing it here for discussion, first.
History
Date User Action Args
2010-12-10 02:46:12spookylukeysetstatus: resolved -> chatting
nosy: + spookylukey
messages: + msg568
2010-10-02 22:49:45pjesetstatus: chatting -> resolved
2010-09-05 22:03:31stefanorsetmessages: + msg545
2010-09-05 21:18:25loewissetmessages: + msg544
2010-09-05 19:01:13stefanorsetmessages: + msg543
2010-09-05 16:53:16loewissetstatus: unread -> chatting
nosy: + loewis
messages: + msg542
2010-09-05 14:44:38stefanorcreate