aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/modules/python.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/modules/python.py')
-rw-r--r--mesonbuild/modules/python.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py
index e5509d9..47dc674 100644
--- a/mesonbuild/modules/python.py
+++ b/mesonbuild/modules/python.py
@@ -516,16 +516,26 @@ class PythonInstallation(ExternalProgramHolder):
kwargs['install_dir'] = os.path.join(self.platlib_install_path, subdir)
- # On macOS and some Linux distros (Debian) distutils doesn't link
- # extensions against libpython. We call into distutils and mirror its
- # behavior. See https://github.com/mesonbuild/meson/issues/4117
- if not self.link_libpython:
- new_deps = []
- for dep in mesonlib.extract_as_list(kwargs, 'dependencies'):
- if isinstance(dep, _PythonDependencyBase):
+ new_deps = []
+ has_pydep = False
+ for dep in mesonlib.extract_as_list(kwargs, 'dependencies'):
+ if isinstance(dep, _PythonDependencyBase):
+ has_pydep = True
+ # On macOS and some Linux distros (Debian) distutils doesn't link
+ # extensions against libpython. We call into distutils and mirror its
+ # behavior. See https://github.com/mesonbuild/meson/issues/4117
+ if not self.link_libpython:
dep = dep.get_partial_dependency(compile_args=True)
- new_deps.append(dep)
- kwargs['dependencies'] = new_deps
+ new_deps.append(dep)
+ if not has_pydep:
+ pydep = self._dependency_method_impl({})
+ if not pydep.found():
+ raise mesonlib.MesonException('Python dependency not found')
+ new_deps.append(pydep)
+ FeatureNew.single_use('python_installation.extension_module with implicit dependency on python',
+ '0.63.0', self.subproject, 'use python_installation.dependency()',
+ self.current_node)
+ kwargs['dependencies'] = new_deps
# msys2's python3 has "-cpython-36m.dll", we have to be clever
# FIXME: explain what the specific cleverness is here