MCPcopy Index your code
hub / github.com/python/cpython / system_alias

Function system_alias

Lib/platform.py:581–619  ·  view source on GitHub ↗

Returns (system, release, version) aliased to common marketing names used for some systems. It also does some reordering of the information in some cases where it would otherwise cause confusion.

(system, release, version)

Source from the content-addressed store, hash-verified

579### System name aliasing
580
581def system_alias(system, release, version):
582
583 """ Returns (system, release, version) aliased to common
584 marketing names used for some systems.
585
586 It also does some reordering of the information in some cases
587 where it would otherwise cause confusion.
588
589 """
590 if system == 'SunOS':
591 # Sun's OS
592 if release < '5':
593 # These releases use the old name SunOS
594 return system, release, version
595 # Modify release (marketing release = SunOS release - 3)
596 l = release.split('.')
597 if l:
598 try:
599 major = int(l[0])
600 except ValueError:
601 pass
602 else:
603 major = major - 3
604 l[0] = str(major)
605 release = '.'.join(l)
606 if release < '6':
607 system = 'Solaris'
608 else:
609 # XXX Whatever the new SunOS marketing name is...
610 system = 'Solaris'
611
612 elif system in ('win32', 'win16'):
613 # In case one of the other tricks
614 system = 'Windows'
615
616 # bpo-35516: Don't replace Darwin with macOS since input release and
617 # version arguments can be different than the currently running version.
618
619 return system, release, version
620
621### Various internal helpers
622

Callers 1

platformFunction · 0.85

Calls 3

strFunction · 0.85
splitMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…