Discussion:
Mac OS X sys.platform value
Jack Jansen
2001-12-05 15:59:39 UTC
Permalink
Folks,
Apple "wisely" changed their uname version numbering scheme with a
micro-release (10.1.1). Of course, nobody cares about this, except Python,
which stuffs the version into sys.platform, from where it is used by a
gazillion things.

Anyway, where sys.platform used to be "darwin1" upto and including 10.1.0 it
is now "darwin5" for 10.1.1 (and it will go up to "darwin6" for 10.2, etc).

I am of a mind to take the "1" out of sys.platform, so that it becomes
"darwin".

Good idea or not?
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
***@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.cwi.nl/~jack | ++++ see http://www.xs4all.nl/~tank/ ++++
Guido van Rossum
2001-12-05 16:07:19 UTC
Permalink
Post by Jack Jansen
Anyway, where sys.platform used to be "darwin1" upto and including 10.1.0 it
is now "darwin5" for 10.1.1 (and it will go up to "darwin6" for 10.2, etc).
I am of a mind to take the "1" out of sys.platform, so that it becomes
"darwin".
Good idea or not?
Fine with me as long as it doesn't affect other platforms. :-)

--Guido van Rossum (home page: http://www.python.org/~guido/)
Martin v. Loewis
2001-12-05 20:00:18 UTC
Permalink
Post by Jack Jansen
Anyway, where sys.platform used to be "darwin1" upto and including 10.1.0 it
is now "darwin5" for 10.1.1 (and it will go up to "darwin6" for 10.2, etc).
I am of a mind to take the "1" out of sys.platform, so that it becomes
"darwin".
Good idea or not?
Bad idea. Anybody comparing to "darwin1" will have to update the
code. When they do so, they could just as well write
sys.platform.startswith("darwin").

The same happens on Linux, which happens to be "linux2" since Linux
kernel version 2.x is in use. That says little about the system,
though, since glibc version or name of the distribution may be
relevant.

On OS X, it seems sys.platform could be used to distinguish minor
differences. We should not take away that opportunity.

Regards,
Martin
M.-A. Lemburg
2001-12-06 09:08:59 UTC
Permalink
Post by Martin v. Loewis
Post by Jack Jansen
Anyway, where sys.platform used to be "darwin1" upto and including 10.1.0 it
is now "darwin5" for 10.1.1 (and it will go up to "darwin6" for 10.2, etc).
I am of a mind to take the "1" out of sys.platform, so that it becomes
"darwin".
Good idea or not?
Bad idea. Anybody comparing to "darwin1" will have to update the
code. When they do so, they could just as well write
sys.platform.startswith("darwin").
The same happens on Linux, which happens to be "linux2" since Linux
kernel version 2.x is in use. That says little about the system,
though, since glibc version or name of the distribution may be
relevant.
Exactly and that's why I think that version numbers in sys.platform
are plain wrong.

There are better tools for finding out details
about the system, e.g. platform.py which you can download from my
Python pages.
Post by Martin v. Loewis
On OS X, it seems sys.platform could be used to distinguish minor
differences. We should not take away that opportunity.
As you already noted, the information given in the current
version number is too inaccurate to be of any real value.

Why not add platform.py to the std lib in Python 2.3 and remove
all version info from sys.platform ?!
--
Marc-Andre Lemburg
CEO eGenix.com Software GmbH
______________________________________________________________________
Consulting & Company: http://www.egenix.com/
Python Software: http://www.lemburg.com/python/
Greg Ward
2001-12-07 02:27:57 UTC
Permalink
Post by Jack Jansen
Anyway, where sys.platform used to be "darwin1" upto and including 10.1.0 it
is now "darwin5" for 10.1.1 (and it will go up to "darwin6" for 10.2, etc).
I am of a mind to take the "1" out of sys.platform, so that it becomes
"darwin".
+1 from me. If we could turn the clock back 5 or 6 years, I would also
do the same on Linux.

Note that I share Marc-Andr�'s dim view of tacking the first digit of
the kernel version number (or whatever) onto sys.platform -- the
Distutils has Yet Another way of creating platform descriptions. It's
more complex than sys.platform, but quite a lot less fancy than
Marc-Andr�'s platform.py.

See distutils.util.get_platform(), if you're curious.

Greg
--
Greg Ward - Linux weenie ***@python.net
http://starship.python.net/~gward/
Never put off till tomorrow what you can put off till the day after tomorrow.
Loading...