[Distutils] How to define a platform?

Phillip J. Eby pje at telecommunity.com
Tue Dec 21 08:06:40 CET 2004

One of the trickier things about defining our "plugin" format is the 
definition of a platform.  That is, how can we tell from metadata whether a 
given plugin is executable on the current platform?

If we use 'distutils.util.get_platform()' and do simple string comparison, 
I believe this will result in both false positives and false negatives, due 
to e.g. the absence of processor info for Windows platforms, and the 
presence of processor info or OS version info for other platforms.  For 
example, a 'linux-i386' module might work with a 'linux-i686' platform, yet 
not be accepted by a simple string comparison.

Of course, if that metadata is encoded only in the plugin filename, then 
it's relatively simple to create copies with different filenames, one per 
applicable platform string.  Or, perhaps there could be some type of 
configuration file that simply lists what platform strings (besides the one 
the machine itself generates) are acceptable on the machine.

But, false positives seem harder to fix.  For example, "win32" is used for 
both 32-bit and 64-bit Windows targets.  I'm unsure whether any of the 
other targets have similar issues.

Does anybody have any ideas?

More information about the Distutils-SIG mailing list