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

Function platform

tools/python-3.11.9-amd64/Lib/platform.py:1187–1259  ·  view source on GitHub ↗

Returns a single string identifying the underlying platform with as much useful information as possible (but no more :). The output is intended to be human readable rather than machine parseable. It may look different on different platforms and this is intended

(aliased=0, terse=0)

Source from the content-addressed store, hash-verified

1185_platform_cache = {}
1186
1187def platform(aliased=0, terse=0):
1188
1189 """ Returns a single string identifying the underlying platform
1190 with as much useful information as possible (but no more :).
1191
1192 The output is intended to be human readable rather than
1193 machine parseable. It may look different on different
1194 platforms and this is intended.
1195
1196 If "aliased" is true, the function will use aliases for
1197 various platforms that report system names which differ from
1198 their common names, e.g. SunOS will be reported as
1199 Solaris. The system_alias() function is used to implement
1200 this.
1201
1202 Setting terse to true causes the function to return only the
1203 absolute minimum information needed to identify the platform.
1204
1205 """
1206 result = _platform_cache.get((aliased, terse), None)
1207 if result is not None:
1208 return result
1209
1210 # Get uname information and then apply platform specific cosmetics
1211 # to it...
1212 system, node, release, version, machine, processor = uname()
1213 if machine == processor:
1214 processor = ''
1215 if aliased:
1216 system, release, version = system_alias(system, release, version)
1217
1218 if system == 'Darwin':
1219 # macOS (darwin kernel)
1220 macos_release = mac_ver()[0]
1221 if macos_release:
1222 system = 'macOS'
1223 release = macos_release
1224
1225 if system == 'Windows':
1226 # MS platforms
1227 rel, vers, csd, ptype = win32_ver(version)
1228 if terse:
1229 platform = _platform(system, release)
1230 else:
1231 platform = _platform(system, release, version, csd)
1232
1233 elif system in ('Linux',):
1234 # check for libc vs. glibc
1235 libcname, libcversion = libc_ver()
1236 platform = _platform(system, release, machine, processor,
1237 'with',
1238 libcname+libcversion)
1239 elif system == 'Java':
1240 # Java platforms
1241 r, v, vminfo, (os_name, os_version, os_arch) = java_ver()
1242 if terse or not os_name:
1243 platform = _platform(system, release, version)
1244 else:

Callers 1

platform.pyFile · 0.85

Calls 9

system_aliasFunction · 0.85
mac_verFunction · 0.85
win32_verFunction · 0.85
_platformFunction · 0.85
java_verFunction · 0.85
architectureFunction · 0.85
unameFunction · 0.70
libc_verFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected