[Distutils] wheels on sys.path clarification (reboot)

Vinay Sajip vinay_sajip at yahoo.co.uk
Thu Jan 30 17:27:01 CET 2014

On Thu, 30/1/14, Eric V. Smith <eric at trueblade.com> wrote:

> The flag really needs to convey 2 meanings:
>   - - There are some C extensions here that can't be loaded
>        unless they live on a real filesystem path.
>  - - There is some code (maybe in this package, maybe in
>       another package that uses this one) that uses this
>       package's __file__, and that code  won't work unless
>       __file__ points to a real filesystem path.

Software can run from zip even if some things need filesystem
access, so it's not as clear-cut as __file__ having to be a filesystem
path. It's probably safe to assume that any C extension will need to
be on a filesystem path, at least on the mainstream platforms,
since that's how their run-time loaders work.

For example, both pip and distil use cacert.pem to verify SSL
hostnames, and the SSL module's API requires provision of a 
filesystem path for the .pem file. The solution is of course to use
__file__ directly when running from the file system, and extracting
cacert.pem to a cache location, and using that when running from

My view is that there are probably two different assertions: one is
"will run from wheel" (I say wheel rather than zip, since wheel
implies a place to put that metadata) and the other is "The C
extensions are mandatory". If this flag is set, the wheel is asserted
to be not worth mounting without the extensions. If clear, it means
that C extensions, if present, are optional (for example, an
accelerator). If there are extensions, there would need to be
separate metadata giving the details so that extraction could
happen (since we should refuse the temptation to guess by
merely looking at file extensions of entries in the archive).


Vinay Sajip

More information about the Distutils-SIG mailing list