From 73fa3aad43f0dbda4625f1a57cbb25c8f410979c Mon Sep 17 00:00:00 2001 From: Matti Picus Date: Thu, 17 Mar 2022 14:07:26 +0200 Subject: [PATCH] python module: windows dll name for pypy needs special casing --- mesonbuild/modules/python.py | 10 +++++++++- run_project_tests.py | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/mesonbuild/modules/python.py b/mesonbuild/modules/python.py index 000f0c6bf..114794565 100644 --- a/mesonbuild/modules/python.py +++ b/mesonbuild/modules/python.py @@ -186,12 +186,20 @@ class PythonSystemDependency(SystemDependency, _PythonDependencyBase): def _get_windows_link_args(self) -> T.Optional[T.List[str]]: if self.platform.startswith('win'): vernum = self.variables.get('py_version_nodot') + verdot = self.variables.get('py_version_short') + imp_lower = self.variables.get('implementation_lower', 'python') if self.static: libpath = Path('libs') / f'libpython{vernum}.a' else: comp = self.get_compiler() if comp.id == "gcc": - libpath = Path(f'python{vernum}.dll') + if imp_lower == 'pypy' and verdot == '3.8': + # The naming changed between 3.8 and 3.9 + libpath = Path(f'libpypy3-c.dll') + elif imp_lower == 'pypy': + libpath = Path(f'libpypy{verdot}-c.dll') + else: + libpath = Path(f'python{vernum}.dll') else: libpath = Path('libs') / f'python{vernum}.lib' # base_prefix to allow for virtualenvs. diff --git a/run_project_tests.py b/run_project_tests.py index 893107a23..b25aca675 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -651,7 +651,8 @@ def _run_test(test: TestDef, (returncode, stdo, stde) = run_configure(gen_args, env=test.env, catch_exception=True) try: logfile = Path(test_build_dir, 'meson-logs', 'meson-log.txt') - mesonlog = logfile.open(errors='ignore', encoding='utf-8').read() + with logfile.open(errors='ignore', encoding='utf-8') as fid: + mesonlog = fid.read() except Exception: mesonlog = no_meson_log_msg cicmds = run_ci_commands(mesonlog)