summaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/python.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/dependencies/python.py')
-rw-r--r--mesonbuild/dependencies/python.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py
index 160772888..efb904eca 100644
--- a/mesonbuild/dependencies/python.py
+++ b/mesonbuild/dependencies/python.py
@@ -44,6 +44,7 @@ if T.TYPE_CHECKING:
paths: T.Dict[str, str]
platform: str
suffix: str
+ limited_api_suffix: str
variables: T.Dict[str, str]
version: str
@@ -94,6 +95,7 @@ class BasicPythonExternalProgram(ExternalProgram):
'paths': {},
'platform': 'sentinel',
'suffix': 'sentinel',
+ 'limited_api_suffix': 'sentinel',
'variables': {},
'version': '0.0',
}
@@ -197,7 +199,7 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
if self.link_libpython:
# link args
if mesonlib.is_windows():
- self.find_libpy_windows(environment)
+ self.find_libpy_windows(environment, limited_api=False)
else:
self.find_libpy(environment)
else:
@@ -259,7 +261,7 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
mlog.log(f'Unknown Windows Python platform {self.platform!r}')
return None
- def get_windows_link_args(self) -> T.Optional[T.List[str]]:
+ def get_windows_link_args(self, limited_api: bool) -> T.Optional[T.List[str]]:
if self.platform.startswith('win'):
vernum = self.variables.get('py_version_nodot')
verdot = self.variables.get('py_version_short')
@@ -277,6 +279,8 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
else:
libpath = Path(f'python{vernum}.dll')
else:
+ if limited_api:
+ vernum = vernum[0]
libpath = Path('libs') / f'python{vernum}.lib'
# For a debug build, pyconfig.h may force linking with
# pythonX_d.lib (see meson#10776). This cannot be avoided
@@ -317,7 +321,7 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
return None
return [str(lib)]
- def find_libpy_windows(self, env: 'Environment') -> None:
+ def find_libpy_windows(self, env: 'Environment', limited_api: bool = False) -> None:
'''
Find python3 libraries on Windows and also verify that the arch matches
what we are building for.
@@ -332,7 +336,7 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase):
self.is_found = False
return
# This can fail if the library is not found
- largs = self.get_windows_link_args()
+ largs = self.get_windows_link_args(limited_api)
if largs is None:
self.is_found = False
return