python module: refactor pypy detection into a consistent variable

pull/11133/head
Eli Schwartz 1 year ago
parent 40f897fa92
commit 3d3a10ef02
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 6
      mesonbuild/scripts/python_info.py

@ -72,6 +72,8 @@ def links_against_libpython():
variables = sysconfig.get_config_vars()
variables.update({'base_prefix': getattr(sys, 'base_prefix', sys.prefix)})
is_pypy = '__pypy__' in sys.builtin_module_names
if sys.version_info < (3, 0):
suffix = variables.get('SO')
elif sys.version_info < (3, 8, 7):
@ -92,7 +94,7 @@ if sys.version_info >= (3, 2):
# pypy supports modules targetting the limited api but
# does not use a special suffix to distinguish them:
# https://doc.pypy.org/en/latest/cpython_differences.html#permitted-abi-tags-in-extensions
if '__pypy__' in sys.builtin_module_names:
if is_pypy:
limited_api_suffix = suffix
print(json.dumps({
@ -102,7 +104,7 @@ print(json.dumps({
'install_paths': install_paths,
'version': sysconfig.get_python_version(),
'platform': sysconfig.get_platform(),
'is_pypy': '__pypy__' in sys.builtin_module_names,
'is_pypy': is_pypy,
'is_venv': sys.prefix != variables['base_prefix'],
'link_libpython': links_against_libpython(),
'suffix': suffix,

Loading…
Cancel
Save