Skip to content

Commit

Permalink
src/sage_setup/autogen/meson/__init__.py: Output style changes to match
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Apr 1, 2024
1 parent 0f98a6c commit a762cee
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/sage_setup/autogen/meson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit a762cee

Please sign in to comment.