MCPcopy Index your code
hub / github.com/RustPython/RustPython / system_alias

Function system_alias

Lib/platform.py:614–652  ·  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

612### System name aliasing
613
614def system_alias(system, release, version):
615
616 """ Returns (system, release, version) aliased to common
617 marketing names used for some systems.
618
619 It also does some reordering of the information in some cases
620 where it would otherwise cause confusion.
621
622 """
623 if system == 'SunOS':
624 # Sun's OS
625 if release < '5':
626 # These releases use the old name SunOS
627 return system, release, version
628 # Modify release (marketing release = SunOS release - 3)
629 l = release.split('.')
630 if l:
631 try:
632 major = int(l[0])
633 except ValueError:
634 pass
635 else:
636 major = major - 3
637 l[0] = str(major)
638 release = '.'.join(l)
639 if release < '6':
640 system = 'Solaris'
641 else:
642 # XXX Whatever the new SunOS marketing name is...
643 system = 'Solaris'
644
645 elif system in ('win32', 'win16'):
646 # In case one of the other tricks
647 system = 'Windows'
648
649 # bpo-35516: Don't replace Darwin with macOS since input release and
650 # version arguments can be different than the currently running version.
651
652 return system, release, version
653
654### Various internal helpers
655

Callers 1

platformFunction · 0.85

Calls 3

strFunction · 0.85
splitMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected