diff --git a/README.md b/README.md index 1c3a73b..d72dd47 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Windows and wasm32, with 1 to 8 workers and either SIMD width. ## Getting started ```sh -mcpp new tower --template mcpplibs.mwrap.box2d@3.2.0 +mcpp new tower --template mcpplibs.mwrap.box2d@3.2.0.1 cd tower mcpp run ``` @@ -42,7 +42,7 @@ final state: the same on every platform. ```toml [dependencies] -"mcpplibs.mwrap.box2d" = "3.2.0" +mcpplibs.mwrap.box2d = "3.2.0.1" ``` ```cpp diff --git a/README.zh.md b/README.zh.md index 975151d..537a2a0 100644 --- a/README.zh.md +++ b/README.zh.md @@ -29,7 +29,7 @@ worker、两种 SIMD 宽度,得到逐位相同的结果。 ## 快速开始 ```sh -mcpp new tower --template mcpplibs.mwrap.box2d@3.2.0 +mcpp new tower --template mcpplibs.mwrap.box2d@3.2.0.1 cd tower mcpp run ``` @@ -39,7 +39,7 @@ mcpp run ```toml [dependencies] -"mcpplibs.mwrap.box2d" = "3.2.0" +mcpplibs.mwrap.box2d = "3.2.0.1" ``` ```cpp diff --git a/examples/box2d/mcpp.toml b/examples/box2d/mcpp.toml index f7392fc..dbc9cc4 100644 --- a/examples/box2d/mcpp.toml +++ b/examples/box2d/mcpp.toml @@ -14,4 +14,4 @@ main = "src/main.cpp" cxxflags = ["-ffp-contract=off"] [dependencies] -"mcpplibs.mwrap.box2d" = { path = "../.." } +mcpplibs.mwrap.box2d = { path = "../.." } diff --git a/mcpp.toml b/mcpp.toml index 3269c4d..e890323 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -2,7 +2,7 @@ [package] namespace = "mcpplibs.mwrap" name = "box2d" -version = "3.2.0" +version = "3.2.0.1" description = "Box2D 3.2.0 C++ modules for mcpp (import mcpplibs.mwrap.box2d;): the 2D rigid-body physics engine of box2d.h over compat.box2d, its constants and id macros as constexpr, cross-platform deterministic" license = "Apache-2.0" authors = ["mcpp-community"] diff --git a/templates/physics/mcpp.toml.in b/templates/physics/mcpp.toml.in index a637560..43c2cea 100644 --- a/templates/physics/mcpp.toml.in +++ b/templates/physics/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()