diff options
author | Steve Dower <steve.dower@python.org> | 2022-02-07 16:59:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 16:59:40 (GMT) |
commit | 3a5afc14e16370c1f4f72d43cb553298ad9a1fa4 (patch) | |
tree | 5360d7634ee30b791ee25e7d16f8f24df4ca89b4 /PC/layout | |
parent | 9c979d7afd839abbb080028bdfeb73727e5cf633 (diff) | |
download | cpython-3a5afc14e16370c1f4f72d43cb553298ad9a1fa4.zip cpython-3a5afc14e16370c1f4f72d43cb553298ad9a1fa4.tar.gz cpython-3a5afc14e16370c1f4f72d43cb553298ad9a1fa4.tar.bz2 |
bpo-46638: Makes registry virtualisation setting stable when building MSIX packages (GH-31130)
Diffstat (limited to 'PC/layout')
-rw-r--r-- | PC/layout/support/appxmanifest.py | 14 | ||||
-rw-r--r-- | PC/layout/support/constants.py | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/PC/layout/support/appxmanifest.py b/PC/layout/support/appxmanifest.py index 15119b0..427a36f 100644 --- a/PC/layout/support/appxmanifest.py +++ b/PC/layout/support/appxmanifest.py @@ -412,14 +412,22 @@ def get_appxmanifest(ns): if value: node.text = value - winver = sys.getwindowsversion()[:3] + try: + winver = tuple(int(i) for i in os.getenv("APPX_DATA_WINVER", "").split(".", maxsplit=3)) + except (TypeError, ValueError): + winver = () + + # Default "known good" version is 10.0.22000, first Windows 11 release + winver = winver or (10, 0, 22000) + if winver < (10, 0, 17763): winver = 10, 0, 17763 find_or_add(xml, "m:Dependencies/m:TargetDeviceFamily").set( - "MaxVersionTested", "{}.{}.{}.0".format(*winver) + "MaxVersionTested", "{}.{}.{}.{}".format(*(winver + (0, 0, 0, 0)[:4])) ) - if winver > (10, 0, 17763): + # Only for Python 3.11 and later. Older versions do not disable virtualization + if (VER_MAJOR, VER_MINOR) >= (3, 11) and winver > (10, 0, 17763): disable_registry_virtualization(xml) app = add_application( diff --git a/PC/layout/support/constants.py b/PC/layout/support/constants.py index 6cf0fe1..6efd8bc 100644 --- a/PC/layout/support/constants.py +++ b/PC/layout/support/constants.py @@ -16,7 +16,7 @@ def _unpack_hexversion(): hexversion = int(os.getenv("PYTHON_HEXVERSION"), 16) except (TypeError, ValueError): hexversion = sys.hexversion - return struct.pack(">i", sys.hexversion) + return struct.pack(">i", hexversion) def _get_suffix(field4): |