We noticed the other day that distutils, despite being part of the standard library, checks the version of Python it's running under and has some different code paths - one of which is only taken for Python < 2.2. We haven't managed to figure out why this is necessary. So this issue is partly a patch and partly a question: is there a reason that distutils can't assume it's run on the version of Python it came with? If so, I'm happy to make a new patch adding a comment to explain that. If not, I'll go looking for other places where it has unnecessary checks, and we can clean up one little corner of wtf.
There are other checks: Lib/distutils/command/build_ext.py: # this keeps compatibility from 2.3 to 2.5 if sys.version < "2.6": USER_BASE = None HAS_USER_SITE = False else: from site import USER_BASE HAS_USER_SITE = True Lib/distutils/msvccompiler.py and Lib/distutils/msvc9compiler.py: def get_build_version(): """Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6. """ ... if i == -1: return 6 Lib/distutils/tests/test_build_ext.py: class BuildExtTestCase(TempdirManager, LoggingSilencer, unittest.TestCase): def setUp(self): ... if sys.version > "2.6": ... def tearDown(self): ... if sys.version > "2.6":
I spotted a few others as well. When I get a bit less busy in a couple of weeks time, I intend to go through and make a bigger patch to clean things up.