import sys from pathlib import Path import numpy as np outfile = Path(sys.argv[1]) # This piece of code will just just copy the Numpy's `__config__.py` file, # rather than write out SciPy's build-time config settings. This file should be # generated by `config.make_config_py()` in `scipy/setup.py` which relies on an # instance of `numpy.distutils.Configuration`. It cannot be accessed directly # with a Meson build. This is a workaround for the same. # For more details the implementation of this method is at https://github.com/numpy/numpy/blob/main/numpy/distutils/misc_util.py#L2113 outfile.write_text(Path(str(np.__config__.__file__)).read_text())