From 0b33d6f398b1d98f1b8c28534e80445872a29355 Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Sun, 22 Nov 2026 17:57:10 +0900 Subject: [PATCH] mwrap 3.4.18.1: the templates write their 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. --- README.md | 6 +++--- README.zh.md | 6 +++--- mcpp.toml | 2 +- templates/info/mcpp.toml.in | 2 +- templates/window/mcpp.toml.in | 2 +- tools/test_template.py | 11 +++++++---- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index a08e571..8ccd929 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ automated test suite passes on every CI run, compiled against the module. ## Getting started ```sh -mcpp new sdlinfo --template mcpplibs.mwrap.sdl3@3.4.18 +mcpp new sdlinfo --template mcpplibs.mwrap.sdl3@3.4.18.1 cd sdlinfo mcpp run ``` @@ -39,11 +39,11 @@ version, CPU features, video, render, audio and GPU drivers, the displays, a GPU device and its shader formats. It needs no window or desktop; without a display it reports through SDL's offscreen driver. The `window` template is a sketch pad on SDL's app callbacks and needs a desktop: -`mcpp new pad --template mcpplibs.mwrap.sdl3@3.4.18:window`. +`mcpp new pad --template mcpplibs.mwrap.sdl3@3.4.18.1:window`. ```toml [dependencies] -"mcpplibs.mwrap.sdl3" = "3.4.18" +mcpplibs.mwrap.sdl3 = "3.4.18.1" ``` ```cpp diff --git a/README.zh.md b/README.zh.md index fc69fe5..eceb744 100644 --- a/README.zh.md +++ b/README.zh.md @@ -27,7 +27,7 @@ ## 快速开始 ```sh -mcpp new sdlinfo --template mcpplibs.mwrap.sdl3@3.4.18 +mcpp new sdlinfo --template mcpplibs.mwrap.sdl3@3.4.18.1 cd sdlinfo mcpp run ``` @@ -35,11 +35,11 @@ mcpp run 默认模板(`info`)打印 SDL 在这台机器上看到的一切:版本、CPU 特性、视频/渲染/ 音频/GPU 驱动、显示器、一个 GPU 设备及其着色器格式。它不需要窗口或桌面;没有显示器时 通过 SDL 的 offscreen 驱动报告。`window` 模板是基于 SDL 应用回调的画板,需要桌面环境: -`mcpp new pad --template mcpplibs.mwrap.sdl3@3.4.18:window`。 +`mcpp new pad --template mcpplibs.mwrap.sdl3@3.4.18.1:window`。 ```toml [dependencies] -"mcpplibs.mwrap.sdl3" = "3.4.18" +mcpplibs.mwrap.sdl3 = "3.4.18.1" ``` ```cpp diff --git a/mcpp.toml b/mcpp.toml index bce972c..bdbf4ef 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -2,7 +2,7 @@ [package] namespace = "mcpplibs.mwrap" name = "sdl3" -version = "3.4.18" +version = "3.4.18.1" description = "SDL 3.4.18 C++ modules for mcpp (import mcpplibs.mwrap.sdl3;): the C API of SDL.h (with SDL_vulkan.h and SDL_main.h's functions) over compat.sdl3, its inline API adapted, its macros as constants and functions" license = "Apache-2.0" authors = ["mcpp-community"] diff --git a/templates/info/mcpp.toml.in b/templates/info/mcpp.toml.in index a637560..43c2cea 100644 --- a/templates/info/mcpp.toml.in +++ b/templates/info/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/templates/window/mcpp.toml.in b/templates/window/mcpp.toml.in index a637560..43c2cea 100644 --- a/templates/window/mcpp.toml.in +++ b/templates/window/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 7ae25ba..6dc9b00 100644 --- a/tools/test_template.py +++ b/tools/test_template.py @@ -54,7 +54,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()) @@ -62,9 +65,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()