Skip to content

Commit 0c9c7d3

Browse files
committed
Improve system.versionstr + doc + reset CI to windows-latest
1 parent 25534c8 commit 0c9c7d3

2 files changed

Lines changed: 39 additions & 8 deletions

File tree

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on: [push, workflow_dispatch]
66

77
jobs:
88
generate_ctypes:
9-
runs-on: windows-2025
9+
runs-on: windows-latest
1010
timeout-minutes: 5
1111

1212
steps:
@@ -21,7 +21,7 @@ jobs:
2121
tests:
2222
# Not a real dependency : but starting tests when ctypes generation is broken is not useful
2323
needs: generate_ctypes
24-
runs-on: windows-2025
24+
runs-on: windows-latest
2525
timeout-minutes: 15
2626
strategy:
2727
fail-fast: false

windows/winobject/system.py

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,9 @@ def version(self):
260260
result = tuple(result_tup[:2])
261261
return result
262262

263-
263+
# Based on:
264+
# https://jrsoftware.org/ishelp/index.php?topic=winvernotes
265+
# https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
264266

265267
WINDOWS_10_BUILD_NUMBER_VERSION = {
266268
# (build_number, is_workstation): "version_name"
@@ -284,8 +286,17 @@ def version(self):
284286
(26100, True): u"Windows 11 Version 24H2",
285287

286288
(14393, False): u"Windows Server 2016",
289+
# 16299 : Windows Server, version 1709 ?
290+
# 17134 : Windows Server, version 1803 ?
291+
# 17134 : Windows Server, version 1803 ?
287292
(17763, False): u"Windows Server 2019",
293+
# 18362 : Windows Server, version 1903 ?
294+
# 18363 : Windows Server, version 1909 ?
295+
# 19041 : Windows Server, version 2004 ?
296+
# 19042 : Windows Server, version 20H2 ?
288297
(20348, False): u"Windows Server 2022",
298+
# 25398 : Windows Server, version 23H2 ?
299+
(26100, False): u"Windows Server 2025",
289300
}
290301

291302
def _get_version_name_for_10_build(self, build_number, is_workstation):
@@ -298,8 +309,28 @@ def _get_version_name_for_10_build(self, build_number, is_workstation):
298309
def version_name(self):
299310
"""The name of the system version, values are:
300311
312+
* Windows Server 2025
313+
* Windows 11 Version 24H2
314+
* Windows 11 Version 23H2
315+
* Windows 11 Version 22H2
316+
* Windows 11 Version 21H2
317+
* Windows 10 Version 22H2
318+
* Windows 10 Version 21H2
319+
* Windows Server 2022
320+
* Windows 10 Version 21H1
321+
* Windows 10 Version 20H2
322+
* Windows 10 Version 2004
323+
* Windows 10 Version 1909
324+
* Windows 10 Version 1903
325+
* Windows Server 2019
326+
* Windows 10 Version 1809
327+
* Windows 10 Version 1803
328+
* Windows 10 Version 1709
329+
* Windows 10 Version 1703
330+
* Windows 10 Version 1607
331+
* Windows 10 Version 1511
332+
* Windows 10 Version 1507
301333
* Windows Server 2016
302-
* Windows 10
303334
* Windows Server 2012 R2
304335
* Windows 8.1
305336
* Windows Server 2012
@@ -309,20 +340,20 @@ def version_name(self):
309340
* Windows Server 2008
310341
* Windows Vista
311342
* Windows XP Professional x64 Edition
312-
* TODO: version (5.2) + is_workstation + bitness == 32 (don't even know if possible..)
343+
* Unknown: version (5.2) + is_workstation + bitness == 32 (don't even know if possible..)
313344
* Windows Server 2003 R2
314345
* Windows Server 2003
315346
* Windows XP
316347
* Windows 2000
348+
* "Unknown Windows 10+ <versionstr={0} | is_workstation={1}>".format(self.versionstr, is_workstation)
317349
* "Unknown Windows <version={0} | is_workstation={1}>".format(version, is_workstation)
318350
319-
:type: :class:`str`
351+
:type: :class:`unicode`
320352
"""
321353
version = self.version
322354
is_workstation = self.product_type == gdef.VER_NT_WORKSTATION
323355
if version == (10, 0):
324356
return self._get_version_name_for_10_build(self.build_number, is_workstation)
325-
# return [u"Windows Server 2016", u"Windows 10"][is_workstation]
326357
elif version == (6, 3):
327358
return [u"Windows Server 2012 R2", u"Windows 8.1"][is_workstation]
328359
elif version == (6, 2):
@@ -337,7 +368,7 @@ def version_name(self):
337368
if self.bitness == 64:
338369
return u"Windows XP Professional x64 Edition"
339370
else:
340-
return u"TODO: version (5.2) + is_workstation + bitness == 32"
371+
return u"Unknown: version (5.2) + is_workstation + bitness == 32"
341372
elif metric != 0:
342373
return u"Windows Server 2003 R2"
343374
else:

0 commit comments

Comments
 (0)