This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sysconfig's osx_framework_user puts headers in different locations from distutils
Type: behavior Stage: resolved
Components: Library (Lib), macOS Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lukasz.langa, miss-islington, ned.deily, ronaldoussoren, uranusjr
Priority: normal Keywords: patch

Created on 2021-04-27 07:53 by uranusjr, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 27093 merged uranusjr, 2021-07-12 07:40
PR 27159 merged miss-islington, 2021-07-15 10:09
Messages (4)
msg392037 - (view) Author: Tzu-ping Chung (uranusjr) * Date: 2021-04-27 07:53
When built in framework mode on macOS, distutils puts user-site headers under `{userbase}/include/python{py_version_short}{abiflags}`:

>>> import sys
>>> print(sys.platform, sys._framework)
darwin Python
>>> from distutils.dist import Distribution
>>> c = Distribution().get_command_obj('install')
>>> c.user = True
>>> c.finalize_options()
>>> print(c.install_headers)
/Users/uranusjr/Library/Python/3.9/include/python3.9/UNKNOWN

But sysconfig lacks the `pythonX.Y` part:

>>> import sysconfig
>>> print(sysconfig.get_path('include', scheme='osx_framework_user'))
/Users/uranusjr/Library/Python/3.9/include

This is inconsistent to all other schemes, such as `posix_user` (tested on the `python:3.9-slim` OCI image):

>>> import sys
>>> print(sys.platform, sys._framework)
linux
>>> from distutils.dist import Distribution
>>> c = Distribution().get_command_obj('install')
>>> c.user = True
>>> c.finalize_options()
>>> print(c.install_headers)
/root/.local/include/python3.9/UNKNOWN
>>> import sysconfig
>>> print(sysconfig.get_path('include', scheme='posix_user'))
/root/.local/include/python3.9

Note that the paths on `posix_user` only differs by one component (`UNKNOWN`, which is the distribution name), but `osx_framework_user` differs by two.
msg397397 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-07-13 13:11
The current behavior has been there since 2012 at least. Kind of suspicious we haven't tripped over it before.
msg397442 - (view) Author: Tzu-ping Chung (uranusjr) * Date: 2021-07-13 19:43
Personally I am not very surprised. The scenario (installing a package to the user scheme of a macOS Framework build) is quite obscure on its own, and AFAIK no third-party package installers is currently using sysconfig. Both pip and setuptools use distutils, and everything else uses one of them to perform the installation indirectly.
msg397544 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-07-15 12:31
Thanks! ✨ 🍰 ✨
History
Date User Action Args
2022-04-11 14:59:44adminsetgithub: 88114
2021-07-15 12:31:19lukasz.langasetstatus: open -> closed
resolution: fixed
messages: + msg397544

stage: patch review -> resolved
2021-07-15 10:09:39miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request25696
2021-07-13 19:43:10uranusjrsetmessages: + msg397442
2021-07-13 13:11:21lukasz.langasetnosy: + lukasz.langa
messages: + msg397397
2021-07-12 07:40:22uranusjrsetkeywords: + patch
stage: patch review
pull_requests: + pull_request25641
2021-04-30 22:16:45terry.reedysettitle: sysconfig’s osx_framework_user puts headers in different locations from distutils -> sysconfig's osx_framework_user puts headers in different locations from distutils
versions: - Python 3.6, Python 3.7, Python 3.8, Python 3.9, Python 3.11
2021-04-27 08:20:33uranusjrsetnosy: + ronaldoussoren, ned.deily
type: behavior
components: + macOS
2021-04-27 07:53:25uranusjrcreate