Skip to content

Commit

Permalink
pythongh-102362: Fix macOS version number in result of sysconfig.get_…
Browse files Browse the repository at this point in the history
…platform()

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.
  • Loading branch information
ronaldoussoren committed Dec 10, 2023
1 parent 2d76be2 commit fecbefa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Lib/_osx_support.py
Expand Up @@ -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

Expand Down
@@ -0,0 +1,3 @@
Make sure the result of :func:`sysconfig.get_plaform` includes at least a
major and minor versions, even if ``MACOSX_DEPLOYMENT_TARGET`` is set to
only a major version during build to match the format expected by pip.

0 comments on commit fecbefa

Please sign in to comment.