MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / uname

Function uname

tools/python-3.11.9-amd64/Lib/platform.py:825–910  ·  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

()

Source from the content-addressed store, hash-verified

823
824
825def uname():
826
827 """ Fairly portable uname interface. Returns a tuple
828 of strings (system, node, release, version, machine, processor)
829 identifying the underlying platform.
830
831 Note that unlike the os.uname function this also returns
832 possible processor information as an additional tuple entry.
833
834 Entries which cannot be determined are set to ''.
835
836 """
837 global _uname_cache
838
839 if _uname_cache is not None:
840 return _uname_cache
841
842 # Get some infos from the builtin os.uname API...
843 try:
844 system, node, release, version, machine = infos = os.uname()
845 except AttributeError:
846 system = sys.platform
847 node = _node()
848 release = version = machine = ''
849 infos = ()
850
851 if not any(infos):
852 # uname is not available
853
854 # Try win32_ver() on win32 platforms
855 if system == 'win32':
856 release, version, csd, ptype = win32_ver()
857 machine = machine or _get_machine_win32()
858
859 # Try the 'ver' system command available on some
860 # platforms
861 if not (release and version):
862 system, release, version = _syscmd_ver(system)
863 # Normalize system to what win32_ver() normally returns
864 # (_syscmd_ver() tends to return the vendor name as well)
865 if system == 'Microsoft Windows':
866 system = 'Windows'
867 elif system == 'Microsoft' and release == 'Windows':
868 # Under Windows Vista and Windows Server 2008,
869 # Microsoft changed the output of the ver command. The
870 # release is no longer printed. This causes the
871 # system and release to be misidentified.
872 system = 'Windows'
873 if '6.0' == version[:3]:
874 release = 'Vista'
875 else:
876 release = ''
877
878 # In case we still don't know anything useful, we'll try to
879 # help ourselves
880 if system in ('win32', 'win16'):
881 if not version:
882 if system == 'win32':

Callers 7

systemFunction · 0.70
nodeFunction · 0.70
releaseFunction · 0.70
versionFunction · 0.70
machineFunction · 0.70
processorFunction · 0.70
platformFunction · 0.70

Calls 9

_nodeFunction · 0.85
win32_verFunction · 0.85
_get_machine_win32Function · 0.85
_syscmd_verFunction · 0.85
java_verFunction · 0.85
uname_resultClass · 0.85
anyFunction · 0.70
mapFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected