Skip to content
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
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [0.61, 1.3, 'latest']
version: [0.61, 1.3, 1.8, 'latest']

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
cache: 'pip'

Expand All @@ -41,10 +41,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
meson_version: ["native", "0.61", "1.3", 'latest']
meson_version: ["native", "0.61", "1.3", "1.8", 'latest']
linux_version: ["almalinux:8", "almalinux:9", "ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04"]
exclude:
- { linux_version: "almalinux:8", meson_version: "1.3" }
- { linux_version: "almalinux:8", meson_version: "1.8" }
- { linux_version: "almalinux:8", meson_version: "native" } # 0.58.2
- { linux_version: "ubuntu:20.04", meson_version: "native" } # 0.53.2
include:
Expand All @@ -66,7 +67,7 @@ jobs:
dnf -y install redhat-release python3 python3-pip meson ninja-build gcc
fi

- uses: actions/checkout@v4
- uses: actions/checkout@v5

- run: pip3 install ${{ matrix.pip_args }} colcon-package-information

Expand Down
15 changes: 14 additions & 1 deletion colcon_meson/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
from colcon_core.task import TaskExtensionPoint
# meson
from mesonbuild import coredata
from mesonbuild.build import OptionKey
from mesonbuild.mesonmain import CommandLineParser


logger = colcon_logger.getChild(__name__)


Expand Down Expand Up @@ -70,7 +72,18 @@ def format_args(args):
Returns:
dict: converted arguments as key-value pairs
"""
return {arg.name: args.cmd_line_options[arg] for arg in args.cmd_line_options}
cli_params = {}
for param in args.cmd_line_options:
v = args.cmd_line_options[param]
if isinstance(param, OptionKey):
# meson <= 1.7
cli_params[param.name] = v
elif isinstance(param, str):
# meson >= 1.8
cli_params[param] = v
else:
raise AttributeError(f'Unsupported CLI option key type {type(param).__name__}')
return cli_params


class MesonBuildTask(TaskExtensionPoint):
Expand Down
11 changes: 4 additions & 7 deletions colcon_meson/identification.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,20 @@
from colcon_core.package_descriptor import PackageDescriptor
from colcon_core.package_identification import PackageIdentificationExtensionPoint
# meson
from mesonbuild import environment
from mesonbuild import mesonlib
from mesonbuild.ast import IntrospectionInterpreter
from mesonbuild.interpreter import primitives
from mesonbuild.interpreterbase.baseobjects import InterpreterObject, mparser
from mesonbuild.interpreterbase.interpreterbase import InterpreterBase

logger = colcon_logger.getChild(__name__)


class CustomInterpreter(InterpreterBase):
class CustomInterpreter(IntrospectionInterpreter):
"""A custom interpreter to parse metadata for Meson projects."""

def __init__(self, source_root: str, subdir: str, subproject: str):
def __init__(self, source_root: str, subdir: str, backend: str,):
"""Initialise the interpreter and a data structure for metadata."""
super().__init__(source_root, subdir, subproject)
super().__init__(source_root, subdir, backend)

self.holder_map.update({
list: primitives.ArrayHolder,
Expand All @@ -33,8 +32,6 @@ def __init__(self, source_root: str, subdir: str, subproject: str):
str: primitives.StringHolder,
})

self.environment = environment

self.data = {}
self.data["dependencies"] = set()

Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = colcon-meson
version = 0.4.5
version = 0.5.0
project_urls =
GitHub = https://github.com/colcon/colcon-meson
author = Christian Rauch
Expand Down
2 changes: 1 addition & 1 deletion test/spell_check.words
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apache
argparse
arraystatement
backend
baseobjects
boolen
builddir
Expand Down Expand Up @@ -47,6 +48,5 @@ sourcedir
subdata
subparsers
subpath
subproject
thomas
unholder
2 changes: 1 addition & 1 deletion test/test_identification.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
)


def test_capital_case():
def test_identification():
mpi = MesonPackageIdentification()
desc = PackageDescriptor(test_project_path)
mpi.identify(desc)
Expand Down
Loading