[Pythonmac-SIG] Python Eggs and Mac OS version compatibility

Kevin Dangoor dangoor at gmail.com
Wed Jul 20 16:33:29 CEST 2005


On 7/20/05, Michael Maibaum <mike at maibaum.org> wrote:
> On 20 Jul 2005, at 13:36, Kevin Dangoor wrote:
> > That is more comforting than going with the Darwin version. I'll wrap
> > that up for Phillip and send him a patch.
> 
> 
> Note that the 3 or 4 people in the world running (pure) Darwin
> systems will not have sw_vers as it is not part of Darwin.

Believe it or not, I actually thought of that as well. Don't worry, I
have those handful of people covered as well...

    if sys.platform == "darwin":
        try:
            version = macosx_vers()
            machine = os.uname()[4].replace(" ", "_")
            return "macosx-%d.%d.%d-%s" % (int(version[0]), int(version[1]),
                int(version[2]), machine)
        except ValueError:
            # if someone is running a non-Mac darwin system, this will fall
            # through to the default implementation
            pass
            
    from distutils.util import get_platform
    return get_platform()

On my machine, this returns:
macosx-10.4.2-Power_Macintosh

I thought it made sense to leave the Power_Macintosh in there because
of the upcoming Intel switch. I don't want to think about "Universal
Binary" eggs right now :)

Kevin


More information about the Pythonmac-SIG mailing list