From 1aa7cbb297952c162929403d63b798c9f254e0d8 Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Sun, 22 Nov 2026 19:28:08 +0900 Subject: [PATCH] mwrap 1.6.1.1: the template writes its dependency selector unquoted (mcpp 2026.11.8.1 deprecates the quoted key) tools/test_template.py reads the unquoted key as the nested tables TOML makes of it, and requires that spelling in the rendered manifest. The manifests the repository builds itself name the package by the unquoted key too (examples/opus/mcpp.toml). --- README.md | 4 ++-- README.zh.md | 4 ++-- examples/opus/mcpp.toml | 2 +- mcpp.toml | 2 +- templates/tone/mcpp.toml.in | 2 +- tools/test_template.py | 11 +++++++---- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c3b9aa4..4284e9c 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ through the module, and checks them with libopus's own `opus_compare`. ## Getting started ```sh -mcpp new tone --template mcpplibs.mwrap.opus@1.6.1 +mcpp new tone --template mcpplibs.mwrap.opus@1.6.1.1 cd tone mcpp run ``` @@ -46,7 +46,7 @@ memory. Run `mcpp run -- tone.opus` to write the stream to a file too. ```toml [dependencies] -"mcpplibs.mwrap.opus" = "1.6.1" +mcpplibs.mwrap.opus = "1.6.1.1" ``` ```cpp diff --git a/README.zh.md b/README.zh.md index 8c26d63..45750b3 100644 --- a/README.zh.md +++ b/README.zh.md @@ -30,7 +30,7 @@ libopus 1.6.1(编码器与解码器、multistream、ambisonics、repacketizer) ## 快速开始 ```sh -mcpp new tone --template mcpplibs.mwrap.opus@1.6.1 +mcpp new tone --template mcpplibs.mwrap.opus@1.6.1.1 cd tone mcpp run ``` @@ -40,7 +40,7 @@ mcpp run ```toml [dependencies] -"mcpplibs.mwrap.opus" = "1.6.1" +mcpplibs.mwrap.opus = "1.6.1.1" ``` ```cpp diff --git a/examples/opus/mcpp.toml b/examples/opus/mcpp.toml index af57021..3a7d41c 100644 --- a/examples/opus/mcpp.toml +++ b/examples/opus/mcpp.toml @@ -19,4 +19,4 @@ kind = "bin" main = "conformance/opus_compare.c" [dependencies] -"mcpplibs.mwrap.opus" = { path = "../.." } +mcpplibs.mwrap.opus = { path = "../.." } diff --git a/mcpp.toml b/mcpp.toml index c435049..0adc2aa 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -2,7 +2,7 @@ [package] namespace = "mcpplibs.mwrap" name = "opus" -version = "1.6.1" +version = "1.6.1.1" description = "Opus C++ modules for mcpp (import mcpplibs.mwrap.opus;): the libopus 1.6.1 codec (encoder, decoder, multistream, projection, repacketizer), the opusfile 0.12 Ogg Opus reader and the libogg 1.3.6 container, over compat.opus, compat.opusfile and compat.ogg; the macros as constants, type aliases and typed CTL requests" license = "Apache-2.0" authors = ["mcpp-community"] diff --git a/templates/tone/mcpp.toml.in b/templates/tone/mcpp.toml.in index a637560..43c2cea 100644 --- a/templates/tone/mcpp.toml.in +++ b/templates/tone/mcpp.toml.in @@ -7,4 +7,4 @@ kind = "bin" main = "src/main.cpp" [dependencies] -"{{self.name}}" = "{{self.version}}" +{{self.name}} = "{{self.version}}" diff --git a/tools/test_template.py b/tools/test_template.py index 81ea805..07f1ca6 100644 --- a/tools/test_template.py +++ b/tools/test_template.py @@ -48,7 +48,10 @@ def main(): project = temporary / "quickstart" manifest = project / "mcpp.toml" text = manifest.read_text() - dependency = tomllib.loads(text)["dependencies"][identity] + # The key is unquoted, so TOML reads it as one table per segment. + dependency = tomllib.loads(text)["dependencies"] + for segment in identity.split("."): + dependency = dependency[segment] options = {"version": dependency} if isinstance(dependency, str) else dependency assert options["version"] == version, options replacement = '{ path = ' + json.dumps(package.as_posix()) @@ -56,9 +59,9 @@ def main(): replacement += ', features = ' + json.dumps(options["features"]) replacement += ' }' lines = text.splitlines() - matches = [i for i, line in enumerate(lines) if line.startswith(json.dumps(identity) + " =")] - assert len(matches) == 1, "Expected exactly one qualified dependency from self.name" - lines[matches[0]] = json.dumps(identity) + " = " + replacement + matches = [i for i, line in enumerate(lines) if line.startswith(identity + " =")] + assert len(matches) == 1, "Expected exactly one unquoted qualified dependency from self.name" + lines[matches[0]] = identity + " = " + replacement manifest.write_text("\n".join(lines) + "\n") if args.index: candidate_index = args.index.resolve()