[Distutils] Extracting distutils into setuptools

Nick Coghlan ncoghlan at gmail.com
Mon Oct 2 02:18:51 EDT 2017


On 2 October 2017 at 04:55, Donald Stufft <donald at stufft.io> wrote:
> This isn’t as easy as ensurepip, because ensurepip can wait until the end of
> the build process when the entire Python installation has been built. The
> same isn’t true for a hypothetical ensuresetuptools module. This is because
> we end up in a circular dependency, if installing a wheel requires a C
> extension (like say zlib) then we can’t install that wheel prior to building
> zlib, but if we need to install that wheel to build zlib then we end up
> stuck.
>
> I’m not sure what all c-extensions are used in the process of installing a
> wheel— certainly zlib is but we could maybe build a special wheel that only
> uses the STORED algorithm and doesn’t do compression (does the zipfile
> module work with zlib doesn’t exist?). I’m going to guess there are others
> though and no idea if they are able to be avoided.
>
> I still think a better idea if we want to go down that route is to modify
> the CPython build process to not depend on distutils at all.

The main reason for using distutils is to reduce the need to define
different build instructions for different platforms for things like
curses, sqlite, cdecimal, dbm, Tcl/Tk, etc. (And even when we do need
to define separate instructions for Windows, we still get to avoid
running those builds through autotools)

That said, we do have other extension modules that *are* handled by
the platform specific build instructions, and it should be relatively
straightforward to migrate anything that `ensuresetuptools` needed
down to that layer (and it's likely only `zlib` that falls into that
category).

Cheers,
Nick.

P.S. I'm honestly not sure how well CPython in general works without
zlib: while it's nominally optional in the build process, and we have
a "test.support.requires_zlib" decorator, I don't think we run any
buildbots without it, and we statically link it on Windows and Mac OS
X.

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


More information about the Distutils-SIG mailing list