From 370f5479a477de27500b98473ce8f40875bf364a Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Sun, 22 Nov 2026 19:28:07 +0900 Subject: [PATCH] mwrap 2.13.3.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 (conformance/mcpp.toml examples/ftdump/mcpp.toml). --- README.md | 4 ++-- README.zh.md | 4 ++-- conformance/mcpp.toml | 2 +- examples/ftdump/mcpp.toml | 2 +- mcpp.toml | 2 +- templates/banner/mcpp.toml.in | 2 +- tools/test_template.py | 11 +++++++---- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index db4401f..d69ae1b 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ on every CI run, ported onto the module. ## Getting started ```sh -mcpp new banner --template mcpplibs.mwrap.freetype@2.13.3 +mcpp new banner --template mcpplibs.mwrap.freetype@2.13.3.1 cd banner mcpp run # a star and a stroked ring, rasterised mcpp run -- /path/to/font.ttf "Hello" # text in any font, kerned @@ -42,7 +42,7 @@ kerning instead. ```toml [dependencies] -"mcpplibs.mwrap.freetype" = "2.13.3" +mcpplibs.mwrap.freetype = "2.13.3.1" ``` ```cpp diff --git a/README.zh.md b/README.zh.md index 6e68201..adfaa72 100644 --- a/README.zh.md +++ b/README.zh.md @@ -27,7 +27,7 @@ FreeType 自带的测试程序移植到本模块之后,每次 CI 都全部通 ## 快速开始 ```sh -mcpp new banner --template mcpplibs.mwrap.freetype@2.13.3 +mcpp new banner --template mcpplibs.mwrap.freetype@2.13.3.1 cd banner mcpp run # 光栅化一颗星和一个描边的圆环 mcpp run -- /path/to/font.ttf "Hello" # 用任意字体排一行文字,带字距调整 @@ -39,7 +39,7 @@ mcpp run -- /path/to/font.ttf "Hello" # 用任意字体排一行文字, ```toml [dependencies] -"mcpplibs.mwrap.freetype" = "2.13.3" +mcpplibs.mwrap.freetype = "2.13.3.1" ``` ```cpp diff --git a/conformance/mcpp.toml b/conformance/mcpp.toml index d3e6a81..0482517 100644 --- a/conformance/mcpp.toml +++ b/conformance/mcpp.toml @@ -20,4 +20,4 @@ kind = "bin" main = "src/test_bbox.cpp" [dependencies] -"mcpplibs.mwrap.freetype" = { path = ".." } +mcpplibs.mwrap.freetype = { path = ".." } diff --git a/examples/ftdump/mcpp.toml b/examples/ftdump/mcpp.toml index 359f961..03ce371 100644 --- a/examples/ftdump/mcpp.toml +++ b/examples/ftdump/mcpp.toml @@ -9,4 +9,4 @@ kind = "bin" main = "src/main.cpp" [dependencies] -"mcpplibs.mwrap.freetype" = { path = "../.." } +mcpplibs.mwrap.freetype = { path = "../.." } diff --git a/mcpp.toml b/mcpp.toml index 4548353..46c4d4a 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -2,7 +2,7 @@ [package] namespace = "mcpplibs.mwrap" name = "freetype" -version = "2.13.3" +version = "2.13.3.1" description = "FreeType 2.13.3 C++ modules for mcpp (import mcpplibs.mwrap.freetype;): the public API of every FreeType header over compat.freetype, its macros as constants and constexpr functions" license = "Apache-2.0" authors = ["mcpp-community"] diff --git a/templates/banner/mcpp.toml.in b/templates/banner/mcpp.toml.in index a637560..43c2cea 100644 --- a/templates/banner/mcpp.toml.in +++ b/templates/banner/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()