diff -r 262204877004 Doc/library/platform.rst --- a/Doc/library/platform.rst Mon Apr 14 11:20:45 2014 -0400 +++ b/Doc/library/platform.rst Tue Apr 15 15:33:13 2014 -0400 @@ -137,11 +137,16 @@ returned if the value cannot be determined. -.. function:: system() +.. function:: system(aliased=0) Returns the system/OS name, e.g. ``'Linux'``, ``'Windows'``, or ``'Java'``. An empty string is returned if the value cannot be determined. + If *aliased* is true, the function will use aliases for various platforms that + report system names which differ from their common names, for example SunOS will + be reported as Solaris. The :func:`system_alias` function is used to implement + this. + .. function:: system_alias(system, release, version) diff -r 262204877004 Lib/platform.py --- a/Lib/platform.py Mon Apr 14 11:20:45 2014 -0400 +++ b/Lib/platform.py Tue Apr 15 15:33:13 2014 -0400 @@ -1118,14 +1118,25 @@ ### Direct interfaces to some of the uname() return values -def system(): +def system(aliased=0): """ Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'. + if "aliased" is true, the function will use aliases for + various platforms that report system names which differ from + their common names, e.g. SunOS will be reported as + Solaris. The system_alias() function is used to implement + this. + An empty string is returned if the value cannot be determined. """ - return uname().system + if aliased: + system, node, release, version, machine, processor = uname() + system, release, version = system_alias(system, release, version) + return system + else: + return uname().system def node(): diff -r 262204877004 Lib/test/test_platform.py --- a/Lib/test/test_platform.py Mon Apr 14 11:20:45 2014 -0400 +++ b/Lib/test/test_platform.py Tue Apr 15 15:33:13 2014 -0400 @@ -40,7 +40,8 @@ res = platform.platform(aliased, terse) def test_system(self): - res = platform.system() + for aliased in (False, True): + res = platform.system(aliased) def test_node(self): res = platform.node()