GeezerVison is showing github.com — python module: stop using distutils "link to libpython" probe on rece… · eli-schwartz/meson@2d6c109
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: mesonbuild/scripts/python_info.py +13-4Lines changed: 13 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -64,10 +64,19 @@ def get_install_paths(): |
64 | 64 | paths, install_paths = get_install_paths() |
65 | 65 |
|
66 | 66 | def links_against_libpython(): |
67 | | - from distutils.core import Distribution, Extension |
68 | | - cmd = Distribution().get_command_obj('build_ext') |
69 | | - cmd.ensure_finalized() |
70 | | - return bool(cmd.get_libraries(Extension('dummy', []))) |
| 67 | + # on versions supporting python-embed.pc, this is the non-embed lib |
| 68 | + # |
| 69 | + # PyPy is not yet up to 3.12 and work is still pending to export the |
| 70 | + # relevant information (it doesn't automatically provide arbitrary |
| 71 | + # Makefile vars) |
| 72 | + if sys.version_info >= (3, 8) and not is_pypy: |
| 73 | + variables = sysconfig.get_config_vars() |
| 74 | + return bool(variables.get('LIBPYTHON', 'yes')) |
| 75 | + else: |
| 76 | + from distutils.core import Distribution, Extension |
| 77 | + cmd = Distribution().get_command_obj('build_ext') |
| 78 | + cmd.ensure_finalized() |
| 79 | + return bool(cmd.get_libraries(Extension('dummy', []))) |
71 | 80 |
|
72 | 81 | variables = sysconfig.get_config_vars() |
73 | 82 | variables.update({'base_prefix': getattr(sys, 'base_prefix', sys.prefix)}) |
|