From ec43bc5d12c139b2a5d6a0869e4a7681821851c4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 22 Mar 2024 21:29:00 -0700 Subject: [PATCH] src/sage_setup/autogen/meson/__init__.py: Output style changes to match #36524 --- src/sage_setup/autogen/meson/__init__.py | 25 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/sage_setup/autogen/meson/__init__.py b/src/sage_setup/autogen/meson/__init__.py index 0c700ee7f09..cd9435e75c5 100644 --- a/src/sage_setup/autogen/meson/__init__.py +++ b/src/sage_setup/autogen/meson/__init__.py @@ -245,21 +245,30 @@ def get_metadata(path: Path): meson_build.write(f"if {distribution_condition(distribution)}\n") if files.python_files: - meson_build.write('py.install_sources(\n') - for file in files.python_files: - meson_build.write(f" '{file.path.name}',\n") - meson_build.write(f" subdir: '{folder_rel_to_src}',\n") - meson_build.write(')\n') + if monolithic and len(files.python_files) <= 4: + meson_build.write('py.install_sources(') + for file in files.python_files: + meson_build.write(f"'{file.path.name}', ") + meson_build.write(f"subdir : '{folder_rel_to_src}'") + meson_build.write(')\n') + else: + meson_build.write('py.install_sources(\n') + for file in files.python_files: + meson_build.write(f" '{file.path.name}',\n") + meson_build.write(f" subdir : '{folder_rel_to_src}'\n") + meson_build.write(')\n') if files.cython_c_files: meson_build.write('\n') meson_build.write('extension_data = {\n') + items = [] for file in files.cython_c_files: if file.not_yet_on_conda: - meson_build.write(f" # '{file.path.stem}': files('{file.path.name}'), # not yet on conda\n") + items.append(f" # '{file.path.stem}' : files('{file.path.name}'), # not yet on conda") else: - meson_build.write(f" '{file.path.stem}': files('{file.path.name}'),\n") - meson_build.write('}\n\n') + items.append(f" '{file.path.stem}' : files('{file.path.name}')") + meson_build.write(',\n'.join(items)) + meson_build.write('\n}\n\n') meson_build.write('foreach name, pyx : extension_data\n') meson_build.write(" py.extension_module(name,\n")