Skip to content
Snippets Groups Projects
Commit 665483f3 authored by Ray Kraesig's avatar Ray Kraesig
Browse files

Bug 1804178 - [4/6] Remove pytoml output postprocessing r=glandium

The postprocessing phase that cleaned up `pytoml`'s output has little
effect on `toml`'s output, which is already largely clean. Remove the
additional code.

Differential Revision: https://phabricator.services.mozilla.com/D164153
parent 2ba26991
No related branches found
No related tags found
No related merge requests found
......@@ -115,6 +115,7 @@ git = "https://github.com/smol-rs/async-task"
rev = "f6488e35beccb26eb6e85847b02aa78a42cd3d0e"
replace-with = "vendored-sources"
# Take advantage of the fact that cargo will treat lines starting with #
# as comments to add preprocessing directives. This file can thus by copied
# as-is to $topsrcdir/.cargo/config with no preprocessing to be used there
......
......@@ -885,22 +885,11 @@ license file's hash.
mozpath.normsep(os.path.normcase(self.topsrcdir)),
)
# Normalize pytoml output:
# - removing empty lines
# - remove empty [section]
def toml_dump(data):
dump = toml.dumps(data)
if isinstance(data, dict):
for k, v in data.items():
if all(isinstance(v2, dict) for v2 in v.values()):
dump = dump.replace("[%s]" % k, "")
return dump.strip()
cargo_config = os.path.join(self.topsrcdir, ".cargo", "config.in")
with open(cargo_config, "w", encoding="utf-8", newline="\n") as fh:
fh.write(
CARGO_CONFIG_TEMPLATE.format(
config=toml_dump(config),
config=toml.dumps(config),
replace_name=replace_name,
directory=replace["directory"],
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment