This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jaraco
Recipients jaraco
Date 2010-04-09.17:42:09
SpamBayes Score 9.0687635e-10
Marked as misclassified No
Message-id <1270834931.54.0.150904331286.issue8358@psf.upfronthosting.co.za>
In-reply-to
Content
I found a workaround by excluding the "import" fixer that seems to work.

For the example,

> 2to3 -x import abs_imp_test

The command still modifies main, but it only removes the __future__ directive and doesn't modify the imports.

For my real-world package, which is using distutils, I added the following to get a build_py that will run 2to3:

try:
	from distutils.command.build_py import build_py_2to3 as build_py
	# exclude some fixers that break already compatible code
	from lib2to3.refactor import get_fixers_from_package
	fixers = get_fixers_from_package('lib2to3.fixes')
	for skip_fixer in ['import']:
		fixers.remove('lib2to3.fixes.fix_' + skip_fixer)
	build_py.fixer_names = fixers
except ImportError:
	from distutils.command.build_py import build_py

This works because the entire package is already using absolute imports wherever they are relevant, so removing the import fixer is appropriate.
History
Date User Action Args
2010-04-09 17:42:11jaracosetrecipients: + jaraco
2010-04-09 17:42:11jaracosetmessageid: <1270834931.54.0.150904331286.issue8358@psf.upfronthosting.co.za>
2010-04-09 17:42:10jaracolinkissue8358 messages
2010-04-09 17:42:09jaracocreate