summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRonald Oussoren <ronaldoussoren@mac.com>2023-12-18 23:51:58 (GMT)
committerGitHub <noreply@github.com>2023-12-18 23:51:58 (GMT)
commit893c9ccf48eacb02fa6ae93632f2d0cb6778dbb6 (patch)
treec8d5d8692de08520ee0a87a84a15a673142f5ab9 /Lib
parent4cfce3a4da7ca9513e7f2c8ec94d50f8bddfa41b (diff)
downloadcpython-893c9ccf48eacb02fa6ae93632f2d0cb6778dbb6.zip
cpython-893c9ccf48eacb02fa6ae93632f2d0cb6778dbb6.tar.gz
cpython-893c9ccf48eacb02fa6ae93632f2d0cb6778dbb6.tar.bz2
gh-102362: Fix macOS version number in result of sysconfig.get_platform() (GH-112942)
Change _osx_support.get_platform_osx() to make sure that the version number in the result includes at least a major and minor version (e.g. 14.2) even if MACOSX_DEPLOYMENT_TARGET is set to just a major version (e.g. 14). This matches the versions expected by pip when selecting appropriate wheels for installation.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/_osx_support.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py
index aa66c8b..0cb064f 100644
--- a/Lib/_osx_support.py
+++ b/Lib/_osx_support.py
@@ -507,6 +507,11 @@ def get_platform_osx(_config_vars, osname, release, machine):
# MACOSX_DEPLOYMENT_TARGET.
macver = _config_vars.get('MACOSX_DEPLOYMENT_TARGET', '')
+ if macver and '.' not in macver:
+ # Ensure that the version includes at least a major
+ # and minor version, even if MACOSX_DEPLOYMENT_TARGET
+ # is set to a single-label version like "14".
+ macver += '.0'
macrelease = _get_system_version() or macver
macver = macver or macrelease