diff --git a/README.md b/README.md index f72ff7f..e29340c 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ runs on every CI run over the same library. ## Getting started ```sh -mcpp new bundle --template mcpplibs.mwrap.libarchive@3.8.7 +mcpp new bundle --template mcpplibs.mwrap.libarchive@3.8.7.1 cd bundle mcpp run ``` @@ -37,7 +37,7 @@ The default template writes a tar.gz of three files in memory and lists it; ```toml [dependencies] -"mcpplibs.mwrap.libarchive" = "3.8.7" +mcpplibs.mwrap.libarchive = "3.8.7.1" ``` ```cpp diff --git a/README.zh.md b/README.zh.md index 7e9d81a..93fa373 100644 --- a/README.zh.md +++ b/README.zh.md @@ -24,7 +24,7 @@ ## 快速开始 ```sh -mcpp new bundle --template mcpplibs.mwrap.libarchive@3.8.7 +mcpp new bundle --template mcpplibs.mwrap.libarchive@3.8.7.1 cd bundle mcpp run ``` @@ -33,7 +33,7 @@ mcpp run ```toml [dependencies] -"mcpplibs.mwrap.libarchive" = "3.8.7" +mcpplibs.mwrap.libarchive = "3.8.7.1" ``` ```cpp diff --git a/mcpp.toml b/mcpp.toml index 75f7f2c..6dd6186 100644 --- a/mcpp.toml +++ b/mcpp.toml @@ -2,7 +2,7 @@ [package] namespace = "mcpplibs.mwrap" name = "libarchive" -version = "3.8.7" +version = "3.8.7.1" description = "libarchive 3.8.7 C++ modules for mcpp (import mcpplibs.mwrap.libarchive;): reading and writing tar, cpio, zip, 7-Zip, ISO 9660 and other archives with their compression filters, archive entries and disk access over compat.libarchive, with the constants of archive.h as C++ constants" license = "Apache-2.0" authors = ["mcpp-community"] diff --git a/templates/bundle/mcpp.toml.in b/templates/bundle/mcpp.toml.in index a637560..43c2cea 100644 --- a/templates/bundle/mcpp.toml.in +++ b/templates/bundle/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()