Skip to content

BLD: improvements to meson.build files #54949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions generate_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env python3

# Note: This file has to live next to setup.py or versioneer will not work
import argparse
import os
Expand Down
16 changes: 9 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@
project(
'pandas',
'c', 'cpp', 'cython',
version: run_command(['python', 'generate_version.py', '--print'], check: true).stdout().strip(),
version: run_command(['generate_version.py', '--print'], check: true).stdout().strip(),
license: 'BSD-3',
meson_version: '>=1.0.1',
default_options: [
'buildtype=release',
# TODO: Reactivate werror, some warnings on Windows
#'werror=true',
'c_std=c99'
]
)

fs = import('fs')
py = import('python').find_installation()
py = import('python').find_installation(pure: false)
tempita = files('generate_pxi.py')
versioneer = files('generate_version.py')

Expand All @@ -30,7 +28,7 @@ add_project_arguments('-DNPY_TARGET_VERSION=NPY_1_21_API_VERSION', language : 'c


if fs.exists('_version_meson.py')
py.install_sources('_version_meson.py', pure: false, subdir: 'pandas')
py.install_sources('_version_meson.py', subdir: 'pandas')
else
custom_target('write_version_file',
output: '_version_meson.py',
Expand All @@ -40,11 +38,15 @@ else
build_by_default: true,
build_always_stale: true,
install: true,
install_dir: py.get_install_dir(pure: false) / 'pandas'
install_dir: py.get_install_dir() / 'pandas'
)
meson.add_dist_script(py, versioneer, '-o', '_version_meson.py')
endif

# Needed by pandas.test() when it looks for the pytest ini options
py.install_sources('pyproject.toml', pure: false, subdir: 'pandas')
py.install_sources(
'pyproject.toml',
subdir: 'pandas'
)

subdir('pandas')
7 changes: 4 additions & 3 deletions pandas/_libs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ foreach ext_name, ext_dict : libs_sources
)
endforeach

py.install_sources('__init__.py',
pure: false,
subdir: 'pandas/_libs')
py.install_sources(
'__init__.py',
subdir: 'pandas/_libs'
)

subdir('window')
7 changes: 4 additions & 3 deletions pandas/_libs/tslibs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ foreach ext_name, ext_dict : tslibs_sources
)
endforeach

py.install_sources('__init__.py',
pure: false,
subdir: 'pandas/_libs/tslibs')
py.install_sources(
'__init__.py',
subdir: 'pandas/_libs/tslibs'
)
9 changes: 3 additions & 6 deletions pandas/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,14 @@ subdirs_list = [
'util'
]
foreach subdir: subdirs_list
install_subdir(subdir, install_dir: py.get_install_dir(pure: false) / 'pandas')
install_subdir(subdir, install_dir: py.get_install_dir() / 'pandas')
endforeach

top_level_py_list = [
'__init__.py',
'_typing.py',
'_version.py',
'conftest.py',
'testing.py'
]
foreach file: top_level_py_list
py.install_sources(file,
pure: false,
subdir: 'pandas')
endforeach
py.install_sources(top_level_py_list, subdir: 'pandas')