feat: replace 'mesonpep517' with 'meson-python' (#179)

... for PEP-517 compatible builds
This commit is contained in:
Christopher Arndt 2023-11-09 22:11:25 +01:00 committed by GitHub
parent 4138ed4cfb
commit 2822528317
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 146 additions and 116 deletions

View File

@ -1,16 +1,16 @@
Installation
============
**jack_mixer** uses [meson] and optionally a Python [PEP-517]-compliant build
system for building, installation and packaging.
**jack_mixer** uses the [meson] build system for building, installation and
packaging.
## Requirements
Build requirements:
* GCC (version 9.x or 10.x recommended)
* meson >= 0.54.0[<sup>1</sup>](#1)
* GCC (version >= 9.x recommended)
* meson >= 0.64.0
* [ninja]
* Python headers
* [JACK] headers
@ -21,7 +21,7 @@ Build requirements:
Runtime requirements:
* Python >= 3.6
* Python >= 3.8
* [Pygobject]
* [pycairo]
* JACK library and server
@ -35,11 +35,6 @@ The run-time Python dependencies are checked by meson when setting up the
build directory. To disable this, use the `-Dcheck-py-modules=false` option to
`meson setup.`
<a class="anchor" id="1"></a>
<sup>1</sup> *meson 0.53.0 also works if you use `ninja compile` and
`ninja install` instead of `meson compile` and `meson install`.*
## Building
@ -99,32 +94,39 @@ meson configure builddir -Dgui=disabled
```
## Building a Python wheel (for maintainers)
## Building a Python wheel (only for special needs)
1. Make sure you have Python 3, `git` and [pip] installed and your internet
connection is online.
**Note:** Due to limitations of Python's build ecosystem, the wheel packages
built with the instructions given here, will *not* contain any files used
for system desktop integration, e.g. icons and `.desktop' files, nor man pages
or translation files. Using this method to install jack_mixer is thus not
recommended and mainly provided for testing prurposes.
1. Make sure you have Python 3, `git`, [pip] and the Python [build] package
installed and your internet connection is online.
2. Run the following command to build a binary wheel:
```console
pip wheel .
python -m build -w
```
This will automatically download the required build tools, e.g. Cython, meson,
ninja, the Python `wheel` package etc. (see the [pyproject.toml] file for
details), build the software with meson and then package it into a wheel, which
will be placed in the project's root directory.
will be placed in the `dist` directory below the project's root directory.
The wheel can be installed with `pip install jack_mixer-*.whl`.
The wheel can be installed with `python -m pip install dist/jack_mixer-*.whl`.
[docutils]: https://pypi.org/project/docutils/
[build]: https://pypi.org/project/build
[Cython]: https://cython.org/
[JACK]: https://jackaudio.org/
[meson]: https://mesonbuild.com/
[ninja]: https://ninja-build.org/
[NSM]: https://new-session-manager.jackaudio.org/
[options]: https://mesonbuild.com/Build-options.html
[pip]: https://pypi.org/project/pip/
[pip]: https://pypi.org/project/pip
[pycairo]: https://pypi.org/project/pycairo/
[PyGObject]: https://pypi.org/project/PyGObject/
[appdirs]: https://pypi.org/project/appdirs/

View File

@ -1,37 +1,39 @@
# Menu .desktop file
desktop_file = 'jack_mixer.desktop'
install_data(
desktop_file,
install_dir: desktopdir
)
# RaySession template
raysession_template = 'client_templates.xml'
install_data(
raysession_template,
install_dir: raysessiondir)
# Application icons
sizes = [
'16x16',
'22x22',
'24x24',
'32x32',
'48x48',
]
foreach size : sizes
if not get_option('wheel')
# Menu .desktop file
desktop_file = 'jack_mixer.desktop'
install_data(
join_paths('art', size, 'jack_mixer.png'),
install_dir: join_paths(icondir, size, 'apps')
desktop_file,
install_dir: desktopdir
)
endforeach
install_data(
join_paths('art', 'scalable', 'jack_mixer.svg'),
install_dir: join_paths(icondir, 'scalable', 'apps')
)
# RaySession template
# Translations
subdir('locale')
raysession_template = 'client_templates.xml'
install_data(
raysession_template,
install_dir: raysessiondir)
# Application icons
sizes = [
'16x16',
'22x22',
'24x24',
'32x32',
'48x48',
]
foreach size : sizes
install_data(
join_paths('art', size, 'jack_mixer.png'),
install_dir: join_paths(icondir, size, 'apps')
)
endforeach
install_data(
join_paths('art', 'scalable', 'jack_mixer.svg'),
install_dir: join_paths(icondir, 'scalable', 'apps')
)
# Translations
subdir('locale')
endif

View File

@ -1,37 +1,11 @@
if get_option('gui').enabled()
if not get_option('wheel')
fs = import('fs')
jack_mixer_man = 'jack_mixer.1'
jack_mix_box_man = 'jack_mix_box.1'
jack_mixer_man = 'jack_mixer.1'
rst2man = find_program('rst2man', 'rst2man.py', required: false)
if fs.exists(jack_mixer_man)
install_man(jack_mixer_man)
elif rst2man.found()
jack_mixer_man_rst_in = 'jack_mixer.1.rst.in'
jack_mixer_man_rst = configure_file(
input: jack_mixer_man_rst_in,
output: 'jack_mixer.1.rst',
configuration: {
'VERSION': meson.project_version()
}
)
jack_mixer_troff = custom_target(
'jack_mixer_rst2man',
output: jack_mixer_man,
input: jack_mixer_man_rst,
command: [rst2man, '@INPUT@', '@OUTPUT@'],
install: true,
install_dir: join_paths(get_option('mandir'), 'man1')
)
else
error('Pre-generated file \'@0@\' and \'rst2man\' not found.\n'.format(jack_mixer_man) +
'Please install \'docutils\' from https://pypi.org/project/docutils.')
endif
if fs.exists(jack_mix_box_man)
install_man(jack_mix_box_man)
elif rst2man.found()
@ -53,6 +27,37 @@ if get_option('gui').enabled()
install: true,
install_dir: join_paths(get_option('mandir'), 'man1')
)
else
error('Pre-generated file \'@0@\' and \'rst2man\' not found.\n'.format(jack_mix_box_man) +
'Please install \'docutils\' from https://pypi.org/project/docutils.')
endif
if get_option('gui').enabled()
if fs.exists(jack_mixer_man)
install_man(jack_mixer_man)
elif rst2man.found()
jack_mixer_man_rst_in = 'jack_mixer.1.rst.in'
jack_mixer_man_rst = configure_file(
input: jack_mixer_man_rst_in,
output: 'jack_mixer.1.rst',
configuration: {
'VERSION': meson.project_version()
}
)
jack_mixer_troff = custom_target(
'jack_mixer_rst2man',
output: jack_mixer_man,
input: jack_mixer_man_rst,
command: [rst2man, '@INPUT@', '@OUTPUT@'],
install: true,
install_dir: join_paths(get_option('mandir'), 'man1')
)
else
error('Pre-generated file \'@0@\' and \'rst2man\' not found.\n'.format(jack_mix_box_man) +
'Please install \'docutils\' from https://pypi.org/project/docutils.')
endif
endif
meson.add_dist_script('meson_dist_rst2man.py', jack_mixer_man, jack_mix_box_man)

View File

@ -60,7 +60,6 @@ python_sources = files([
python.install_sources(
python_sources,
version_py,
pure: true,
subdir: 'jack_mixer',
)

View File

@ -6,7 +6,7 @@ project(
default_options: [
'warning_level=2'
],
meson_version: '>=0.53.0'
meson_version: '>=0.64.0'
)
# Dependencies
@ -33,6 +33,7 @@ if get_option('gui').enabled()
python = pymod.find_installation(
'python3',
required: true,
pure: false,
modules: get_option('check-py-modules') ? ['gi', 'cairo', 'appdirs'] : []
)
endif

View File

@ -1,41 +1,25 @@
[build-system]
# https://thiblahute.gitlab.io/mesonpep517/
build-backend = "mesonpep517.buildapi"
build-backend = "mesonpy"
requires = [
"cython",
"docutils",
"wheel",
"mesonpep517>=0.2",
"ninja"
"meson-python",
"ninja",
"docutils",
]
[tool.mesonpep517.entry-points]
console_scripts = [
"jack_mixer = jack_mixer.app:main"
[project]
name = "jack_mixer"
dynamic = ['version']
description = "A GTK+ JACK audio mixer application"
readme = "README.md"
authors = [
{ name="Nedko Arnaudov", email="nedko (a.t) arnaudov (dot) name" },
]
[tool.mesonpep517.metadata]
summary = "A GTK+ JACK audio mixer application"
description-file = "README.md"
# 'keywords' metadata field not supported by mesonpep517 (yet)
#keywords = "mixer,audio,music,jack,gtk"
license = "GPL2+"
author = "Nedko Arnaudov"
author-email = "nedko (a.t) arnaudov (dot) name"
maintainer = "Christopher Arndt"
maintainer-email = "info (a.t.) chrisarndt.de"
home-page = "https://rdio.space/jackmixer/"
project-urls = [
"Source, https://github.com/jack-mixer/jack-mixer",
maintainers = [
{ name="Christopher Arndt", email="info (a.t.) chrisarndt.de" },
]
requires= [
"PyGObject",
"pycairo",
"appdirs",
]
requires-python = ">=3.6"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
@ -47,29 +31,66 @@ classifiers = [
"Operating System :: MacOS :: MacOS X",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Multimedia :: Sound/Audio :: Mixers",
]
meson-python-option-name = "python3"
meson-options = [
keywords = [
"mixer",
"audio",
"music",
"jack",
"gtk",
]
requires-python = ">=3.8"
dependencies = [
"PyGObject",
"pycairo",
"appdirs",
]
[project.license]
file = "COPYING"
[project.urls]
"Homepage" = "https://rdio.space/jackmixer/"
"Source" = "https://github.com/jack-mixer/jack-mixer"
"Bug Tracker" = "https://github.com/jack-mixer/jack-mixer/issues"
[project.scripts]
"jack_mixer" = "jack_mixer.app:main"
[tool.meson-python.args]
setup = [
"-Dwheel=true",
"--buildtype=release"
"-Dbuildtype=release",
"-Dcheck-py-modules=false",
]
[tool.isort]
line_length = 99
profile = "black"
ensure_newline_before_comments = true
force_grid_wrap = 0
include_trailing_comma = true
line_length = 99
multi_line_output = 3
use_parentheses = true
[tool.black]
line-length = 99
target-version = ['py36', 'py37', 'py38']
target-version = [
"py38",
"py39",
"py310",
"py311",
"py312",
]
force-exclude = 'jack_mixer/nsmclient\.py'