[Python-ideas] bdist naming scheme (compatibility tags) PEP

M.-A. Lemburg mal at egenix.com
Mon Sep 17 14:39:13 CEST 2012

Daniel Holth wrote:
>>> Platform Tag
>>> ------------
>>> The platform tag is simply `distutils.util.get_platform()` with all
>>> hyphens `-` and periods `.` replaced with underscore `_`.
>> This part is going to cause problems. distutils is good at identifying
>> Linux and Windows and giving them sensible platform names, but it
>> doesn't do a good job for other OSes.
> http://www.python.org/dev/peps/pep-0425/

I still don't think that referencing the distutils function
in the PEP is a good idea :-) It would be better to create
a new helper.

> I've updated this part of the PEP with some examples of
> get_platform(),

The string for x86 Linux platforms usually reads "linux-i686".

Some other get_platform() examples:

macosx-10.4-fat - Tiger, fat PPC/i386 build of Python
macosx-10.6-x86_64 - Snow Leopard, x64-only build of Python
freebsd-8.3-RELEASE-p3-i386 - FreeBSD 8.3, SP3, x86
freebsd-8.3-RELEASE-p3-amd64 - FreeBSD 8.3, SP3, x64
cygwin-1.7.9-i686 - Cygwin, x86

For Macs and other platforms that support fat builds it would
be good to have some form which allows defining which architectures
are included in the fat build, e.g. i386, ppc, x86_64.

For FreeBSD, the string could be reduced to remove he "RELEASE-p3-"

It would probably be a good idea to develop a binary compatibility
checker package on PyPI first before hard coding these things
into the PEP.

Such a package should offer two functions (sketching here):

get_binary_platform_string() -> return a binary platform compatibility
                                string for the current platform

binary_package_compatible(platform_string) -> return True/False depending
                                on whether the current platform is compatible
                                with the given platform_string

The package could then contain all the domain information needed
for the various platforms.

> and have simplified the "list of supported tags"
> section by removing the "all older versions of Python with the same
> major version" logic from the PEP. It is still allowed, but it is not
> needed in the PEP.

One note regarding adding more than one such tag to a file:
adding those extra tags using dots (".") will make parsing the
file name harder. It's probably better to separate them using
a separator such as "_or_".

> I would love to expound on the correct implementation of
> get_platform() for all major platforms. I do not know anything about
> the other platforms. A BSD and OSX expert will necessarily have to
> write that part of the specification.

See above :-)

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Sep 17 2012)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
2012-10-29: PyCon DE 2012, Leipzig, Germany ...            42 days to go
2012-10-23: Python Meeting Duesseldorf ...                 36 days to go
2012-08-28: Released mxODBC 3.2.0 ...             http://egenix.com/go31
2012-08-20: Released mxODBC.Connect 2.0.0 ...     http://egenix.com/go30

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the Python-ideas mailing list