|
15 | 15 | # This file contains the detection logic for miscellaneous external dependencies.
|
16 | 16 | from __future__ import annotations
|
17 | 17 |
|
18 |
| -from pathlib import Path |
19 | 18 | import functools
|
20 | 19 | import re
|
21 |
| -import sysconfig |
22 | 20 | import typing as T
|
23 | 21 |
|
24 | 22 | from .. import mesonlib
|
25 | 23 | from .. import mlog
|
26 |
| -from ..environment import detect_cpu_family |
27 | 24 | from .base import DependencyException, DependencyMethods
|
28 | 25 | from .base import BuiltinDependency, SystemDependency
|
29 | 26 | from .cmake import CMakeDependency
|
@@ -187,108 +184,6 @@ def __init__(self, environment: 'Environment', kwargs: T.Dict[str, T.Any]) -> No
|
187 | 184 | self.is_found = True
|
188 | 185 |
|
189 | 186 |
|
190 |
| -class Python3DependencySystem(SystemDependency): |
191 |
| - def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]) -> None: |
192 |
| - super().__init__(name, environment, kwargs) |
193 |
| - |
194 |
| - if not environment.machines.matches_build_machine(self.for_machine): |
195 |
| - return |
196 |
| - if not environment.machines[self.for_machine].is_windows(): |
197 |
| - return |
198 |
| - |
199 |
| - self.name = 'python3' |
200 |
| - # We can only be sure that it is Python 3 at this point |
201 |
| - self.version = '3' |
202 |
| - self._find_libpy3_windows(environment) |
203 |
| - |
204 |
| - @staticmethod |
205 |
| - def get_windows_python_arch() -> T.Optional[str]: |
206 |
| - pyplat = sysconfig.get_platform() |
207 |
| - if pyplat == 'mingw': |
208 |
| - pycc = sysconfig.get_config_var('CC') |
209 |
| - if pycc.startswith('x86_64'): |
210 |
| - return '64' |
211 |
| - elif pycc.startswith(('i686', 'i386')): |
212 |
| - return '32' |
213 |
| - else: |
214 |
| - mlog.log(f'MinGW Python built with unknown CC {pycc!r}, please file a bug') |
215 |
| - return None |
216 |
| - elif pyplat == 'win32': |
217 |
| - return '32' |
218 |
| - elif pyplat in {'win64', 'win-amd64'}: |
219 |
| - return '64' |
220 |
| - mlog.log(f'Unknown Windows Python platform {pyplat!r}') |
221 |
| - return None |
222 |
| - |
223 |
| - def get_windows_link_args(self) -> T.Optional[T.List[str]]: |
224 |
| - pyplat = sysconfig.get_platform() |
225 |
| - if pyplat.startswith('win'): |
226 |
| - vernum = sysconfig.get_config_var('py_version_nodot') |
227 |
| - if self.static: |
228 |
| - libpath = Path('libs') / f'libpython{vernum}.a' |
229 |
| - else: |
230 |
| - comp = self.get_compiler() |
231 |
| - if comp.id == "gcc": |
232 |
| - libpath = Path(f'python{vernum}.dll') |
233 |
| - else: |
234 |
| - libpath = Path('libs') / f'python{vernum}.lib' |
235 |
| - lib = Path(sysconfig.get_config_var('base')) / libpath |
236 |
| - elif pyplat == 'mingw': |
237 |
| - if self.static: |
238 |
| - libname = sysconfig.get_config_var('LIBRARY') |
239 |
| - else: |
240 |
| - libname = sysconfig.get_config_var('LDLIBRARY') |
241 |
| - lib = Path(sysconfig.get_config_var('LIBDIR')) / libname |
242 |
| - if not lib.exists(): |
243 |
| - mlog.log('Could not find Python3 library {!r}'.format(str(lib))) |
244 |
| - return None |
245 |
| - return [str(lib)] |
246 |
| - |
247 |
| - def _find_libpy3_windows(self, env: 'Environment') -> None: |
248 |
| - ''' |
249 |
| - Find python3 libraries on Windows and also verify that the arch matches |
250 |
| - what we are building for. |
251 |
| - ''' |
252 |
| - pyarch = self.get_windows_python_arch() |
253 |
| - if pyarch is None: |
254 |
| - self.is_found = False |
255 |
| - return |
256 |
| - arch = detect_cpu_family(env.coredata.compilers.host) |
257 |
| - if arch == 'x86': |
258 |
| - arch = '32' |
259 |
| - elif arch == 'x86_64': |
260 |
| - arch = '64' |
261 |
| - else: |
262 |
| - # We can't cross-compile Python 3 dependencies on Windows yet |
263 |
| - mlog.log(f'Unknown architecture {arch!r} for', |
264 |
| - mlog.bold(self.name)) |
265 |
| - self.is_found = False |
266 |
| - return |
267 |
| - # Pyarch ends in '32' or '64' |
268 |
| - if arch != pyarch: |
269 |
| - mlog.log('Need', mlog.bold(self.name), 'for {}-bit, but ' |
270 |
| - 'found {}-bit'.format(arch, pyarch)) |
271 |
| - self.is_found = False |
272 |
| - return |
273 |
| - # This can fail if the library is not found |
274 |
| - largs = self.get_windows_link_args() |
275 |
| - if largs is None: |
276 |
| - self.is_found = False |
277 |
| - return |
278 |
| - self.link_args = largs |
279 |
| - # Compile args |
280 |
| - inc = sysconfig.get_path('include') |
281 |
| - platinc = sysconfig.get_path('platinclude') |
282 |
| - self.compile_args = ['-I' + inc] |
283 |
| - if inc != platinc: |
284 |
| - self.compile_args.append('-I' + platinc) |
285 |
| - self.version = sysconfig.get_config_var('py_version') |
286 |
| - self.is_found = True |
287 |
| - |
288 |
| - @staticmethod |
289 |
| - def log_tried() -> str: |
290 |
| - return 'sysconfig' |
291 |
| - |
292 | 187 | class PcapDependencyConfigTool(ConfigToolDependency):
|
293 | 188 |
|
294 | 189 | tools = ['pcap-config']
|
@@ -670,17 +565,6 @@ def shaderc_factory(env: 'Environment',
|
670 | 565 | pkgconfig_name='libpcap',
|
671 | 566 | )
|
672 | 567 |
|
673 |
| -python3_factory = DependencyFactory( |
674 |
| - 'python3', |
675 |
| - [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM, DependencyMethods.EXTRAFRAMEWORK], |
676 |
| - system_class=Python3DependencySystem, |
677 |
| - # There is no version number in the macOS version number |
678 |
| - framework_name='Python', |
679 |
| - # There is a python in /System/Library/Frameworks, but that's python 2.x, |
680 |
| - # Python 3 will always be in /Library |
681 |
| - extra_kwargs={'paths': ['/Library/Frameworks']}, |
682 |
| -) |
683 |
| - |
684 | 568 | threads_factory = DependencyFactory(
|
685 | 569 | 'threads',
|
686 | 570 | [DependencyMethods.SYSTEM, DependencyMethods.CMAKE],
|
|
0 commit comments