[Distutils] Oddities in setuptools/distribute

P.J. Eby pje at telecommunity.com
Wed Oct 6 04:06:03 CEST 2010


At 09:32 PM 10/5/2010 -0400, Barry Warsaw wrote:
>It probably would be better to only blow away the original egg when a
>--reinstall option were given.  This might change current semantics too much,
>so a --keep option would probably be in order.

My worry here is that this breaks the invariant that .egg files and 
.egg directories are identical/interchangeable.  I'm not sure whether 
there's anything in the ecosystem that depends on that (besides 
perhaps the --always-copy flag to easy_install, which I'd have to 
check to see if it depends on that).


>For zip'd eggs, you might be right.  For egg directories, it's not necessary.
>Everything is sharable, and when not (i.e. the .so's) they are build-flag
>discriminated.  I'd like to share as much as possible, but I'm open to any
>suggestions.

Given that platform string discrimination has been battle-hardened by 
many years of deployment, my personal inclination is to suggest that approach.

The relevant functions are:

* pkg_resources.get_build_platform() -- returns the "minimum" 
platform string that should be used for eggs built by this interpreter

* pkg_resources.get_supported_platform() -- returns the platform 
string that represents the "maximum" platform supported by this interpreter

* pkg_resources.compatible_platforms(provided, required) -- Can code 
for the `provided` platform run on the `required` platform?

In practical terms, though, you could probably just change 
distutils.util.get_platform() (or whatever it's called in Py3) to add 
the debug and width flags to the platform string.  The 
get_*_platform() functions are based on that, and the default 
compatibility check is just string equality. 



More information about the Distutils-SIG mailing list