diff --git a/README.md b/README.md index 19c769f..1f10b94 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ backend). ## Getting started ```sh -mcpp new tone --template mcpplibs.mwrap.miniaudio@0.11.25 +mcpp new tone --template mcpplibs.mwrap.miniaudio@0.11.25.1 cd tone mcpp run ``` @@ -43,7 +43,7 @@ measures it. `mcpp run -- --play` then plays it on the default device. ```toml [dependencies] -"mcpplibs.mwrap.miniaudio" = "0.11.25" +mcpplibs.mwrap.miniaudio = "0.11.25.1" ``` ```cpp diff --git a/README.zh.md b/README.zh.md index 12930be..66e2999 100644 --- a/README.zh.md +++ b/README.zh.md @@ -29,7 +29,7 @@ WAV、FLAC 与 MP3,编码 WAV,做格式转换与重采样,并通过节点 ## 快速开始 ```sh -mcpp new tone --template mcpplibs.mwrap.miniaudio@0.11.25 +mcpp new tone --template mcpplibs.mwrap.miniaudio@0.11.25.1 cd tone mcpp run ``` @@ -39,7 +39,7 @@ WAV,再解码回来并测量。`mcpp run -- --play` 会在默认设备上播 ```toml [dependencies] -"mcpplibs.mwrap.miniaudio" = "0.11.25" +mcpplibs.mwrap.miniaudio = "0.11.25.1" ``` ```cpp diff --git a/mcpp.toml b/mcpp.toml index 02d6033..3632754 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -2,7 +2,7 @@ [package] namespace = "mcpplibs.mwrap" name = "miniaudio" -version = "0.11.25" +version = "0.11.25.1" description = "miniaudio 0.11.25 C++ modules for mcpp (import mcpplibs.mwrap.miniaudio;): audio playback and capture on every platform's native backend and Web Audio, decoding (WAV, FLAC, MP3), WAV encoding, conversion, resampling, the node graph and the high-level engine of miniaudio.h over compat.miniaudio, its macros as constants" 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()