Combining build_ext with the Meson build system
Project description
Mebuex
A setuptools Extension
and build_ext
wrapper for builds based on Meson.
Usage
Mebuex assumes that the structure of a package is as follows:
root
| - builddir
| ... some source layout to be compiled with Meson ...
| - *packagename*
| | ... Python package layout handled by setup.py ...
| - setup.py
| - meson.build
That is, the root directory of the package contains the setup.py
file,
the meson.build
file, a Meson build directory (here builddir
, but can be
configured), directories covering the sources to be built by Meson, and the
Python package source tree.
The relevant part of this layout is that setup.py
and meson.build
are
contained in the root directory, and that a designated build directory is
specified (need not exist before building). The Meson build file should contain
all relevant configuration to build a Python extension within the build
directory (here builddir
). The setup.py
file should be based on setuptools
and contain all relevant configuration for the Python part of the package.
Within the setup.py
file, the Python extension built by Meson can then be
included using the MesonExtension
and build_ext
commands supplied by Mebuex.
An example code would look like this (suppose that the Meson build would yield
an extension mypackage.backend
):
from setuptools import setup
from mebuex import MesonExtension, build_ext
ext = MesonExtension('mypackage.backend', builddir='builddir')
setup(name='mypackage',
version='1.0.0',
author='Me',
description='Or is it yours?',
ext_modules=[ext],
cmdclass={'build_ext' : build_ext}
)
Install
Mebuex can be installed with Pip:
pip install .
License
Mebuex is licensed under the MIT license (see the LICENSE file).
Changelog
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[1.1.5] - 2023-06-02
Changed
- Try wiping the build directory if compilation within a previously setup build directory fails.
[1.1.4] - 2023-05-04
Changed
- Be more verbose on
destpath
error inbuild_ext.build_extension
.
[1.1.3] - 2023-04-14
Added
- Add example project in
example/
subfolder.
[1.1.2] - 2023-04-13
Changed
- Change to
pyproject.toml
install workflow.
[1.1.1] - 2022-10-05
Changed
- Add a more informative error message if the directory to copy the built extension to does not exist.
[1.1.0] - 2022-07-13
Changed
- Fixed empty lib being copied to wheel directory instead of Meson-compiled lib.
- Fix handling of dots in compiled names (likely irrelevant).
[1.0.0] - 2022-07-13
Added
- First version
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.