[Distutils] Extracting distutils into setuptools

Nick Coghlan ncoghlan at gmail.com
Wed Sep 27 12:27:37 EDT 2017


On 27 September 2017 at 23:35, Donald Stufft <donald at stufft.io> wrote:
> I suspect this might be difficult, but I haven’t actually tried it. Our
> trick (and really setup tools itself relies on this too) is that setuptools
> monkey patches distutils at runtime to make distutils into setuptools. It
> only has to patch a few bits and pieces right now, but I suspect that if
> this happened it’d have to monkey patch the entire namespace. It would
> probably also break people who mix and match imports from setuptools and
> distutils.

Right, my assumption was that pip would need to ensure that setuptools
took over the distutils namespace before any of the code in setup.py
ran, so that any monkeypatches and state modifications in other code
would all take place in the setuptools provided copy, and the standard
library's copy would never even get loaded.

However, I don't think that's a new requirement: I believe you already
need to do that, since the first line might be "from distutils import
setup".

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Distutils-SIG mailing list