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

Function uname

Lib/platform.py:923–1010  ·  view source on GitHub ↗

Fairly portable uname interface. Returns a tuple of strings (system, node, release, version, machine, processor) identifying the underlying platform. Note that unlike the os.uname function this also returns possible processor information as an additional tuple entry

()

Source from the content-addressed store, hash-verified

921
922
923def uname():
924
925 """ Fairly portable uname interface. Returns a tuple
926 of strings (system, node, release, version, machine, processor)
927 identifying the underlying platform.
928
929 Note that unlike the os.uname function this also returns
930 possible processor information as an additional tuple entry.
931
932 Entries which cannot be determined are set to ''.
933
934 """
935 global _uname_cache
936
937 if _uname_cache is not None:
938 return _uname_cache
939
940 # Get some infos from the builtin os.uname API...
941 try:
942 system, node, release, version, machine = infos = os.uname()
943 except AttributeError:
944 system = sys.platform
945 node = _node()
946 release = version = machine = ''
947 infos = ()
948
949 if not any(infos):
950 # uname is not available
951
952 # Try win32_ver() on win32 platforms
953 if system == 'win32':
954 release, version, csd, ptype = win32_ver()
955 machine = machine or _get_machine_win32()
956
957 # Try the 'ver' system command available on some
958 # platforms
959 if not (release and version):
960 system, release, version = _syscmd_ver(system)
961 # Normalize system to what win32_ver() normally returns
962 # (_syscmd_ver() tends to return the vendor name as well)
963 if system == 'Microsoft Windows':
964 system = 'Windows'
965 elif system == 'Microsoft' and release == 'Windows':
966 # Under Windows Vista and Windows Server 2008,
967 # Microsoft changed the output of the ver command. The
968 # release is no longer printed. This causes the
969 # system and release to be misidentified.
970 system = 'Windows'
971 if '6.0' == version[:3]:
972 release = 'Vista'
973 else:
974 release = ''
975
976 # In case we still don't know anything useful, we'll try to
977 # help ourselves
978 if system in ('win32', 'win16'):
979 if not version:
980 if system == 'win32':

Callers 8

test__locale.pyFile · 0.90
systemFunction · 0.85
nodeFunction · 0.85
releaseFunction · 0.85
versionFunction · 0.85
machineFunction · 0.85
processorFunction · 0.85
platformFunction · 0.85

Calls 8

_nodeFunction · 0.85
win32_verFunction · 0.85
_get_machine_win32Function · 0.85
_syscmd_verFunction · 0.85
android_verFunction · 0.85
ios_verFunction · 0.85
uname_resultClass · 0.85
anyFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…