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.

classification
Title: Remove distutils checks for Python version
Type: enhancement Stage: resolved
Components: Distutils Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Aaron.Meurer, Arfrever, benjamin.peterson, dstufft, eric.araujo, python-dev, takluyver
Priority: normal Keywords: patch

Created on 2014-08-14 21:37 by takluyver, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
rm-distutils-version-check.patch takluyver, 2014-08-14 21:37 review
Messages (5)
msg225320 - (view) Author: Thomas Kluyver (takluyver) * Date: 2014-08-14 21:37
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.
msg225481 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-18 04:01
New changeset fbb51251eb9d by Benjamin Peterson in branch '3.4':
remove 2.2 and 2.6 compat code (closes #22200)
http://hg.python.org/cpython/rev/fbb51251eb9d

New changeset 66c7f30fe8c7 by Benjamin Peterson in branch 'default':
merge 3.4 (closes #22200)
http://hg.python.org/cpython/rev/66c7f30fe8c7
msg225786 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2014-08-24 01:50
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":
msg225912 - (view) Author: Thomas Kluyver (takluyver) * Date: 2014-08-26 08:27
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.
msg226511 - (view) Author: Thomas Kluyver (takluyver) * Date: 2014-09-06 20:01
I've made a patch removing some more of these version checks in issue 22349.
History
Date User Action Args
2022-04-11 14:58:07adminsetgithub: 66396
2014-09-07 10:30:23berker.peksagsetstatus: open -> closed
resolution: fixed
stage: resolved
2014-09-06 20:01:03takluyversetmessages: + msg226511
2014-08-26 08:27:00takluyversetmessages: + msg225912
2014-08-24 01:52:54Arfreversetnosy: + benjamin.peterson
2014-08-24 01:50:28Arfreversetstatus: closed -> open

versions: + Python 3.4
nosy: + Arfrever

messages: + msg225786
resolution: fixed -> (no value)
stage: resolved -> (no value)
2014-08-18 04:01:46python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg225481

resolution: fixed
stage: patch review -> resolved
2014-08-15 11:30:01berker.peksagsetstage: patch review
type: enhancement
versions: + Python 3.5
2014-08-15 00:04:19Aaron.Meurersetnosy: + Aaron.Meurer
2014-08-14 21:37:01takluyvercreate