Eryk Sun <eryk...@gmail.com> added the comment:
> use the build number as reference instead of the major.minor It could check the (major, minor, build) tuple, which allows reporting 10.1+ as "post11" and minimizes hard coding of build numbers. For example, given win32_ver() iterates by (major, minor, build) thresholds: _WIN32_CLIENT_RELEASES = [ ((10, 1, 0), "post11"), ((10, 0, 22000), "11"), ((6, 4, 0), "10"), ((6, 3, 0), "8.1"), ((6, 2, 0), "8"), ((6, 1, 0), "7"), ((6, 0, 0), "Vista"), ((5, 2, 3790), "XP64"), ((5, 2, 0), "XPMedia"), ((5, 1, 0), "XP"), ((5, 0, 0), "2000"), ] _WIN32_SERVER_RELEASES = [ ((10, 1, 0), "post2022Server"), ((10, 0, 20348), "2022Server"), ((10, 0, 17763), "2019Server"), ((6, 4, 0), "2016Server"), ((6, 3, 0), "2012ServerR2"), ((6, 2, 0), "2012Server"), ((6, 1, 0), "2008ServerR2"), ((6, 0, 0), "2008Server"), ((5, 2, 0), "2003Server"), ((5, 0, 0), "2000Server"), ] In win32_ver(): if major >= 5: # NT systems if getattr(winver, 'product_type', None) == 3: # VER_NT_SERVER release_list = _WIN32_SERVER_RELEASES else: release_list = _WIN32_CLIENT_RELEASES ver = major, minor, build for release_ver, release_name in release_list: if ver >= release_ver: release = release_name break ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45382> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com